From patchwork Wed Apr 10 13:28:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 13624583 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 3A7F9CD128A for ; Wed, 10 Apr 2024 13:38:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D6B06B00AB; Wed, 10 Apr 2024 09:37:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 586B96B00AC; Wed, 10 Apr 2024 09:37:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44CFB6B00AD; Wed, 10 Apr 2024 09:37:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2ABE16B00AB for ; Wed, 10 Apr 2024 09:37:15 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E52E91606F3 for ; Wed, 10 Apr 2024 13:37:14 +0000 (UTC) X-FDA: 81993723588.22.18B9EA6 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf22.hostedemail.com (Postfix) with ESMTP id 1D61DC000D for ; Wed, 10 Apr 2024 13:37:07 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712756228; 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=Fxg8ONuzaPUVLrw6SN3ME67OVWr5E+ybVklc2DECdRTGhezEN0GpPYyZ75YOJajT+b+vIR L2VQP4Ij26Qgn51lHiMenBh8/v7EjOrLzjZkXQWpzKNgWzBmROpNDrKT3bucI4GJh/isQ1 X9wCfTArAIj3byK5T/YToOYDc6F54G8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712756228; a=rsa-sha256; cv=none; b=LNDpSkyNlxdbCweu0my20ChsHHWjeodEnDLTdaROOWq5EBX6OdOfJ6tiwZ0E8NuE5lmvqd hh0nF6Ja3YfF78OhrU7G8iPfw+beb60XN01YiKcqtfZAs2TtXNwRmdekjpa4ND7TTHKpeg KgZB46qlZWJ/wyo20hmRoV22C4Z6aqI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com; dmarc=none Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF3lW7477z4f3n6d for ; Wed, 10 Apr 2024 21:36:55 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id A1B6B1A0572 for ; Wed, 10 Apr 2024 21:37:04 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAn+RHolRZmeCl4Jg--.8806S31; Wed, 10 Apr 2024 21:37:04 +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, 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 21:28:11 +0800 Message-Id: <20240410132818.2812377-28-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410132818.2812377-1-yi.zhang@huaweicloud.com> References: <20240410132818.2812377-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAn+RHolRZmeCl4Jg--.8806S31 X-Coremail-Antispam: 1UD129KBjvJXoW7urW7CrW8XF1rKFW7Gr1rJFb_yoW8JFWDpr n5K34UCr47Wr9F9F4IgF9rXr1Iy3W5Gw48WryfGrn8Z3yfW34xKFWrK3WFvF4jg3y7Jayj qF45try8Kw17AaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6r xdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F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/j2ns4JSzbxfEzBEgxE6gyHPK9UJ/8oNKAvQwQJSSWCCgJ8Q1UDW4efOxoWONejaXRE4iqLW+ivJcYIichvD1QkXsf31cf+X4grzv6PdzKJI+5Xu6c6WQVaAWrf/wO16DLgkXtE9RwZe1Jyxegb7F62RScIuDgGYWro1gd4KS5JS4SL6i4+pHyeMDbIpK+Y4vjW0X7GF0qPSj056uuZoakmNFmpGBGZnBTXcYE9FAon6bp99K6BA4ifMkodW4Hq/Sqc+qkPs7Lc6+mjhkD0E37ymSY7H46nEN0aQTjT3zszDvxy2+GAUS1YEcDoGl1uSukdzZktW8FAyE0dB+4e8tN0+NVt7QsErUYFA29tWH9f2bd5huG4Vn9Hy2f06H4OHmb1r5uo6bUA8IF6IAo+tF1sBIp7NROMWyFd3b6pNvrIoN+onsNHLX2PzxgC5IBnnOafG4eSmKYsH8D8Li/6dsgqxhn6yWGfjes8kHwo7x5 YY5knu44 /Xg78yd/8bfMFCxT0L+nmYpiRoWVoRBa0abMRjzsbrnUvwKM4FzZuGvSnsHCXOoCL/YkTI42BklwlAQ+0/mm5BmOfiFlFsSWURo5k2VE92e0U0urfQPnZCjNF1cF/Z1CFf9g2xjPPft0uwPQjSeQk9po2lTg8NCTg789PacaeTCZlgvru1DjVqO6hhpoCkq1nLSX7N92Br7n2pXMbFr5txXgPdd8+f7gMy/Q7IHWpAcIq4TAAklgD7T103dAanijsB3ErGbDGwx7DuDqdq5925Y7tcezPlx3sHqP080OB1CE/inI= 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); }