Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp45181rdb; Fri, 26 Jan 2024 18:10:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIG8tjEAtcqSINVQQF9C5mBJDh3YscJ1KAlVo8oqdrStZPOaj/8HG1j7MlV0u1ftld1jka X-Received: by 2002:a17:906:4698:b0:a30:64ce:64d7 with SMTP id a24-20020a170906469800b00a3064ce64d7mr351925ejr.57.1706321440231; Fri, 26 Jan 2024 18:10:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706321440; cv=pass; d=google.com; s=arc-20160816; b=joUPASnazCkIPhG2zKroGuHu780DuImsq7S0z7VXrjpd2ofYgkqt3/709uKoPCg21J 3TZWInG3Wl5qEinlwvr3jfe8KrMpDTUuYJBD7I8M4tFf+KKER8V8T1yE9iVF+3CLPFSD 1SCMccD+Y2F8WsIN0VkrP6PrmdLyiq+3H2tTS6mWp0u0wZB752UWIfA3yZFVGlPxVQ5N eWQnNYKTzEHkQlr//n+sc9jo4IhNFZZn1VHYyOhGBnZB8DcgZSyxVgcUTw/wqQxgZHEo 4smqaMgY77bpmrYUFYPrjuoFPsPE12BiNI+mpNvk/2juipSP2VNAE2M+6eNwbzh5vaWz CVgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=9Mb/RznkrCjHh4Mh0dc5h2XBBULEP8om7It5ehGzqdY=; fh=UhGiR19HeAIu8tzXykjZgtAKLLMPZj8YX6gPScUOsdE=; b=Axybq5CJU6e13Kx7eu490veA4E4F+oJLc13E19KpQb2y2U5eHsYJJDNSJNgASq0NwF oYhjZVLM64Ueez0N9H/jAwchWIAVaWe+tEvav9R6CEjiDt+rH/RwdU68JPyTJrPJ+r/5 ITyCAfz0DHfsp9I3R0bAnWNtH1OYHjgepRyfvcoSxKDB4vplSIHFKZ8oQKH5SE4w7kUR rdNQni4NnfVP29FWXkcJ7aI3V6fEYnlJ2ogORBGe0iwPepjt8G26pXxF+ZkOKQ56aazL KuZle4IXs5eZ+FQTERXpzs1PlMIGrq/Lc80kS54gpLtp5hLTLR/s9rd7tKAFWS2/U1Dp 5/9w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-41000-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41000-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y9-20020a1709060a8900b00a351dcecd64si544058ejf.681.2024.01.26.18.10.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 18:10:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41000-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-41000-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41000-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F40811F21D7B for ; Sat, 27 Jan 2024 02:10:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BDE82E3FE; Sat, 27 Jan 2024 02:02:58 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C0F72BD0A; Sat, 27 Jan 2024 02:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706320977; cv=none; b=o6NokEMAXKTnBFKSJfYdBs6roUpNAPRH4AJtS72P5Xbzenre5iJIdZ27J0U0oiP4ovcoVDFHTPs6UDus/g9Z2I5KbmatTmiW6ySlpwD402hSg7a/odFL2c0JRTJNbH4GqSISxJFtizMOLMWRc5FjGtDz7vBegBStyfDDriSLadM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706320977; c=relaxed/simple; bh=Eq8Q4muzR+uTcBa/wR7hp71yS6iYQa2ZTMhvUZUGh/o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RfHKSpqsLag1Xw6KesyJX883n2XG/7Hjh4fu49DJ8Eif1OKHoIrxaTHhEfNpK6j9/3Pp4BSOZx1ySK06jxQZtBSIt3qPUodTtFsklRQCqTsgnXj1U7GFDDco9Mj0y+mQaIoInNd0uwOTO6KZPK5S1wzTlPI3SyVFCNKrapyn2qY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TMHrn29rnz4f3lwf; Sat, 27 Jan 2024 10:02:49 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 4B7A01A016E; Sat, 27 Jan 2024 10:02:53 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX5g40ZLRlGJtmCA--.7377S25; Sat, 27 Jan 2024 10:02:53 +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 v3 21/26] ext4: implement zero_range iomap path Date: Sat, 27 Jan 2024 09:58:20 +0800 Message-Id: <20240127015825.1608160-22-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240127015825.1608160-1-yi.zhang@huaweicloud.com> References: <20240127015825.1608160-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAX5g40ZLRlGJtmCA--.7377S25 X-Coremail-Antispam: 1UD129KBjvJXoWxJr1ruF4Utw45Kr4DXr4rGrg_yoW8Jw4rpr n5KryUGr47Wr9F9F4xtF9rXr1Iy3W3Gr48Wry3Gr98Z343W3yxKFW5K3WFvF1jg3y7J3y0 qF45try0gw17Aa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUP214x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6r xdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26ryj6F1UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVW8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JV WxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7VUbCe HDUUUUU== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi Implement zero_range iomap path, add ext4_iomap_zero_range() to zero out the already mapped blocks, everything have been done in iomap_zero_range(), so invoke 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 dee661e64a69..f8e9f566ef6a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4126,6 +4126,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 @@ -4151,6 +4158,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); } -- 2.39.2