Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220885/?format=api
{ "id": 2220885, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220885/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260408112020.716706-7-me@linux.beauty/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.1/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260408112020.716706-7-me@linux.beauty>", "date": "2026-04-08T11:20:17", "name": "[RFC,v6,6/7] ext4: fast commit: add lock_updates tracepoint", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "cd872e597688014eda95bc8deab02d748015ab67", "submitter": { "id": 84264, "url": "http://patchwork.ozlabs.org/api/1.1/people/84264/?format=api", "name": "Li Chen", "email": "me@linux.beauty" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260408112020.716706-7-me@linux.beauty/mbox/", "series": [ { "id": 499121, "url": "http://patchwork.ozlabs.org/api/1.1/series/499121/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=499121", "date": "2026-04-08T11:20:11", "name": "ext4: fast commit: snapshot inode state for FC log", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/499121/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220885/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220885/checks/", "tags": {}, "headers": { "Return-Path": "\n <SRS0=PZ4G=CH=vger.kernel.org=linux-ext4+bounces-15675-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.beauty header.i=me@linux.beauty\n header.a=rsa-sha256 header.s=zmail header.b=WuGDH9Ke;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=pz4g=ch=vger.kernel.org=linux-ext4+bounces-15675-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c15:e001:75::12fc:5321\"\n arc.chain=\"subspace.kernel.org:zohomail.com\"", "gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty", "gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.beauty header.i=me@linux.beauty\n header.a=rsa-sha256 header.s=zmail header.b=WuGDH9Ke;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15675-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty\n header.b=\"WuGDH9Ke\"", "smtp.subspace.kernel.org;\n arc=pass smtp.client-ip=136.143.188.15", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.beauty" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frLNV2Bcjz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 21:26:02 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4frLNV18p2z4wsQ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 21:26:02 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4frLNV13S9z4wsm; Wed, 08 Apr 2026 21:26:02 +1000 (AEST)", "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4frLNQ4D9rz4wsQ\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 08 Apr 2026 21:25:58 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 2D9FF301490A\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 8 Apr 2026 11:25:56 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id BEDCB37F756;\n\tWed, 8 Apr 2026 11:25:54 +0000 (UTC)", "from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com\n [136.143.188.15])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id F34A93B27F2;\n\tWed, 8 Apr 2026 11:25:52 +0000 (UTC)", "by mx.zohomail.com with SMTPS id 1775647281185254.41746707746904;\n\tWed, 8 Apr 2026 04:21:21 -0700 (PDT)" ], "ARC-Seal": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775647562; cv=pass;\n\tb=ZHQcQcH995X7iJkwldWZrUcSXfGffrq3Fr0PpsJ2LggUx80Uhl+z/OplP1XC6OxYBDSnxylYWOTfo341kpA0844Edkf+NiJIJqPOuvd8cTX1dSIrtXAzgtt/TEZHQOFSV2ajimVT30xLCxMeZ4Oe69CH2nCqshr3IQjjTGdNVYjuCnt8fk/1mXSXA+V84pasANyLh2zoCYARneB+JlQi16uuZH/hWsMyEh4AbQ8E6E7WFxr/5adrktz61axfzKgTwhb4LYiqKwpXaIL9hzSJroGIZTVPIHKkYVkMLHW7KzG+3F6qb8PhK4ZC72BWrTziN6GxbOfuyuBJdatI2lL27A==", "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775647554; cv=pass;\n b=E4A4rIrnEBgQTTgKaz/wt9/b1mAwGvWL9J8/6oZk0nlZ98YePJq0+VsW3MvNWQvdrgrFqvvJEoR+SfcLyFXR3OAiFngIU68xyO+k5ch3KtmibOPj0kr+JnWJBTodJcutLrCXf14au/RqZZDZo/2bSqxOufO9YoMKRftxBehkblw=", "i=1; a=rsa-sha256; t=1775647282; cv=none;\n\td=zohomail.com; s=zohoarc;\n\tb=Vp3xArMic/hTfWwRY1EsOOSItyr1oKYkKwBS63ztGQCAlVxSdlQkt2/8XrJtIsMOVrwx342VMGpUC0f0OSILoFJn9oqe+cnjnUdq5l5m+DDeqRi7yHe65yP5o+g6GLICbuT3jik5BO+7+5OGE9EgWfe48KSw6v0G1aa8abnB1Qk=" ], "ARC-Message-Signature": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775647562; c=relaxed/relaxed;\n\tbh=Bchmw8afdzwx4XNLCbq/3HNYQmkHDSx6NKmX2p1+RAI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=gpXSxUjn0jFabWR/O4pJlzB340RtR1xgoNTkDddhoKEpVCLFjRyHxWoQwB5c955B9tPCC+Yvk6bQBrxBezNUbTNCcFy8S8Dx93fO6efqC48hEBzS1/3GQ/yq8MG8JjVLmA5bShRkZY64OLj9e3OmbXpwskR9WqaXzWNvP38K4w7Vua82iFSXESrrhv6vK6IhEDbmMwFo86WBMKbURr+xz8pVFVBfR8OL2I8LQON06mnqP8+0TSeQ6LIEYDgI4XdD/lZCM/q35CVHXIlYkl7G1laLsmCNslXWM5O9hVxoeSg7RUrfv5NqzOSnV6soHITYY8nbRWdNSReU+QHr6Hoofg==", "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775647554; c=relaxed/simple;\n\tbh=B0aEscXzmYZWwFd85zkSyF4jEeOaeP1Ho6AK3/UBJjs=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=UBPq5DrAdqhTice4kTPLqK5Y+L5keh6+SauKIgg/iy1pKlni3Y3OIP7JFkuaspeyMGeL3HLKfYiQ5pgzXunQ97enn1EFjHpLB82GVKCzZAYRw7ICVaqhxBWTCixPSzMUE7BJQSdZ4btHC9WGKYKjna//6h8F5TB5Oql6pqmIu38=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;\n s=zohoarc;\n\tt=1775647282;\n h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=Bchmw8afdzwx4XNLCbq/3HNYQmkHDSx6NKmX2p1+RAI=;\n\tb=m5BE2+O3zYXToeehUcaLSAGv+jL2a3V1VcmoJ63sh0vN70M+nuML0b9szeF3oCEgHO6vPx5Q6SUsFGUx9yNFfegbi9T3TsFzYYg1D0JYONzEjK7OtKQ6NikVljLjPmsyEZdBfxInQtKOqVvua265pEfZg02dexvV96iEwqYpcVo=" ], "ARC-Authentication-Results": [ "i=3; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty;\n dkim=pass (1024-bit key;\n unprotected) header.d=linux.beauty header.i=me@linux.beauty\n header.a=rsa-sha256 header.s=zmail header.b=WuGDH9Ke; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15675-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty;\n spf=pass smtp.mailfrom=linux.beauty;\n dkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty\n header.b=WuGDH9Ke; arc=pass smtp.client-ip=136.143.188.15", "i=1; mx.zohomail.com;\n\tdkim=pass header.i=linux.beauty;\n\tspf=pass smtp.mailfrom=me@linux.beauty;\n\tdmarc=pass header.from=<me@linux.beauty>" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1775647282;\n\ts=zmail; d=linux.beauty; i=me@linux.beauty;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=Bchmw8afdzwx4XNLCbq/3HNYQmkHDSx6NKmX2p1+RAI=;\n\tb=WuGDH9KeTxH7yn8xHIlYteklSNm2h9Bnpd7FhOQK8QKbfb/SReTlGxHCtgajniRp\n\t9CkQ+iAuek8/RvNdblAAJZNgGhFWoMx8ANGmiK7w1Dq7wVKYVOZZZFU9X3Hfz9Kwb3m\n\twQHM44n2iCWD2cdhpyrV64W8TyqH8nhZqvPlGuWQ=", "From": "Li Chen <me@linux.beauty>", "To": "Zhang Yi <yi.zhang@huaweicloud.com>,\n\tTheodore Ts'o <tytso@mit.edu>,\n\tAndreas Dilger <adilger.kernel@dilger.ca>,\n\tBaokun Li <libaokun@linux.alibaba.com>,\n\tJan Kara <jack@suse.cz>,\n\tOjaswin Mujoo <ojaswin@linux.ibm.com>,\n\t\"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>,\n\tZhang Yi <yi.zhang@huawei.com>,\n\tSteven Rostedt <rostedt@goodmis.org>,\n\tMasami Hiramatsu <mhiramat@kernel.org>,\n\tMathieu Desnoyers <mathieu.desnoyers@efficios.com>,\n\tlinux-ext4@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-trace-kernel@vger.kernel.org", "Cc": "Li Chen <me@linux.beauty>", "Subject": "[RFC v6 6/7] ext4: fast commit: add lock_updates tracepoint", "Date": "Wed, 8 Apr 2026 19:20:17 +0800", "Message-ID": "<20260408112020.716706-7-me@linux.beauty>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260408112020.716706-1-me@linux.beauty>", "References": "<20260408112020.716706-1-me@linux.beauty>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-ZohoMailClient": "External", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "Commit-time fast commit snapshots run under jbd2_journal_lock_updates(),\nso it is useful to quantify the time spent with updates locked and to\nunderstand why snapshotting can fail.\n\nAdd a new tracepoint, ext4_fc_lock_updates, reporting the time spent in\nthe updates-locked window along with the number of snapshotted inodes\nand ranges. Record the first snapshot failure reason in a stable snap_err\nfield for tooling.\n\nSigned-off-by: Li Chen <me@linux.beauty>\n---\nChanges in v6:\n- Drop explicit ext4_fc_snap_err assignments and rely on enum\n auto-increment.\n- Treat locked_ns as trace-only in this patch and calculate it only when\n ext4_fc_lock_updates is enabled, as suggested by Steven Rostedt.\n\n fs/ext4/ext4.h | 15 ++++++++\n fs/ext4/fast_commit.c | 74 +++++++++++++++++++++++++++++--------\n include/trace/events/ext4.h | 61 ++++++++++++++++++++++++++++++\n 3 files changed, 135 insertions(+), 15 deletions(-)", "diff": "diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 13fe4fdf9bda..1ff6ea1bde3e 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -1028,6 +1028,21 @@ enum {\n \n struct ext4_fc_inode_snap;\n \n+/*\n+ * Snapshot failure reasons for ext4_fc_lock_updates tracepoint.\n+ * Keep these stable for tooling.\n+ */\n+enum ext4_fc_snap_err {\n+\tEXT4_FC_SNAP_ERR_NONE = 0,\n+\tEXT4_FC_SNAP_ERR_ES_MISS,\n+\tEXT4_FC_SNAP_ERR_ES_DELAYED,\n+\tEXT4_FC_SNAP_ERR_ES_OTHER,\n+\tEXT4_FC_SNAP_ERR_INODES_CAP,\n+\tEXT4_FC_SNAP_ERR_RANGES_CAP,\n+\tEXT4_FC_SNAP_ERR_NOMEM,\n+\tEXT4_FC_SNAP_ERR_INODE_LOC,\n+};\n+\n /*\n * fourth extended file system inode data in memory\n */\ndiff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c\nindex ab751b855afa..6ac6ebe79d7b 100644\n--- a/fs/ext4/fast_commit.c\n+++ b/fs/ext4/fast_commit.c\n@@ -193,6 +193,12 @@ static struct kmem_cache *ext4_fc_range_cachep;\n #define EXT4_FC_SNAPSHOT_MAX_INODES\t1024\n #define EXT4_FC_SNAPSHOT_MAX_RANGES\t2048\n \n+static inline void ext4_fc_set_snap_err(int *snap_err, int err)\n+{\n+\tif (snap_err && *snap_err == EXT4_FC_SNAP_ERR_NONE)\n+\t\t*snap_err = err;\n+}\n+\n static void ext4_end_buffer_io_sync(struct buffer_head *bh, int uptodate)\n {\n \tBUFFER_TRACE(bh, \"\");\n@@ -983,11 +989,12 @@ static void ext4_fc_free_inode_snap(struct inode *inode)\n static int ext4_fc_snapshot_inode_data(struct inode *inode,\n \t\t\t\t struct list_head *ranges,\n \t\t\t\t unsigned int nr_ranges_total,\n-\t\t\t\t unsigned int *nr_rangesp)\n+\t\t\t\t unsigned int *nr_rangesp,\n+\t\t\t\t int *snap_err)\n {\n \tstruct ext4_inode_info *ei = EXT4_I(inode);\n-\tunsigned int nr_ranges = 0;\n \text4_lblk_t start_lblk, end_lblk, cur_lblk;\n+\tunsigned int nr_ranges = 0;\n \n \tspin_lock(&ei->i_fc_lock);\n \tif (ei->i_fc_lblk_len == 0) {\n@@ -1011,11 +1018,16 @@ static int ext4_fc_snapshot_inode_data(struct inode *inode,\n \t\tstruct ext4_fc_range *range;\n \t\text4_lblk_t len;\n \n-\t\tif (!ext4_es_lookup_extent(inode, cur_lblk, NULL, &es, NULL))\n+\t\tif (!ext4_es_lookup_extent(inode, cur_lblk, NULL, &es, NULL)) {\n+\t\t\text4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_ES_MISS);\n \t\t\treturn -EAGAIN;\n+\t\t}\n \n-\t\tif (ext4_es_is_delayed(&es))\n+\t\tif (ext4_es_is_delayed(&es)) {\n+\t\t\text4_fc_set_snap_err(snap_err,\n+\t\t\t\t\t EXT4_FC_SNAP_ERR_ES_DELAYED);\n \t\t\treturn -EAGAIN;\n+\t\t}\n \n \t\tlen = es.es_len - (cur_lblk - es.es_lblk);\n \t\tif (len > end_lblk - cur_lblk + 1)\n@@ -1025,12 +1037,17 @@ static int ext4_fc_snapshot_inode_data(struct inode *inode,\n \t\t\tcontinue;\n \t\t}\n \n-\t\tif (nr_ranges_total + nr_ranges >= EXT4_FC_SNAPSHOT_MAX_RANGES)\n+\t\tif (nr_ranges_total + nr_ranges >= EXT4_FC_SNAPSHOT_MAX_RANGES) {\n+\t\t\text4_fc_set_snap_err(snap_err,\n+\t\t\t\t\t EXT4_FC_SNAP_ERR_RANGES_CAP);\n \t\t\treturn -E2BIG;\n+\t\t}\n \n \t\trange = kmem_cache_alloc(ext4_fc_range_cachep, GFP_NOFS);\n-\t\tif (!range)\n+\t\tif (!range) {\n+\t\t\text4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_NOMEM);\n \t\t\treturn -ENOMEM;\n+\t\t}\n \t\tnr_ranges++;\n \n \t\trange->lblk = cur_lblk;\n@@ -1055,6 +1072,7 @@ static int ext4_fc_snapshot_inode_data(struct inode *inode,\n \t\t\t\trange->len = max;\n \t\t} else {\n \t\t\tkmem_cache_free(ext4_fc_range_cachep, range);\n+\t\t\text4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_ES_OTHER);\n \t\t\treturn -EAGAIN;\n \t\t}\n \n@@ -1071,7 +1089,7 @@ static int ext4_fc_snapshot_inode_data(struct inode *inode,\n \n static int ext4_fc_snapshot_inode(struct inode *inode,\n \t\t\t\t unsigned int nr_ranges_total,\n-\t\t\t\t unsigned int *nr_rangesp)\n+\t\t\t\t unsigned int *nr_rangesp, int *snap_err)\n {\n \tstruct ext4_inode_info *ei = EXT4_I(inode);\n \tstruct ext4_fc_inode_snap *snap;\n@@ -1083,8 +1101,10 @@ static int ext4_fc_snapshot_inode(struct inode *inode,\n \tint alloc_ctx;\n \n \tret = ext4_get_inode_loc_noio(inode, &iloc);\n-\tif (ret)\n+\tif (ret) {\n+\t\text4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_INODE_LOC);\n \t\treturn ret;\n+\t}\n \n \tif (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA))\n \t\tinode_len = EXT4_INODE_SIZE(inode->i_sb);\n@@ -1093,6 +1113,7 @@ static int ext4_fc_snapshot_inode(struct inode *inode,\n \n \tsnap = kmalloc(struct_size(snap, inode_buf, inode_len), GFP_NOFS);\n \tif (!snap) {\n+\t\text4_fc_set_snap_err(snap_err, EXT4_FC_SNAP_ERR_NOMEM);\n \t\tbrelse(iloc.bh);\n \t\treturn -ENOMEM;\n \t}\n@@ -1103,7 +1124,7 @@ static int ext4_fc_snapshot_inode(struct inode *inode,\n \tbrelse(iloc.bh);\n \n \tret = ext4_fc_snapshot_inode_data(inode, &ranges, nr_ranges_total,\n-\t\t\t\t\t &nr_ranges);\n+\t\t\t\t\t &nr_ranges, snap_err);\n \tif (ret) {\n \t\tkfree(snap);\n \t\text4_fc_free_ranges(&ranges);\n@@ -1204,7 +1225,10 @@ static int ext4_fc_alloc_snapshot_inodes(struct super_block *sb,\n \t\t\t\t\t unsigned int *nr_inodesp);\n \n static int ext4_fc_snapshot_inodes(journal_t *journal, struct inode **inodes,\n-\t\t\t\t unsigned int inodes_size)\n+\t\t\t\t unsigned int inodes_size,\n+\t\t\t\t unsigned int *nr_inodesp,\n+\t\t\t\t unsigned int *nr_rangesp,\n+\t\t\t\t int *snap_err)\n {\n \tstruct super_block *sb = journal->j_private;\n \tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n@@ -1222,6 +1246,8 @@ static int ext4_fc_snapshot_inodes(journal_t *journal, struct inode **inodes,\n \talloc_ctx = ext4_fc_lock(sb);\n \tlist_for_each_entry(iter, &sbi->s_fc_q[FC_Q_MAIN], i_fc_list) {\n \t\tif (i >= inodes_size) {\n+\t\t\text4_fc_set_snap_err(snap_err,\n+\t\t\t\t\t EXT4_FC_SNAP_ERR_INODES_CAP);\n \t\t\tret = -E2BIG;\n \t\t\tgoto unlock;\n \t\t}\n@@ -1245,6 +1271,8 @@ static int ext4_fc_snapshot_inodes(journal_t *journal, struct inode **inodes,\n \t\t\tcontinue;\n \n \t\tif (i >= inodes_size) {\n+\t\t\text4_fc_set_snap_err(snap_err,\n+\t\t\t\t\t EXT4_FC_SNAP_ERR_INODES_CAP);\n \t\t\tret = -E2BIG;\n \t\t\tgoto unlock;\n \t\t}\n@@ -1269,16 +1297,20 @@ static int ext4_fc_snapshot_inodes(journal_t *journal, struct inode **inodes,\n \t\tunsigned int inode_ranges = 0;\n \n \t\tret = ext4_fc_snapshot_inode(inodes[idx], nr_ranges,\n-\t\t\t\t\t &inode_ranges);\n+\t\t\t\t\t &inode_ranges, snap_err);\n \t\tif (ret)\n \t\t\tbreak;\n \t\tnr_ranges += inode_ranges;\n \t}\n \n+\tif (nr_inodesp)\n+\t\t*nr_inodesp = i;\n+\tif (nr_rangesp)\n+\t\t*nr_rangesp = nr_ranges;\n \treturn ret;\n }\n \n-static int ext4_fc_perform_commit(journal_t *journal)\n+static int ext4_fc_perform_commit(journal_t *journal, tid_t commit_tid)\n {\n \tstruct super_block *sb = journal->j_private;\n \tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n@@ -1287,10 +1319,15 @@ static int ext4_fc_perform_commit(journal_t *journal)\n \tstruct inode *inode;\n \tstruct inode **inodes;\n \tunsigned int inodes_size;\n+\tunsigned int snap_inodes = 0;\n+\tunsigned int snap_ranges = 0;\n+\tint snap_err = EXT4_FC_SNAP_ERR_NONE;\n \tstruct blk_plug plug;\n \tint ret = 0;\n \tu32 crc = 0;\n \tint alloc_ctx;\n+\tktime_t lock_start;\n+\tu64 locked_ns;\n \n \t/*\n \t * Step 1: Mark all inodes on s_fc_q[MAIN] with\n@@ -1338,13 +1375,13 @@ static int ext4_fc_perform_commit(journal_t *journal)\n \tif (ret)\n \t\treturn ret;\n \n-\n \tret = ext4_fc_alloc_snapshot_inodes(sb, &inodes, &inodes_size);\n \tif (ret)\n \t\treturn ret;\n \n \t/* Step 4: Mark all inodes as being committed. */\n \tjbd2_journal_lock_updates(journal);\n+\tlock_start = ktime_get();\n \t/*\n \t * The journal is now locked. No more handles can start and all the\n \t * previous handles are now drained. Snapshotting happens in this\n@@ -1358,8 +1395,15 @@ static int ext4_fc_perform_commit(journal_t *journal)\n \t}\n \text4_fc_unlock(sb, alloc_ctx);\n \n-\tret = ext4_fc_snapshot_inodes(journal, inodes, inodes_size);\n+\tret = ext4_fc_snapshot_inodes(journal, inodes, inodes_size,\n+\t\t\t\t &snap_inodes, &snap_ranges, &snap_err);\n \tjbd2_journal_unlock_updates(journal);\n+\tif (trace_ext4_fc_lock_updates_enabled()) {\n+\t\tlocked_ns = ktime_to_ns(ktime_sub(ktime_get(), lock_start));\n+\t\ttrace_ext4_fc_lock_updates(sb, commit_tid, locked_ns,\n+\t\t\t\t\t snap_inodes, snap_ranges, ret,\n+\t\t\t\t\t snap_err);\n+\t}\n \tkvfree(inodes);\n \tif (ret)\n \t\treturn ret;\n@@ -1564,7 +1608,7 @@ int ext4_fc_commit(journal_t *journal, tid_t commit_tid)\n \t\tjournal_ioprio = EXT4_DEF_JOURNAL_IOPRIO;\n \tset_task_ioprio(current, journal_ioprio);\n \tfc_bufs_before = (sbi->s_fc_bytes + bsize - 1) / bsize;\n-\tret = ext4_fc_perform_commit(journal);\n+\tret = ext4_fc_perform_commit(journal, commit_tid);\n \tif (ret < 0) {\n \t\tif (ret == -EAGAIN || ret == -E2BIG || ret == -ECANCELED)\n \t\t\tstatus = EXT4_FC_STATUS_INELIGIBLE;\ndiff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h\nindex f493642cf121..7028a28316fa 100644\n--- a/include/trace/events/ext4.h\n+++ b/include/trace/events/ext4.h\n@@ -107,6 +107,26 @@ TRACE_DEFINE_ENUM(EXT4_FC_REASON_VERITY);\n TRACE_DEFINE_ENUM(EXT4_FC_REASON_MOVE_EXT);\n TRACE_DEFINE_ENUM(EXT4_FC_REASON_MAX);\n \n+#undef EM\n+#undef EMe\n+#define EM(a)\tTRACE_DEFINE_ENUM(EXT4_FC_SNAP_ERR_##a);\n+#define EMe(a)\tTRACE_DEFINE_ENUM(EXT4_FC_SNAP_ERR_##a);\n+\n+#define TRACE_SNAP_ERR\t\t\t\t\t\t\\\n+\tEM(NONE)\t\t\t\t\t\t\\\n+\tEM(ES_MISS)\t\t\t\t\t\t\\\n+\tEM(ES_DELAYED)\t\t\t\t\t\t\\\n+\tEM(ES_OTHER)\t\t\t\t\t\t\\\n+\tEM(INODES_CAP)\t\t\t\t\t\t\\\n+\tEM(RANGES_CAP)\t\t\t\t\t\t\\\n+\tEM(NOMEM)\t\t\t\t\t\t\\\n+\tEMe(INODE_LOC)\n+\n+TRACE_SNAP_ERR\n+\n+#undef EM\n+#undef EMe\n+\n #define show_fc_reason(reason)\t\t\t\t\t\t\\\n \t__print_symbolic(reason,\t\t\t\t\t\\\n \t\t{ EXT4_FC_REASON_XATTR,\t\t\"XATTR\"},\t\t\\\n@@ -2818,6 +2838,47 @@ TRACE_EVENT(ext4_fc_commit_stop,\n \t\t __entry->num_fc_ineligible, __entry->nblks_agg, __entry->tid)\n );\n \n+#define EM(a)\t{ EXT4_FC_SNAP_ERR_##a, #a },\n+#define EMe(a)\t{ EXT4_FC_SNAP_ERR_##a, #a }\n+\n+TRACE_EVENT(ext4_fc_lock_updates,\n+\t TP_PROTO(struct super_block *sb, tid_t commit_tid, u64 locked_ns,\n+\t\t unsigned int nr_inodes, unsigned int nr_ranges, int err,\n+\t\t int snap_err),\n+\n+\tTP_ARGS(sb, commit_tid, locked_ns, nr_inodes, nr_ranges, err, snap_err),\n+\n+\tTP_STRUCT__entry(/* entry */\n+\t\t__field(dev_t, dev)\n+\t\t__field(tid_t, tid)\n+\t\t__field(u64, locked_ns)\n+\t\t__field(unsigned int, nr_inodes)\n+\t\t__field(unsigned int, nr_ranges)\n+\t\t__field(int, err)\n+\t\t__field(int, snap_err)\n+\t),\n+\n+\tTP_fast_assign(/* assign */\n+\t\t__entry->dev = sb->s_dev;\n+\t\t__entry->tid = commit_tid;\n+\t\t__entry->locked_ns = locked_ns;\n+\t\t__entry->nr_inodes = nr_inodes;\n+\t\t__entry->nr_ranges = nr_ranges;\n+\t\t__entry->err = err;\n+\t\t__entry->snap_err = snap_err;\n+\t),\n+\n+\tTP_printk(\"dev %d,%d tid %u locked_ns %llu nr_inodes %u nr_ranges %u err %d snap_err %s\",\n+\t\t MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,\n+\t\t __entry->locked_ns, __entry->nr_inodes, __entry->nr_ranges,\n+\t\t __entry->err, __print_symbolic(__entry->snap_err,\n+\t\t\t\t\t\t TRACE_SNAP_ERR))\n+);\n+\n+#undef EM\n+#undef EMe\n+#undef TRACE_SNAP_ERR\n+\n #define FC_REASON_NAME_STAT(reason)\t\t\t\t\t\\\n \tshow_fc_reason(reason),\t\t\t\t\t\t\\\n \t__entry->fc_ineligible_rc[reason]\n", "prefixes": [ "RFC", "v6", "6/7" ] }