Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp189880lqj; Wed, 10 Apr 2024 07:50:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjqH/H3GjCaStPeqCJSaJi83J/9EbDuA8Lik3QbW/9n1U8toXAx9AdAkP04b/gietJNq5pVv6fdISsBFzISKQmTMcOdcMtOp7zNXzXWQ== X-Google-Smtp-Source: AGHT+IGQNybLZPAht61fPFnidxJwUbUzrm921CAdp8JnPirOX+qJra7kLfV377lSPU+MAIgKhTZe X-Received: by 2002:a17:902:c94f:b0:1e5:10e5:b673 with SMTP id i15-20020a170902c94f00b001e510e5b673mr1088893pla.37.1712760613116; Wed, 10 Apr 2024 07:50:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712760613; cv=pass; d=google.com; s=arc-20160816; b=KynvX/eIAsIjbs2l9sj/zRby1Z3+BTR26kA4UgXNgOO3t9xHr31Ii8jBL6Gw2NeAum cYMu63eZo6LNaSXNLHTS/CkKqAd/UscdAKGNeLvrSq13fogSNcTrqvmIh+a7M7SVmbum vWPInuayvOIiJVKhykdTbKPglXMOG24hZYJucyLAO2LPzC5ke9cWnvMBxBQuFji7A7wE 3klPnkLuICpqspDIg3HJzgpGi5Aw0P0COwPzF83FeC2+Cl9zmaRv+Fub92ZL7LjwXwf/ sgRQ2FG3n51VuoVRzXByQQ0RoOUgSZJhptiK3MZ8IrykGT2pUXbP2ZFsOP9UjqwpFLI5 ShCQ== 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=6CZLF2scSej3kVTtlU6Wdwgq92cG9Myex7yJb2oFIwQ=; fh=VCdyVZCUh9R8dltaA9/RWs/hxQzWhc63WX0fta2PQtE=; b=avO91Ux1YEyKH3Qm+bvalY4RFYmsyPw5To2w7yZkW/TdQ+kNI8CjcNG3fPgnv5aVVJ g9LwqUVTYh8r6HZrmBZfho6b/VV3iHZIE/oBhz0z/313Fk2m3t4nLogixw1CH3T9EgpT Z+tW+ahBtR/+UW4NhgogfeOfOX+o6MXm4VNR2v/WPjmdtOy9Uc0ksBzyPxCkVsZJEebl Vh7R2rxPzoxF2vpdF17bACphXefaoT73cfpoJoAv8mD2KB6wWI87bdV9jAKGiHNcD0XK q9Qksq+5vqfXp98jIzlUuCI1xK8xF+TWp1S9gbKsgzBzjPsbHZnvBlnFnx7PS3+5w2Xw KzcA==; dara=google.com 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-138795-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138795-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 mc4-20020a1709032b0400b001e49c7490e4si3719380plb.40.2024.04.10.07.50.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:50:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138795-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; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-138795-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138795-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 4FF9B28AD76 for ; Wed, 10 Apr 2024 14:49:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 844A51836E8; Wed, 10 Apr 2024 14:38:49 +0000 (UTC) Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [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 7AC8D16E865; Wed, 10 Apr 2024 14:38:46 +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=1712759928; cv=none; b=kSyDLCFNU/3Hjl3IZFrwKUQhlUO0PyhIp9kLzy7wgrtdESD0pEjzfuaRTWT2UcrRtPrOwZgXnP+alAtF3R+T1ZBxqoU1xoqv9i1tZHvSJNLKJ1JuyhTs7+XY0yeZcRD1OQdov+nKFqZ807/RtiHmIlePsdG3nmdHVdPXM1YKDXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712759928; c=relaxed/simple; bh=a0yXsZEWte2+yhfLSEWGmnTc+medZk5RJjxW91j+Nrw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rP+cFwFsuAySm6l85RR+VdlyUoh3B4gWSZe3NAyhGUc4YPbzfUIw503OgxK4Ih0VXSKfVPVmnNPMo+/BfVPR1pQ15abTG9OsY67PXE3Q7cWDAMh4UHzrl+26XxGFHjapkq0l0H9MuGnwszXEBW3GJ1PNmXLCx8sRRLk1pyPMMrs= 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 4VF56h30y5z4f3knS; Wed, 10 Apr 2024 22:38:36 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 419FF1A0179; 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> 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:cCh0CgAX6RFSpBZmcwR8Jg--.63000S31 X-Coremail-Antispam: 1UD129KBjvJXoW7urW7CrW8XF1rKFW7Gr1rJFb_yoW8JFWDpr n5K34UCr47Wr9F9F4IgF9rXr1Iy3W5Gw48WryfGrn8Z3yfW34xKFWrK3WFvF4jg3y7Jayj qF45try8Kw17A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ang 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); } -- 2.39.2