Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6513081rdb; Tue, 2 Jan 2024 04:44:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IExpEbEeQhrjAHmiLfUHwFJl/yvcCimGgPfyhmf4ryD/VUBQkre9robjH+oHoZikaObezKq X-Received: by 2002:a05:6a00:2d97:b0:6d9:b09c:50ad with SMTP id fb23-20020a056a002d9700b006d9b09c50admr5357987pfb.56.1704199497502; Tue, 02 Jan 2024 04:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704199497; cv=none; d=google.com; s=arc-20160816; b=06AyO7wAIni5PF4eypN2GRcAJxb5lT6oSHJAEm8UAaZVBO0tN3QNoNz7S5MKczCaq5 fdojdV5UBpiqBKB7Bw6k/9BS7Np+GhD3a/h6X0F8zX95T8M9zq6tzZh+HajxUu5whA3r XGXjuOb8kHfsqZxvLhNo336VJj+cQmrhLESX4zQm4XMm7fya2QI8e4avYjNlN1z6FATC EMViymluI8IO2cyjmdvWxmd0+frLvnhMm/IrQRGS1qY78YhqA9HxqvFIbyW0n7w3tfYg sKgMF9GaCKiAVoujnj2p0WFYOYslVwreP9xfxB4W75De3/u+BmEA/oF62tpEwdGbCExO 84NA== ARC-Message-Signature: i=1; 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=Cr4LjRnyAWF3kNb24ZdImvW7emwiJWYJcb3UUs2VdIg=; fh=yWWoL3IRufgA/+2kSpO6uyfw9eN3ZOO7zvul0qbDPkA=; b=OR2DlcBPFKDapU1gSFw1pqPQso8tWXq4sSa7b4WjhuWFYjyxWkZZekq+JpXH/ASdq6 Jrpv+xxD50/ZL2KMnqP+sqRJmrLmT4RUoiRMksS88TqccnVbrd7+Ey3Hf2UebPx+vDNo jtHotpmaVMJwN233ACcaghE9c8bOGLffCkIN2AYwE+elxAAgeZGpdYbki9nzPzHkbRBw Sc3nqzVvZzwvlUVO9nwBZ/pj9Rws9ldX2FIzgDPUMBxp71EMfxJ4b5KQLWGU3Ma5COBG /wNDTWWmOWEXgw+PxGFcQJHGBB0ln7C8jTdrwGkIfDx910YrXQ+NsvswQzlhXt0/NnVB mPGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-615-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id v62-20020a632f41000000b005cdb0648eb8si20046932pgv.508.2024.01.02.04.44.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 04:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-615-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 67ADF282D8B for ; Tue, 2 Jan 2024 12:44:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39C82156E3; Tue, 2 Jan 2024 12:42:21 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org 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 B249F1549F; Tue, 2 Jan 2024 12:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4T4CD54qrwz4f3jYQ; Tue, 2 Jan 2024 20:42:13 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 31F321A6C6B; Tue, 2 Jan 2024 20:42:16 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBnwUGUBJRl+EvDFQ--.31823S24; Tue, 02 Jan 2024 20:42:15 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@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, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com Subject: [RFC PATCH v2 20/25] ext4: implement zero_range iomap path Date: Tue, 2 Jan 2024 20:39:13 +0800 Message-Id: <20240102123918.799062-21-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240102123918.799062-1-yi.zhang@huaweicloud.com> References: <20240102123918.799062-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:gCh0CgBnwUGUBJRl+EvDFQ--.31823S24 X-Coremail-Antispam: 1UD129KBjvJXoWxJr1ruF4Utw45Kr4DXr4rGrg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: 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 ec390bb59b6b..1ca2c995a889 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4061,6 +4061,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 @@ -4086,6 +4093,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