Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp181758lqf; Fri, 26 Apr 2024 03:42:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpOvZOv700jqORYYU84PVqAr6z9BZCS9G1JQSLsxUhegYDZCQXDd5G9OpB+gTmWu8lB4y2gyn0GMD+JLPAtrbQTWQkxr0xsfvhw3fHXw== X-Google-Smtp-Source: AGHT+IH3ArQ94tUDfaU8JguUWqrft5gbnss0skLxuC6lCMmFvZZpNZPkww2oJ41UkkODYxvAhjrl X-Received: by 2002:a9d:6c8a:0:b0:6ed:8ddd:88b7 with SMTP id c10-20020a9d6c8a000000b006ed8ddd88b7mr2105128otr.29.1714128163443; Fri, 26 Apr 2024 03:42:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714128163; cv=pass; d=google.com; s=arc-20160816; b=JN5Gt4QD1eyL0WF4+7e787tx1WcmCRZkFm9r5DCsska0UTpiD1eO1BqohILOKEARio 6nCJclICEOP7SfUXeVPsJn3n8XlfOSm45+2YXsDiueZYle1h85GRz7NjiX3+FzAgdItU 1s1RxW974NAGddsUuJUuVjNVrL0q6nGHkCkuBCJSOwbb7L/hBlweBSf/JYi7iIGRiOy3 Uc2ePK0OAZBHRG5kMPugNOjLqic3+EbFLl5k5EE0LN/JY/mAYD/lz0QgKfff/p3KxTmZ aM+342jd09CzFZYgAbYOnkvDZVnaWr9CHXY+yPQ21oz3bTRSqs6VNo0YXCGseAzdbLI+ qLyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bAMm3w5OCb4CaHr+pTFnD6QYi8dnap8rwYOnceQqfgY=; fh=V3J4ftLNrmVlCkYbNFCPfkqp+V0jT40cAr5svAoWrRo=; b=aGimyQh+2HUCPDhuWnRvTGcqAYpEEN8inY1KWOY0DBXWaoYUp1Yp95OXwxYGk1859W EhQmGPJ+teKn8kj1qlzW/yqFX6p/tYyOjC/4JR9JZZNpXJZPrZ48obkvgj3lYWkZbz7c aFyPxzEmrW/ugNckKDZsqbe/mmnKp6PLmhOGgM5WUfiPoGBwVbAOaG9oQhLc7SDPAmB3 BzNVMLA6Ylyewr7sRTuYq2Xox5V0b0gGEEJbyIec04q6G8MmtfvFE3a8OAp2qNoJvmX6 WJP4FlmJVi1RA3Otya9pTMrFzlfmwAG/Ztb8CdojPptfmfOtPfIU2HoSMVPnH96oDOV+ GDgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=H8O1GNoV; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-159571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159571-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 i17-20020a63d451000000b005dbc6dc4cdasi15269662pgj.255.2024.04.26.03.42.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 03:42:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159571-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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=H8O1GNoV; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-159571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159571-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 E4202286BFF for ; Fri, 26 Apr 2024 06:33:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BE1B13A86E; Fri, 26 Apr 2024 06:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="H8O1GNoV" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 22C0478B4E; Fri, 26 Apr 2024 06:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714113185; cv=none; b=C9n85loFyIOb3QSC8ywWmARCxpc/HQkFrNd9uLq8dNg9Kp0iye9bZ6Gh5Ssr3nt9lRkH/tXhPVkLZljkknyshyZZyP9kbTYgurKlf5dlY0R3T3Eg0WompxOppdfY8ZF+85PGOHCVT0SEO/jzp+9dzh3QYFX5hIQM7djyTM3LwG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714113185; c=relaxed/simple; bh=61TPekQLyaOIOjoKBhnNUMKT5hkW0pS5woJJLrZe9Sk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sxGvnYyhJDbiVadhk8MVtpbsMnIdv0k1Hyis8X5eO5eyWMb6/tCWg4Xbd+coLsgOkNLKbX37IMEKejEXypNhHaAdVced4ARYXv7V2UBCNm/uupes7szMI6J5hS0OYlsSXAz59NOY0Mn64uR2NAnjLRHJHlv674pP2alNlVe9HMM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=H8O1GNoV; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bAMm3w5OCb4CaHr+pTFnD6QYi8dnap8rwYOnceQqfgY=; b=H8O1GNoV5d5tOu8ofQ66OvzgnB 9zlCjZj3G7pXBTVrJlH3AWeOT08OKaADMHTWQGWNkG+jWPhGP71jJOoMuwIJ92hsTZpC2SW/Mk1CR EK24rdXJWEEdfAn0BYX61Jt0jxIYi3i/T+05WLAjfHYannrIvfEWuC3+JSBINpz0NS2DuoUetd4tF rWYEwLZwvE6+5Oe5fbuzb81Q3N/0S8ZbRFFgW3Ohn4qnuBOQzCYok9Hr2WosOClzOLblSro9dUZFW SIy2vMWWdh75bDLJlbL/psJXrdsO8VU25joJDxV8ZPMzu+jKaId3zciHqRq5zsJQBTpKrqxFWfjoJ kT6Dcr+g==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0F8n-0000000BJiq-1cRt; Fri, 26 Apr 2024 06:33:01 +0000 Date: Thu, 25 Apr 2024 23:33:01 -0700 From: Christoph Hellwig To: Zhang Yi Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, hch@infradead.org, brauner@kernel.org, david@fromorbit.com, chandanbabu@kernel.org, tytso@mit.edu, jack@suse.cz, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH v5 4/9] xfs: convert delayed extents to unwritten when zeroing post eof blocks Message-ID: References: <20240425131335.878454-1-yi.zhang@huaweicloud.com> <20240425131335.878454-5-yi.zhang@huaweicloud.com> <20240425182904.GA360919@frogsfrogsfrogs> <3be86418-e629-c7e6-fd73-f59f97a73a89@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3be86418-e629-c7e6-fd73-f59f97a73a89@huaweicloud.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Fri, Apr 26, 2024 at 02:24:19PM +0800, Zhang Yi wrote: > Yeah, it looks more reasonable. But from the original scene, the > xfs_bmap_extsize_align() aligned the new extent that added to the cow fork > could overlaps the unreflinked range, IIUC, I guess that spare range is > useless exactly, is there any situation that would use it? I've just started staring at this (again) half an hour ago, and I fail to understand the (pre-existing) logic in xfs_reflink_zero_posteof. We obviously need to ensure data between i_size and the end of the block that i_size sits in is zeroed (but IIRC we already do that in write and truncate anyway). But what is the point of zeroing any speculative preallocation beyond the last block that actually contains data? Just truncating the preallocation and freeing the delalloc and unwritten blocks seems like it would be way more efficient.