Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp310923rdh; Thu, 23 Nov 2023 04:53:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/rIhbwi3H8oU+YHzooiTDkiVTBCCef2zlwkd7jNqRc7AWTkof2sBm0IiSdX2Puyvp4KYt X-Received: by 2002:a17:902:e752:b0:1cf:6aae:5998 with SMTP id p18-20020a170902e75200b001cf6aae5998mr6205739plf.0.1700743991872; Thu, 23 Nov 2023 04:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700743991; cv=none; d=google.com; s=arc-20160816; b=Fsl8i3o5jrUe1+bsIcuDhDTuK25sQgbcIl0AkKin9lI2kwlmSLKOzHo+Olpc8q3UN0 8od4behlh1fjejBxAjhtxtMYwdy5CkUw1DAFAudxcaQojLnP/OW5cbXMGhyEt4inkPCd 3hqoy97p3firtBzhf3o8Vuma6IcYn1OZehLNKFpq94m4wKWKQ20IWnd2uPspkDicXDMC sKWBoABVw0YOMq5BMfDquUGHq8W8+jKiDwGwN3cPnKYMQ4O3I5C3cxyixIWZJSj0YdB9 9Diz+1TD/nzJD6976aAjlT6KrNKVHnpxJ8Og5cPipeluBMavLt845Wo3c7Ge0xxR6M40 qAmQ== 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=Y72iP+FGCCy/MLwe+8gufYqHstQGjrRv1vupD2cE4Os=; fh=oXgJbFeK1mY0T4jBbK/Fs3Mi9F4SdMRqpoziDljuAF4=; b=JRZrtB0tr0iM5h+X6w9MgnDNpw6zMoyXXxsuLcqCVnUAfC8mYlk+DTCvrJQzzgxt4P GA+iAMZdZXfG/91gwXSierxhjK4DnCQ/TE0lt1Qm/cM5I7jJf84gTtV23VcDjrBA8snX 4WpQTH+YhZJMwJU0j55jOGbI0YPqvvsxBZixDjefpAdKJu8TZvvJvA4Vruh55VzGSN/k oPa7pGiPif64OB3Sq7kC0uejX1i6OU+dTkD6MbJPaioUtOqH81CheAooCQdJTCxIraCl MtgFWiDTSpnaiYFMHCt6zEIvwHze8qYtCe2B4l1wFNkbtz2vI0Bbwqq8mbqE5etAcBd6 z3Og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-114-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-114-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y3-20020a17090322c300b001cf5cf1ca6asi1114291plg.511.2023.11.23.04.53.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 04:53:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-114-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-114-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-114-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 053D3281EA5 for ; Thu, 23 Nov 2023 12:53:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EF9C24A04; Thu, 23 Nov 2023 12:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 392ACD54; Thu, 23 Nov 2023 04:52:08 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4SbdKv5x6xz4f3kp1; Thu, 23 Nov 2023 20:52:03 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 838021A055F; Thu, 23 Nov 2023 20:52:05 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgDn6xHdSl9lSfnfBg--.20473S18; Thu, 23 Nov 2023 20:52:05 +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, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [RFC PATCH 14/18] ext4: impliment zero_range iomap path Date: Thu, 23 Nov 2023 20:51:16 +0800 Message-Id: <20231123125121.4064694-15-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123125121.4064694-1-yi.zhang@huaweicloud.com> References: <20231123125121.4064694-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:cCh0CgDn6xHdSl9lSfnfBg--.20473S18 X-Coremail-Antispam: 1UD129KBjvJXoWrtry3tF4xJFWfur17Zr13urg_yoW8JF1xpr n5Gry8ur47Wr9a9F4xtF9rZrySy3W3Wr48WryfGrn8Z3y3WayxKFWrK3ZY93WYg3y7A3yj qF45trWIgw17Aa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr 0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUQ SdkUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi Impliment zero_range iomap path, direct use iomap_zero_range() and add a branch in ext4_block_zero_page_range(). 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 f72864b9a6b3..ca66afd61fb3 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4218,6 +4218,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_write_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 @@ -4243,6 +4250,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