From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 660EFC48BF6 for ; Thu, 29 Feb 2024 09:20:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC3966B00C1; Thu, 29 Feb 2024 04:20:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A72E36B00C2; Thu, 29 Feb 2024 04:20:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93ADB6B00C3; Thu, 29 Feb 2024 04:20:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 848246B00C1 for ; Thu, 29 Feb 2024 04:20:14 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 512D1140239 for ; Thu, 29 Feb 2024 09:20:14 +0000 (UTC) X-FDA: 81844295148.15.D30EECE Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by imf05.hostedemail.com (Postfix) with ESMTP id 47EB3100016 for ; Thu, 29 Feb 2024 09:20:09 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709198412; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gIU3JiPkKQuq4oC1f1UCaft6jmhgZYYHpBl4YmO8en8=; b=jCZ6nYUVB4Y0vGy6KWODWrKOvau7asDpaI0qT2uImQzu4umn1T6x/wGGMp9w/gYmyJa0n5 KF1cl6sl/zDs14qjRG9fNdxazdZPuBl0hjuo4VwXUCIEiYa7IlBnmHSIfoM/2sWYcvE4jD ZT+ixCJI2P/PwaaktE5I+gUB8XuCtmY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709198412; a=rsa-sha256; cv=none; b=Ne4FIuYtNaF0JU4hQJWz6PGuWfYcwo7jW15zfiZMXEk0Kh+7o2pHE6po9DUp7o5W5C/h7p tasGJC/OSH0L/oX9In3C2HbmDpgplydsPsqXRh9tq6cbEVgxf/uD8SsXHWkYm/9kNxFVyW COHF5hYy8zf0El5V49I1ZcsPXuLXRPU= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Tllzz1HPsz4f3jdV for ; 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 6EB541A0172 for ; 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 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:cCh0CgBHZQ5BTOBl5aoEFg--.45042S3 X-Coremail-Antispam: 1UD129KBjvJXoW7ZF1UWFy7tF1xCryxKw15urg_yoW8GF1Dpr WF9FykKr1qg3y5ur1kuay7Jw10kw1fZrW8Aryjgw45Gan3XFyxZryjgay09FWqgrZ7Zw1Y qF4UWaySyry0vaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvab4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG 6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV Cjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7Mxk0xIA0c2IE e2xFo4CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxV Aqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a 6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6x kF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjxUFDGOUUUUU X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspamd-Queue-Id: 47EB3100016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: chfabs6x1spb9717myq3n7ssq57o6pbh X-HE-Tag: 1709198409-450574 X-HE-Meta: U2FsdGVkX19GIsBmyC8LwmB/Vx8Akz7kYPQef5VIMSDd1hzmMkxMQ0fokOeZAJrXFo5crqcYbdW5mKqnktkTsCCq0YrN41RQDRXo+MD/DBOkD5mF0I/jEb9FCtUtULbsiZ99k8OgwrDltuug2Xrsw8/FNBJ+ww1StqRdOAEWGPSQD160AiacHjKeuiwLU07aM2QnMCdpazTul1sGoMj8rjkzinLD+FUXhziVcxyCvB8Arey2oTWc3/Il+XzGIrMjljj0j/OR1skrpSeT7NUPAQLegs9Qy7B54j9FN42yhR9kp3K2OLLA63dmsyYysGcLVXT39ntYm8S2BDBCKHO57oBbLIGV+yXXqCr7BiM7PANA0q0jDI7hcNAz8bTOFwm/n56iwnSiW0XWOP0MvkMH+cQthk2XBNShBqxz5oE3jwpb8Sov1ZLZDvDlq0K+c8BgUaa4DkhggbY7wGwmEvl8c27kECufxidb/xCiStAe0wBHy6ABMquBZh1e3EStlI0KC+gbjC0R6t2MweMzQK47cR1XuJijSAhZheWYwCs1ZrgKu3+Yj3tkcki+42BtjQ3A2v5Vch71IP1WbBW6JNgagOYKnO3tQAZuvGBdTjTNZaUxQx7otGDFSMkshy4igddt+lDEtdRItbL5I/jBJC4f+3oqCPQV6FlLITHA8vzX8ozAyOe0O/XNxGQ7gkepzQqWYiu4A7jJS+aeotk6AUnFOI3D9zL8eLiODrrHgkaTpVHJDvNViTbRKLUeHIIFLg8bJKs/w5DwqYm3/eSNoK4PVmyBMHrhm294vjFbnUT3qU55BfQWCjEKXojhxbVOl5rOQqFx/DZnupWc2s8N9md9qdCvy4axj2FcoiKK1UWbarQtmJxgbbjRcK2bVXfLVPponTFgOcToE9q6Z/WdXJOITCqSYsSCMUCWxEz+30O8o4iTK6tCQqTgtqwdfp5HKssg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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.