Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1357013lqh; Mon, 6 May 2024 05:36:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWB76ipAZWhy1dtmOLjZgcWCegsolOorH4aCjc3Oi2fnGUBrjKoWvzRHC/5z8zIXYXSdts6Sc3WhZ0HB/aHNe5aON/pTNQISLF+vs4cXA== X-Google-Smtp-Source: AGHT+IHgshEMBnhRZctwt+iZ5Ssjy2i0N2Pu3Qz/+Zp8VxMeJpXmTibPr4XKxarFOEO0oc+sn2cP X-Received: by 2002:a17:90a:a108:b0:2b4:39cd:250c with SMTP id s8-20020a17090aa10800b002b439cd250cmr7603491pjp.8.1714998984176; Mon, 06 May 2024 05:36:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714998984; cv=pass; d=google.com; s=arc-20160816; b=y/sNUKFsr16LrX+poO7OmesN1y0h7hZd9hpjmdaCo4AgnOuT2s4ZY+FUYoj/3uJT3g Td8bkdJkAzTljAWjB0d0MZaYR2pY5bKtIc+5jtZTZO0D5KPLOjE9KnJTroFC0Lxxpmv+ MNsRJrR7CrJa7brt4+f0TsDEibs8xxk5H2jnLg498E7YOEqPMhOLMKQmGSsFgSpupXjy pWAzE3eg5icGizyzo5vEQo390P365zaZk31b4xqgfQvU+/mrelesvNeTuKyEmeqeoKJT at+84uC+ManJdPG4WmNRFwEJCjVPO77mrJeTwOrql90xYZK7X4cFf384lyWU47LTp/eh yLYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=HCSSyBhvnnX9PRv8G+ITgV4QAExWES1W010uAzplFzo=; fh=Osh4uBb3kdyegO/YWwQoGUhCgrrzgbnUvsz5EKu0a8s=; b=a5IoiAEokfpPlpxStFowiANxZ0WXvyHGDKq7mFEHTldmcx0WOPckhlCxVLXgQpDzc1 QO39vlSnjOMFD9sifyWV3isYOa5s6tEpC2PujS8+nQDabXbEWQFskJPTwQKCR1ImeCDV hGFyd1PgBoJrRSXAaz6e3tajjyADz757gfNZkWwV7Mv6bY917efuO3iOj+Apdy5JGTZH 3NIRLoe4nNLSTzFjCp8gogs6pCThw1QVj86G7icGuSUwt2gkoebly6gKMbLr6C37eQoU tyTES+REHWjBK7nr/rr23wEO85xxu2EWmFHAvOQVTGIeACw/7K/lXaokesN5ZUZIJHE3 0kNA==; 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-ext4+bounces-2314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2314-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 cu5-20020a17090afa8500b002a290e2a581si6387103pjb.140.2024.05.06.05.36.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 05:36:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2314-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; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2314-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 77E722883BA for ; Mon, 6 May 2024 12:33:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92E751DA58; Mon, 6 May 2024 12:33:17 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (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 980C4748F; Mon, 6 May 2024 12:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714998797; cv=none; b=GrP2ozyHrK5tt22LFqWEZk/5u7QJfgniweu8f8+ebO+ZoL50DDMuZPpXvSA2VJ3FichLBNMKKbLUU+3V3YVbWgwp+IzB3alk8RFc+mgYUyO9DiApWSQDycjZVKN7dg/qqxbtuc3NHv0rIgkWKYcgC31SmDZEELGQwNWGrwqypPQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714998797; c=relaxed/simple; bh=DEA1KM0ghvQd+HuV8xLB5tsfrrm9padoKe5B5fuFlsE=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=GR6KNQrJLoxZgefgdSmG4YcIsPXsa2v+8rsSGSoHTNnv8pPDPy/jndbPidrM5xMHVcGImZlXD5/Gp8qAsLBDw/MYOJdTPHxB4zkiEU9ZUeXjSVsighvHE6TkJK16iBveieoj157kHbpZLsO6zVQMennsQ/3hwlwHpUk1o+fBPxQ= 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.51 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.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VY15q13XZz4f3l85; Mon, 6 May 2024 20:33:03 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id 642991A058D; Mon, 6 May 2024 20:33:08 +0800 (CST) Received: from [10.174.179.80] (unknown [10.174.179.80]) by APP2 (Coremail) with SMTP id Syh0CgDH6w4CzjhmXgPPMA--.59039S3; Mon, 06 May 2024 20:33:08 +0800 (CST) Subject: Re: [RFC PATCH v4 27/34] ext4: implement zero_range iomap path To: Dave Chinner Cc: linux-ext4@vger.kernel.org, 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, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com References: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> <20240410142948.2817554-28-yi.zhang@huaweicloud.com> From: Zhang Yi Message-ID: Date: Mon, 6 May 2024 20:33:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:Syh0CgDH6w4CzjhmXgPPMA--.59039S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Zw1ktFWkGF4ktw15AF45Awb_yoW8Grykpr Z5KFy8Kr12gr97uFZ2gFZrXryFya13Gw48WrW3Jrn8Z343WryxKFyjgF1093W8X3y7A340 vF1UW34Igw15AFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvIb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1lc7I2V7IY0VAS 07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_ WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf 9x07UZ18PUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ On 2024/5/1 17:40, Dave Chinner wrote: > On Wed, Apr 10, 2024 at 10:29:41PM +0800, Zhang Yi wrote: >> 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); >> +} > > Zeroing is a buffered write operation, not a buffered read > operation. It runs though iomap_write_begin(), so needs all the > stale iomap detection stuff to be set up for correct operation. > Yeah, right, thanks for point this out. Although we can guarantee that the zeroing is a partial block overwrite and no need to allocate new blocks on ext4, use ext4_iomap_buffered_read_ops is not appropriate, I'll use write ops instead. Thanks, Yi.