From patchwork Wed Apr 10 14:29:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 13624719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8DC6CD1299 for ; Wed, 10 Apr 2024 14:39:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33A136B00AE; Wed, 10 Apr 2024 10:38:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C5E76B00AF; Wed, 10 Apr 2024 10:38:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13CD66B00B0; Wed, 10 Apr 2024 10:38:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E9D006B00AE for ; Wed, 10 Apr 2024 10:38:48 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BBF8EC05EF for ; Wed, 10 Apr 2024 14:38:48 +0000 (UTC) X-FDA: 81993878736.21.6BFC016 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf05.hostedemail.com (Postfix) with ESMTP id 96FED100005 for ; Wed, 10 Apr 2024 14:38:46 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712759927; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6CZLF2scSej3kVTtlU6Wdwgq92cG9Myex7yJb2oFIwQ=; b=0qL6Na/s91BI4JfMO8nSQJxVw2jPA90YzEUkIVVkSqFsB1pSWfd5AQF75bO33rxwDlcOSW pIbZBiVmmyUAf5Png4nJk+tAGSXWRsXgD/Gqe0qALF0JEfvhL/Ujrok2eSKT+NDtt8Sr7E Ba1Uv13Lk3E28XuoZ4VNUH4IdmjrwA4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712759927; a=rsa-sha256; cv=none; b=0rKq23Y0wlCB/AhlNPPV9UsLtuZPj0rj9k06IV92Lez2KXI0/oindkImLxxwLkXtjWIVZK aIJoZVvcJnv5pS1CmHVkhojNOIn9GlYF32Q0PUeH7n4/8n0iK6QifnveJUX/kHPyv/vcFk af979/F44/85iW2Bn6CIVDAofbdZcks= Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF56f3rPcz4f3lgJ for ; Wed, 10 Apr 2024 22:38:34 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 352D11A0E0D for ; Wed, 10 Apr 2024 22:38:43 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFSpBZmcwR8Jg--.63000S31; Wed, 10 Apr 2024 22:38:42 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, hch@infradead.org, djwong@kernel.org, david@fromorbit.com, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com Subject: [RFC PATCH v4 27/34] ext4: implement zero_range iomap path Date: Wed, 10 Apr 2024 22:29:41 +0800 Message-Id: <20240410142948.2817554-28-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> References: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAX6RFSpBZmcwR8Jg--.63000S31 X-Coremail-Antispam: 1UD129KBjvJXoW7urW7CrW8XF1rKFW7Gr1rJFb_yoW8JFWDpr n5K34UCr47Wr9F9F4IgF9rXr1Iy3W5Gw48WryfGrn8Z3yfW34xKFWrK3WFvF4jg3y7Jayj qF45try8Kw17AaDanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUH214x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6r xdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4 xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCa FVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI4 02YVCY1x02628vn2kIc2xKxwCY1x0262kKe7AKxVW8ZVWrXwCF04k20xvY0x0EwIxGrwCF x2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km07C267AKxVWUXVWUAwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWDJVCq3wCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr 1j6rxdMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8Jr0_Cr1U MIIF0xvEx4A2jsIEc7CjxVAFwI0_GcCE3sUvcSsGvfC2KfnxnUUI43ZEXa7sRibyCPUUUU U== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 96FED100005 X-Stat-Signature: xeq8jpg6c855bcwekujxernuja94fjgw X-HE-Tag: 1712759926-521411 X-HE-Meta: U2FsdGVkX1+fqAKSzgbH2A92T2d1RYdE2QdtI4arlkQI++yA5c4fI+K6Uo9PzWrfo5yGSX3eSSPSV5OrtyN5oILBMzv1xlZJ06ax0hAOV2wsYz3wDmPwTgKSfaOVmT5kcEMnMB+u2CuQyHA397gdU7omeftgySlcqyZnKZqHeSYgJmawnVWAB2y56YTDH8oKCWENEO763fW/CmD8biefUP6kLv5ZPxeG3PAPGgXhtu59KTHVvfuku0NCaVcxA18YhhhYi8k8QOIxK0xM5qPXLpLiSbjJ93bzTZT8May5i88BHcy68k1OG6DT9L6OlRcejpE5beE1MUtV4d3J4ga/DEQv7mP9NSM2+My3j+mIgguT/tgEhv0hn2BlCztC1HDsvuFdJVyCC6BJNDwnGcJ99GSMtZbzhB2ixoAGLOhDmcx107NG7X5B1I4Ju/oo/S42UEblyT24oDYYc7N7Vrif3GoHEpbZ/8tOrFERtxLY5ESO3SU9aCMOTPye+RwTP970tW0Z7K141T8UuJSeSQdN784+yseHbTuqZp/35VOG1ymQBXd9BOmVNjZlVu54pqAWywww591AnmF7yujOXz3ruy8DZoFa7jjZPddpdyVkhBi3B3t7E+plyfMPBSJblJaTWkduD64SFW3uf3Reov/cnW3QxNVzNypNlN9LHnCs8cNlccA5ljJub3aKZ3K5Bb4v39Hw0oftzaa2KQvB2NAySTQ0jWwEkn+UGGbKwShm3AMx+WKwf4UV+oU0q8sGA+cva0xSrCNqfgqdq4w36jTh72MEf3N7tzWq+gCCeXuF2mJKzC+HrK7nPcoBl4Gt4ux1K2amuCoGWgB9VUocRiId/Qv2jhT9pyFs5B4MV4MTt6WxyahyC83ZNABduxw73VyPrDYyGeqSQpMYuKtwzXrdaming6fZOMU4j77It7yKD7gSJvj+1c3S+wrbp7Qs59DsrP/HoYYZcFg0nUEWSA/ k+27kGcI EF+LZJo8b4LkFKP5ye0WDu1IU7GABVS89AEE9DWlUg/H+pObye1aEFRcPWDRfXJacXlM3XHNUuJQXI85R8xwbVuxckpIZwXjNFL3wY3SDQDd2uAYcALSTxswka8EQumGsour4Ohu+llDoa1/GwMCehoHGJQ7NkZFJG6j4gaauDKBCoxZxvPImXT0TDrG0DLiiP7n7HNwnykVnlSZcs10HqjmEvtLyqdA+cLaSrltTpnciBBv2tXkJbLIDRyaxli/46OLX X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Zhang Yi Add ext4_iomap_zero_range() for the zero_range iomap path, it zero out the mapped blocks, all work have been done in iomap_zero_range(), so call it directly. Signed-off-by: Zhang Yi --- fs/ext4/inode.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9d694c780007..5af3b8acf1b9 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4144,6 +4144,13 @@ static int __ext4_block_zero_page_range(handle_t *handle, return err; } +static int ext4_iomap_zero_range(struct inode *inode, + loff_t from, loff_t length) +{ + return iomap_zero_range(inode, from, length, NULL, + &ext4_iomap_buffered_read_ops); +} + /* * ext4_block_zero_page_range() zeros out a mapping of length 'length' * starting from file offset 'from'. The range to be zero'd must @@ -4169,6 +4176,8 @@ static int ext4_block_zero_page_range(handle_t *handle, if (IS_DAX(inode)) { return dax_zero_range(inode, from, length, NULL, &ext4_iomap_ops); + } else if (ext4_test_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP)) { + return ext4_iomap_zero_range(inode, from, length); } return __ext4_block_zero_page_range(handle, mapping, from, length); }