get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2216385,
    "url": "http://patchwork.ozlabs.org/api/patches/2216385/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260326111054.907252-4-yi.zhang@huaweicloud.com/",
    "project": {
        "id": 8,
        "url": "http://patchwork.ozlabs.org/api/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": "<20260326111054.907252-4-yi.zhang@huaweicloud.com>",
    "list_archive_url": null,
    "date": "2026-03-26T11:10:46",
    "name": "[v3,03/11] ext4: factor out journalled block zeroing range",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "79573d93e08ea4167ac445f8ee17eca7f6bede70",
    "submitter": {
        "id": 85428,
        "url": "http://patchwork.ozlabs.org/api/people/85428/?format=api",
        "name": "Zhang Yi",
        "email": "yi.zhang@huaweicloud.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260326111054.907252-4-yi.zhang@huaweicloud.com/mbox/",
    "series": [
        {
            "id": 497571,
            "url": "http://patchwork.ozlabs.org/api/series/497571/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=497571",
            "date": "2026-03-26T11:10:46",
            "name": "ext4: refactor partial block zero-out for iomap conversion",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/497571/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216385/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216385/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <SRS0=FhEf=B2=vger.kernel.org=linux-ext4+bounces-15439-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 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=fhef=b2=vger.kernel.org=linux-ext4+bounces-15439-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.232.135.74 arc.chain=subspace.kernel.org",
            "gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com",
            "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15439-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.51",
            "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com",
            "smtp.subspace.kernel.org;\n spf=none smtp.mailfrom=huaweicloud.com"
        ],
        "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 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhLs60PGjz1yGD\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 22:19:35 +1100 (AEDT)",
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fhLry35Byz4wM6\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 22:19:30 +1100 (AEDT)",
            "by gandalf.ozlabs.org (Postfix)\n\tid 4fhLry30Z5z4wCJ; Thu, 26 Mar 2026 22:19:30 +1100 (AEDT)",
            "from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])\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 4fhLrt0wHDz4wM6\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 26 Mar 2026 22:19:26 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id CE3E3305BCA3\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 26 Mar 2026 11:15:56 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C3F8238C430;\n\tThu, 26 Mar 2026 11:15:54 +0000 (UTC)",
            "from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com\n [45.249.212.51])\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 AE74F37C91E;\n\tThu, 26 Mar 2026 11:15:51 +0000 (UTC)",
            "from mail.maildlp.com (unknown [172.19.163.170])\n\tby dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4fhLmT6MCjzYQv3Z;\n\tThu, 26 Mar 2026 19:15:37 +0800 (CST)",
            "from mail02.huawei.com (unknown [10.116.40.112])\n\tby mail.maildlp.com (Postfix) with ESMTP id CFF904056F;\n\tThu, 26 Mar 2026 19:15:49 +0800 (CST)",
            "from huaweicloud.com (unknown [10.50.85.155])\n\tby APP1 (Coremail) with SMTP id cCh0CgD3+NhWFcVprDInCQ--.2580S7;\n\tThu, 26 Mar 2026 19:15:49 +0800 (CST)"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774523970; cv=pass;\n\tb=XnvnKAPSJpj+jaVTfGOFCn9iB/U/5VD9jbyU9bJxMPe90IaKXpi0DaDP9fJ7EujE/GxpzHQtXz11uvvVyc1+Lal8Hy4NkZz81mwQDJgoq/I/W041EO2nHdn9k/dUtdZanHVx+K2uiRsSoILWSgrfM9xD2Wq0O+lAxxrQJmAGjveP8qXl8Q6H4XCOGBH3DllKiHy2DSmQZLMg1O+cZq2Ysvxd1lJ/dktgVjRyQpnwYAsnEDOn5D/EqfcpN+iYjNOGsxoWfHcgUDVVJAxKvG7+CbBcRpUGjOpjkPuq0krUJHgVtuUyThBlj3PRiz0rpQqtTZdKGNjRUEnEk6/XFY6NxQ==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774523754; cv=none;\n b=GT4zBaZAJZw0Qf/EKOFVIhxiFDD9ec1sner9VtqKMTBob7pyh5IbinqEOc4PnsoXXCImcmGiU92aDCWKNFs33RW9PiXcWt6flpyDFIu4p7h233LA7MhCk3RP+c/RIqrRDnT0ceQN4bBBREz9f1W8Lh4pIyPfn8EBV0KWRnAVkdQ="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774523970; c=relaxed/relaxed;\n\tbh=doxKjDrquBVGh/UbTmz6X/a1yTvQCbIVwPWWB/AemqA=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=EVi579RhC2hkJeLOradD4Rf+KO/ve1mu9vJ0uaxeDgeMa80KY4VvuL/nRDf/pPorm1hx3zMiNdjcnKzpw0XU607nYjaAjrEq2PCpONIGPPDVCuG3JbjHllhmkM7oywgVfhUKtWz49MZFQNrsiJEke+/A395Em7Uw8JS289obIIBEwS2AxFwC2N0h1fNZkexbN+iPXpBLSAapp169oYArMIDQgqk740lCzlA+YwhFyQnWS1db/TQpgCBb1eMQ17oG2M3yYvwY4W872eRtOn6WF/UrsuU15SQvLmuF3+5sbBvLmyPtsjrLf115sQEi0lc4Kq3pacHbdliG+gzpsRpkYg==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774523754; c=relaxed/simple;\n\tbh=YXS8lHEC3Jdo2j5cSBN7EJ0ZzFqzocgiimSao+12Ztg=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=KCdl04ikEeaDev1Zo73du6fvi60XHsUeyl9liuDk5OAdXszE905RNS6yeBodQmybz7DOtpz7HawclKq3gQhSO6VnEtb+Gck/Gw/wVOWi12r7HhTiQBlFEf7zeRMagepRsRkCL+H/8ULpDQlPPa65aIb1nefO87nJntyvYf/4Aqg="
        ],
        "ARC-Authentication-Results": [
            "i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15439-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org",
            "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=none smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51"
        ],
        "From": "Zhang Yi <yi.zhang@huaweicloud.com>",
        "To": "linux-ext4@vger.kernel.org",
        "Cc": "linux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\ttytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tjack@suse.cz,\n\tojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tlibaokun@linux.alibaba.com,\n\tyi.zhang@huawei.com,\n\tyi.zhang@huaweicloud.com,\n\tyizhang089@gmail.com,\n\tyangerkun@huawei.com,\n\tyukuai@fnnas.com",
        "Subject": "[PATCH v3 03/11] ext4: factor out journalled block zeroing range",
        "Date": "Thu, 26 Mar 2026 19:10:46 +0800",
        "Message-ID": "<20260326111054.907252-4-yi.zhang@huaweicloud.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260326111054.907252-1-yi.zhang@huaweicloud.com>",
        "References": "<20260326111054.907252-1-yi.zhang@huaweicloud.com>",
        "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-CM-TRANSID": "cCh0CgD3+NhWFcVprDInCQ--.2580S7",
        "X-Coremail-Antispam": "1UD129KBjvJXoWxur18Jr4kCryrtryUJw4Utwb_yoW7JF13pr\n\ty3K3srZrW7WF9FgF4Sq3W7Xr1aka4rGrW8WFyxG3savayYqFn3KF1UK3WSvF45tr43G3W0\n\tqF4Yy34j93WDtrDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUmY14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0\n\trVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2\n\tx26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0\n\tY4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw\n\tA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS\n\t0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2\n\tIY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0\n\tY48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2\n\txKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWU\n\tJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67\n\tkF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY\n\t6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42\n\tIY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIev\n\tJa73UjIFyTuYvjfUO_MaUUUUU",
        "X-CM-SenderInfo": "d1lo6xhdqjqx5xdzvxpfor3voofrz/",
        "X-Spam-Status": "No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"
    },
    "content": "From: Zhang Yi <yi.zhang@huawei.com>\n\nRefactor __ext4_block_zero_page_range() by separating the block zeroing\noperations for ordered data mode and journal data mode into two distinct\nfunctions:\n\n  - ext4_block_do_zero_range(): handles non-journal data mode with\n    ordered data support\n  - ext4_block_journalled_zero_range(): handles journal data mode\n\nAlso extract a common helper, ext4_load_tail_bh(), to handle buffer head\nand folio retrieval, along with the associated error handling. This\nprepares for converting the partial block zero range to the iomap\ninfrastructure.\n\nSigned-off-by: Zhang Yi <yi.zhang@huawei.com>\nReviewed-by: Jan Kara <jack@suse.cz>\n---\n fs/ext4/inode.c | 98 ++++++++++++++++++++++++++++++++++---------------\n 1 file changed, 69 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex 5b601b8a4453..1d6eb3ff437e 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -4002,13 +4002,11 @@ void ext4_set_aops(struct inode *inode)\n  * ext4_punch_hole, etc) which needs to be properly zeroed out. Otherwise a\n  * racing writeback can come later and flush the stale pagecache to disk.\n  */\n-static int __ext4_block_zero_page_range(handle_t *handle,\n-\t\tstruct address_space *mapping, loff_t from, loff_t length,\n-\t\tbool *did_zero)\n+static struct buffer_head *ext4_load_tail_bh(struct inode *inode, loff_t from)\n {\n \tunsigned int offset, blocksize, pos;\n \text4_lblk_t iblock;\n-\tstruct inode *inode = mapping->host;\n+\tstruct address_space *mapping = inode->i_mapping;\n \tstruct buffer_head *bh;\n \tstruct folio *folio;\n \tint err = 0;\n@@ -4017,7 +4015,7 @@ static int __ext4_block_zero_page_range(handle_t *handle,\n \t\t\t\t    FGP_LOCK | FGP_ACCESSED | FGP_CREAT,\n \t\t\t\t    mapping_gfp_constraint(mapping, ~__GFP_FS));\n \tif (IS_ERR(folio))\n-\t\treturn PTR_ERR(folio);\n+\t\treturn ERR_CAST(folio);\n \n \tblocksize = inode->i_sb->s_blocksize;\n \n@@ -4069,33 +4067,73 @@ static int __ext4_block_zero_page_range(handle_t *handle,\n \t\t\t}\n \t\t}\n \t}\n-\tif (ext4_should_journal_data(inode)) {\n-\t\tBUFFER_TRACE(bh, \"get write access\");\n-\t\terr = ext4_journal_get_write_access(handle, inode->i_sb, bh,\n-\t\t\t\t\t\t    EXT4_JTR_NONE);\n-\t\tif (err)\n-\t\t\tgoto unlock;\n-\t}\n-\tfolio_zero_range(folio, offset, length);\n+\treturn bh;\n+\n+unlock:\n+\tfolio_unlock(folio);\n+\tfolio_put(folio);\n+\treturn err ? ERR_PTR(err) : NULL;\n+}\n+\n+static int ext4_block_do_zero_range(handle_t *handle, struct inode *inode,\n+\t\t\t\t    loff_t from, loff_t length, bool *did_zero)\n+{\n+\tstruct buffer_head *bh;\n+\tstruct folio *folio;\n+\tint err = 0;\n+\n+\tbh = ext4_load_tail_bh(inode, from);\n+\tif (IS_ERR_OR_NULL(bh))\n+\t\treturn PTR_ERR_OR_ZERO(bh);\n+\n+\tfolio = bh->b_folio;\n+\tfolio_zero_range(folio, offset_in_folio(folio, from), length);\n \tBUFFER_TRACE(bh, \"zeroed end of block\");\n \n-\tif (ext4_should_journal_data(inode)) {\n-\t\terr = ext4_dirty_journalled_data(handle, bh);\n-\t} else {\n-\t\tmark_buffer_dirty(bh);\n-\t\t/*\n-\t\t * Only the written block requires ordered data to prevent\n-\t\t * exposing stale data.\n-\t\t */\n-\t\tif (!buffer_unwritten(bh) && !buffer_delay(bh) &&\n-\t\t    ext4_should_order_data(inode))\n-\t\t\terr = ext4_jbd2_inode_add_write(handle, inode, from,\n-\t\t\t\t\tlength);\n-\t}\n+\tmark_buffer_dirty(bh);\n+\t/*\n+\t * Only the written block requires ordered data to prevent exposing\n+\t * stale data.\n+\t */\n+\tif (ext4_should_order_data(inode) &&\n+\t    !buffer_unwritten(bh) && !buffer_delay(bh))\n+\t\terr = ext4_jbd2_inode_add_write(handle, inode, from, length);\n \tif (!err && did_zero)\n \t\t*did_zero = true;\n \n-unlock:\n+\tfolio_unlock(folio);\n+\tfolio_put(folio);\n+\treturn err;\n+}\n+\n+static int ext4_block_journalled_zero_range(handle_t *handle,\n+\t\tstruct inode *inode, loff_t from, loff_t length, bool *did_zero)\n+{\n+\tstruct buffer_head *bh;\n+\tstruct folio *folio;\n+\tint err;\n+\n+\tbh = ext4_load_tail_bh(inode, from);\n+\tif (IS_ERR_OR_NULL(bh))\n+\t\treturn PTR_ERR_OR_ZERO(bh);\n+\tfolio = bh->b_folio;\n+\n+\tBUFFER_TRACE(bh, \"get write access\");\n+\terr = ext4_journal_get_write_access(handle, inode->i_sb, bh,\n+\t\t\t\t\t    EXT4_JTR_NONE);\n+\tif (err)\n+\t\tgoto out;\n+\n+\tfolio_zero_range(folio, offset_in_folio(folio, from), length);\n+\tBUFFER_TRACE(bh, \"zeroed end of block\");\n+\n+\terr = ext4_dirty_journalled_data(handle, bh);\n+\tif (err)\n+\t\tgoto out;\n+\n+\tif (did_zero)\n+\t\t*did_zero = true;\n+out:\n \tfolio_unlock(folio);\n \tfolio_put(folio);\n \treturn err;\n@@ -4126,9 +4164,11 @@ static int ext4_block_zero_page_range(handle_t *handle,\n \tif (IS_DAX(inode)) {\n \t\treturn dax_zero_range(inode, from, length, did_zero,\n \t\t\t\t      &ext4_iomap_ops);\n+\t} else if (ext4_should_journal_data(inode)) {\n+\t\treturn ext4_block_journalled_zero_range(handle, inode, from,\n+\t\t\t\t\t\t\tlength, did_zero);\n \t}\n-\treturn __ext4_block_zero_page_range(handle, mapping, from, length,\n-\t\t\t\t\t    did_zero);\n+\treturn ext4_block_do_zero_range(handle, inode, from, length, did_zero);\n }\n \n /*\n",
    "prefixes": [
        "v3",
        "03/11"
    ]
}