Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp357105rbe; Thu, 29 Feb 2024 01:20:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWtr8th+nNqrV3w8p5wjuZoBZVvESA7Z6gQOKZUNRNtKBYb9C/fHifv5IvdnLwFTfaQuJ5KY55O+FKpgmmKVoWpmg04x2M6rswXqVuyuA== X-Google-Smtp-Source: AGHT+IEBLLgW2pgzQOrUIQQkfWQ4Zl/inBRBqSSwBDH9+hkvfmHQu9wdwgzlIFpHfYZAs7SAyZfe X-Received: by 2002:a05:6402:3548:b0:566:ac70:1eed with SMTP id f8-20020a056402354800b00566ac701eedmr456705edd.20.1709198434655; Thu, 29 Feb 2024 01:20:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709198434; cv=pass; d=google.com; s=arc-20160816; b=sLavJHxSTa7VMA2VazGYqyvkKzJ3yfpkKbpY/b08Ky4djGrwpmm+3QELg68KxSfR4g FlZ3GHDNMtIQ/QGzZNXRqEBK/61XZnp+e886qzKMKZBjWLYw5fql+DxDZk507rOVtmjJ DoOqsXSVQ2a/GhtSBK+jeJ47hhMu5CUP9j33c10KvOWl8+/Xuu2v8xwsErtTN3xIIKEL haBB3KdJTlBXY1EaPvMn7NkJFw3oHKRQkj9u3xcq3A5Uc2Pz4d4aYTQ6IkzBulwBNswn 6zZr8g4QHGlDryEx87ikdp54iMyTwQG9hjHknD6HeR39SRW5bOILzTF4TJB5pJRikz6p 44NA== 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=gIU3JiPkKQuq4oC1f1UCaft6jmhgZYYHpBl4YmO8en8=; fh=38ZyKWZSJTCSGtMR3AmFcz+f69oGQywEJOR1s+BHCpE=; b=GC5TFJrGt31LNp5iXTtKKZezRSYcJVC8JDef7oX3nocgJNGzj5tQ9wt66gJXyMSVUG 3MCmRvTp6KwEQUCrg4/mK+PdHcslSkv+cZ1ID3Ynzkc3zFdZfK4fLOp0aUpRtvuRYPyM xha3zoYg1bZxjw7o8BzJUXLvv/DkF4cJv+jo8QfbBT1++s4PUYUPN+2+fc2W9zOmUe7x frrQtq6EySoGGCuee6tz/yoowR2fw61EtvkMiBH0Msd4LeH72IOWJo9kyGbnbcWuubFl 4imcxqPfCRGZFyDggkOzzkTmIMxUTYhSoWoSmx17C02puotj1QDOOJ2vQvr+/u4h8t9e RKLw==; 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-1426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1426-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 x7-20020aa7d6c7000000b0056661146d91si411079edr.291.2024.02.29.01.20.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 01:20:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1426-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-ext4+bounces-1426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1426-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 6B3141F240CE for ; Thu, 29 Feb 2024 09:20:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B55459B63; Thu, 29 Feb 2024 09:20:12 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org 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 03DDE59167; Thu, 29 Feb 2024 09:20:08 +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=1709198412; cv=none; b=l9bI09sc8Di4ZFkKZQrcnfk3icHA90p+dMkGZq4n666FyBk7tsmkPXPXw+hl1N0bi6FXCSs0RrbU8qZwJ6I1G3u3QNxjucuhn5/hL1T6LUuDCH4QCaO6Q5nQ1kmSUBxBKcGWcD/moc0m88iW5cL3b7u/Rwtw2YcmMbvh3QPaHvM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709198412; c=relaxed/simple; bh=iGHP7pwpeOVDDFpZ0noQ898rYHBuWLE3gLeIZkVM71E=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=aiDzo7P3A4GhJGuqlczsZ/MSdeg33AebzehUaCDn0LjtGBn/5knAN/8rKWKCBEpgMO4lls6T2KU8WwlzSdKlbXkcsRsJRRF58dcgwbilD9RCsEOm5VhryTInY1eKSfrz/3AXYWm6jfek+IqH1v6v3IqNN5QSpF+srZb6A9bRWeU= 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.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Tllzz1psXz4f3jHd; Thu, 29 Feb 2024 17:19:59 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 7E5281A0F7F; Thu, 29 Feb 2024 17:20:04 +0800 (CST) Received: from [10.174.176.34] (unknown [10.174.176.34]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ5BTOBl5aoEFg--.45042S3; Thu, 29 Feb 2024 17:20:04 +0800 (CST) Subject: Re: [RFC PATCH v3 07/26] iomap: don't increase i_size if it's not a write operation To: Christoph Hellwig Cc: djwong@kernel.org, Dave Chinner , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com References: <20240127015825.1608160-1-yi.zhang@huaweicloud.com> <20240127015825.1608160-8-yi.zhang@huaweicloud.com> <9b0040ef-3d9d-6246-4bdd-82b9a8f55fa2@huaweicloud.com> From: Zhang Yi Message-ID: <9c9f1831-a772-299b-072b-1c8116c3fb35@huaweicloud.com> Date: Thu, 29 Feb 2024 17:20:01 +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:cCh0CgBHZQ5BTOBl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U X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ Hello Christoph! On 2024/2/29 6:13, Christoph Hellwig wrote: > On Wed, Feb 28, 2024 at 04:53:32PM +0800, Zhang Yi wrote: >> So, we have to handle above case for xfs. I suppose we could keep >> increasing i_size if the zeroed folio is entirely outside of i_size, >> make sure we could write back and allocate blocks for the >> zeroed & delayed extent, something like below, any suggestions ? > > Sorry for being dumb, but what was the problem solved by not updating > the size for ext4 again? (for unshare I can't see any reason to > ever update the inode size) > The problem I want to slove by not updating the size for ext4 is truncate. Now ext4 use iomap_zero_range() for the case of zero partial blocks, and ext4's truncate is different from xfs. Let's think about a simple case, we have a reg file with size 3K, then truncate it to 1K. ext4 first set i_size to 1K and then call ext4_block_truncate_page() to zero out data after 1K(EOF) through iomap_zero_range(). But now it will update i_size in iomap_write_end(), so the size of the file will increase to 4K, this is wrong. xfs first zero out data through iomap_truncate_page() and then set file size to 1K, so the file size is 3K->4K->1K. Although the result is correct, but the increasing in iomap_zero_range() is also not necessary, so so I'm just gonna delete the i_size updating in iomap_zero_range(). It's not for unhare. Thanks, Yi.