get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2211757/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2211757,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2211757/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260317084624.457185-7-me@linux.beauty/",
    "project": {
        "id": 8,
        "url": "http://patchwork.ozlabs.org/api/1.2/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,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260317084624.457185-7-me@linux.beauty>",
    "list_archive_url": null,
    "date": "2026-03-17T08:46:21",
    "name": "[RFC,v5,6/7] ext4: fast commit: add lock_updates tracepoint",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d7bd42fe7c540a59f7d6c4abed9b3aad3d7dfa34",
    "submitter": {
        "id": 84264,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/84264/?format=api",
        "name": "Li Chen",
        "email": "me@linux.beauty"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260317084624.457185-7-me@linux.beauty/mbox/",
    "series": [
        {
            "id": 496215,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/496215/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=496215",
            "date": "2026-03-17T08:46:15",
            "name": "ext4: fast commit: snapshot inode state for FC log",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/496215/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2211757/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2211757/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <SRS0=ML2j=BR=vger.kernel.org=linux-ext4+bounces-15103-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=oRkCCeZV;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=ml2j=br=vger.kernel.org=linux-ext4+bounces-15103-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=104.64.211.4\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=oRkCCeZV;\n\tdkim-atps=neutral",
            "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=104.64.211.4; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15103-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=\"oRkCCeZV\"",
            "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 (gandalf.ozlabs.org [150.107.74.76])\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 4fZm213TmCz1y1P\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Mar 2026 19:52:57 +1100 (AEDT)",
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fZm212zrxz4w93\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Mar 2026 19:52:57 +1100 (AEDT)",
            "by gandalf.ozlabs.org (Postfix)\n\tid 4fZm212w4lz4wDm; Tue, 17 Mar 2026 19:52:57 +1100 (AEDT)",
            "from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])\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 4fZm1y0GK8z4w93\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 17 Mar 2026 19:52:54 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id BB736301068A\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 17 Mar 2026 08:52:51 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D228B39D6D3;\n\tTue, 17 Mar 2026 08:52:47 +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 2CD043469FC;\n\tTue, 17 Mar 2026 08:52:46 +0000 (UTC)",
            "by mx.zohomail.com with SMTPS id 1773737218326614.3828448167444;\n\tTue, 17 Mar 2026 01:46:58 -0700 (PDT)"
        ],
        "ARC-Seal": [
            "i=3; a=rsa-sha256; d=ozlabs.org; s=201707; t=1773737577; cv=pass;\n\tb=DmS8ECoybH1yR3f1Fga2ouw+qUIdyMR1u/wcJJfQA6igva0YSR6Cde5BV8x+i9huDYNvMIp09AaASRdBWpo+lRQ1CiM9DuJadIbKwbFd7LoACv6wCdPYteJ+f2ov/dGpVLV4l2GxsnPmf/xG5nAsn4mLVjD20HXl+eAxt5r+RBCA6dCTDYFolqKoHYManirUKrWkltCZ+9jTyob7iRdUcDFt80+Wb4d/muHgiSqOSAOPFXpDpcbN0tWNMjktvDhfNXSWEpNlv/E62wLl5PzDTPnRRGcxGemdQCD2dtMp2ACNpLG/vELuYEjwu8/R4v/tSwXhbJuFn+ocPVFKPfyDeA==",
            "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1773737567; cv=pass;\n b=co3zI5MAR6dhLOhKpwnF8tHI2p6vyr20LG66mOihjcIkgjm9hISNVA4d9P/2el9KqF0CyJnqnUdEg6ZZ7/L8Za7Myg8q5uwQ4+Lp/NhMcAs5uUKo/e8fUquipOPuEDMAGhV3xv4UGDIRL/aIJBbt7Z0P1cw1wu7S2UNWwMl3KMo=",
            "i=1; a=rsa-sha256; t=1773737219; cv=none;\n\td=zohomail.com; s=zohoarc;\n\tb=KISMUvMHgs/gF5AA5njE0BevoFAp5Jb6jetoYmXETpe9Usg8WOTNUd3JWFoAQDMZXcUU+G4f9RgsPNDK9AX8BGkGq37WyJy+Yq5yg00g389epMkfEBt2GL0FF5utlaFRhbHWi+bEnvAGUqkHBYiL8qnVkiKWitRzfhZCrsL9Lg0="
        ],
        "ARC-Message-Signature": [
            "i=3; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1773737577; c=relaxed/relaxed;\n\tbh=x+FqMOeVwBq5rmUfLqMZ2sHmwA9pQ8tbT/7FXrKq/co=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=qWjm959TSJjzi/Emfy6/CpjsVw8DhjaKq2ESWPu7k4fM3bP/xn6EvCfdg5Px8KWnPB9DNHhUJaeSv7NmPO3iLUsNdhdMY+I0ujU7dTSLw/2hsVpj7fea/n9M7jCSFBeKbjXN4JZHayqwvls1NEF52HS78syhg61U8IwF7r1TjxK3eG9uuSxL3bMm8xkrn9LsburtMpuobS+69KrY8qBHPkD7ZN9l8GEjFlpRyDHRBAPOoiiHAa1YuDA9JZmtkK1NKB9JfDe39/K6dD2rEeGc6xA7mbvY7EpeSdql+WdJBw2IdItgqlL07zDFmqvKQsPMYGDST7qfWKhElCTmFY/mXA==",
            "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1773737567; c=relaxed/simple;\n\tbh=3V/4HCxLNar5J0DSP8hsbSJr8QT6q1DT/iyom99xsTc=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=r3pI76POAbA2QGo4TlVtmTFgsSxXvZyv9ZFzR/XdOy3tvhP7+PuHi32ddrmJsmpN+HW8ukmVDGdsFBgRvau8JuvNau3QTrCPvwtibcfqzgU8toIbPEnm8H9NkBK0NVS+UtrgU8svCL0QxnelwRTcZmjrhR+mWmgSh7NxqVu8/zA=",
            "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;\n s=zohoarc;\n\tt=1773737219;\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=x+FqMOeVwBq5rmUfLqMZ2sHmwA9pQ8tbT/7FXrKq/co=;\n\tb=TjOzOf5TwF7W+C3/zvYfQVI+/YyH0O4HS5nVm3PPzhV5GKjxazxYx0S4nlKMJmqnYgG8J2846nqPsfnO1ARPtFduqXL01Y32ShbDaw8opAUmoLEdl3BPyt6JIVv2d6uKU7vi+ACiciRKLzbUevcLXutEYktUI41WQaAQ5HSG/cY="
        ],
        "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=oRkCCeZV; dkim-atps=neutral;\n spf=pass (client-ip=104.64.211.4; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15103-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=oRkCCeZV; 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=1773737219;\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=x+FqMOeVwBq5rmUfLqMZ2sHmwA9pQ8tbT/7FXrKq/co=;\n\tb=oRkCCeZVTBm1sS6jJlAvvObbtjL4j4MdqafGsaPDQ8cgwu3px8SIFDA3y9Esfzbh\n\tZf2SDp+DN5KVQoZBBu+/x/atQyW2WEXHOXFzn2pbiN4kbhqrNJN/6MSw55xjTIoZE38\n\t/4qKPJRIHlZCAFxbHN6teB7Xj9a+kkxZg7wOtuE0=",
        "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\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 v5 6/7] ext4: fast commit: add lock_updates tracepoint",
        "Date": "Tue, 17 Mar 2026 16:46:21 +0800",
        "Message-ID": "<20260317084624.457185-7-me@linux.beauty>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260317084624.457185-1-me@linux.beauty>",
        "References": "<20260317084624.457185-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---\n fs/ext4/ext4.h              | 15 ++++++++\n fs/ext4/fast_commit.c       | 71 +++++++++++++++++++++++++++++--------\n include/trace/events/ext4.h | 61 +++++++++++++++++++++++++++++++\n 3 files changed, 132 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 68a64fa0be926..b9e146f3dd9e4 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -1037,6 +1037,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\t\t= 0,\n+\tEXT4_FC_SNAP_ERR_ES_MISS\t= 1,\n+\tEXT4_FC_SNAP_ERR_ES_DELAYED\t= 2,\n+\tEXT4_FC_SNAP_ERR_ES_OTHER\t= 3,\n+\tEXT4_FC_SNAP_ERR_INODES_CAP\t= 4,\n+\tEXT4_FC_SNAP_ERR_RANGES_CAP\t= 5,\n+\tEXT4_FC_SNAP_ERR_NOMEM\t\t= 6,\n+\tEXT4_FC_SNAP_ERR_INODE_LOC\t= 7,\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 d1eefee609120..4929e2990b292 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@@ -1010,11 +1017,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@@ -1024,12 +1036,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@@ -1054,6 +1071,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@@ -1070,7 +1088,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@@ -1082,8 +1100,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@@ -1092,6 +1112,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@@ -1102,7 +1123,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@@ -1203,7 +1224,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@@ -1221,6 +1245,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@@ -1244,6 +1270,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@@ -1268,16 +1296,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@@ -1286,10 +1318,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@@ -1337,13 +1374,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@@ -1357,8 +1394,12 @@ 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+\tlocked_ns = ktime_to_ns(ktime_sub(ktime_get(), lock_start));\n+\ttrace_ext4_fc_lock_updates(sb, commit_tid, locked_ns, snap_inodes,\n+\t\t\t\t   snap_ranges, ret, snap_err);\n \tkvfree(inodes);\n \tif (ret)\n \t\treturn ret;\n@@ -1563,7 +1604,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 fd76d14c2776e..dc084f39b74ad 100644\n--- a/include/trace/events/ext4.h\n+++ b/include/trace/events/ext4.h\n@@ -104,6 +104,26 @@ TRACE_DEFINE_ENUM(EXT4_FC_REASON_INODE_JOURNAL_DATA);\n TRACE_DEFINE_ENUM(EXT4_FC_REASON_ENCRYPTED_FILENAME);\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@@ -2812,6 +2832,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",
        "v5",
        "6/7"
    ]
}