Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp453397lqh; Fri, 31 May 2024 06:36:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2KRfShzK3AwRdCWGFEwqTEcNmNe7TTGxr0QnfTrbP/pEGAeqoPcB2BbkWp14nV/8b4j60QbISPMqFuGd7L0m15bpi8pVG9uJe3ExqXQ== X-Google-Smtp-Source: AGHT+IGNAN32heEwnjdncBxYxfsuANL0JQSybrRRb3lZivik5Au3KN6IOezL1QtFjXs+kLtZQK2L X-Received: by 2002:a05:6808:1925:b0:3d1:d399:2cd9 with SMTP id 5614622812f47-3d1e34a20f3mr2237125b6e.7.1717162584450; Fri, 31 May 2024 06:36:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717162584; cv=pass; d=google.com; s=arc-20160816; b=NBAhHGd5PufCwmHzzKupMHYGrc2Pa/HXmeGwMeKWVj5VGJavhfNtwroEUqy3tdOJxV uYPX9QP5bqdhNRdNNyh03M0wQ3gCJIiKFfF4jM6tT/285hEe7DGKYpuJWr1Lxg9Sps3l fhK23ViDmJY+JPXWTPb49q5LGn5oN7fYoSa8VA3f1iEjWRlVhr99BZHy00fCl0KxyIgs P5zi3+qTuQFo7ThjcDXXsojhom71C6AreUFyq3xKYlGLXeFo/P1MMg9qKCcTvjZ6e7Oo BO/5QveGuQunb5N3roMjFMr3EMSRdPmuHAEVn5pjVNC7NLhRe1o8WD2b5dQL26X7+UC7 CZhg== 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=WHxUhk+JvUedQtAT8ttJV6/LW6nSiIM50H+9WqdW+Nc=; fh=sPKrtYcvfYrx0SMCKkPItgREgastrob9cURc2UNAf8I=; b=QkZVIqDp6g1MfQXBgvTy24erW+8jQAVGU0HkMe8Xieg3lSpGEQ7ES83cfkBzK+oTE9 XdEH7Z5crlAgMhFBNpzK0LIWZlmrMsLRvRwY/OZpiwmEPaPEll8xQ6vnNMjKaeTbZcZh eDym6Ox5+eogKofRrbnhRcqFjm5I1EZYVRB9xCaRR4oOOhBcq3s3X5H8OOjh297sP78S cqOHgeNC6l3EhmIvQzX6DBCEGsQXME4k5xQjexGZ/3xgcyWy1l1QGp9x21Q9fItFg8Cy AXKxvdxDYgV6cxx1P0Rce787mNAsXQnrcDMYwT/D313OYKlx1q0HyGVz90Ju47094Tgr iM4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yza6EQ+l; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-196890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196890-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b40fdfesi14045646d6.318.2024.05.31.06.36.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:36:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yza6EQ+l; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-196890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196890-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 27D721C23BD3 for ; Fri, 31 May 2024 13:36:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC1F8158DB7; Fri, 31 May 2024 13:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="yza6EQ+l" 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 F21691EB2F; Fri, 31 May 2024 13:36:12 +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=1717162574; cv=none; b=Uf9kh6s9saCS3MTqtfDjrbiNRIenpRtuP6aoA8M9/8Z4IQdYWBKeFbr5HBsPLlgvBvhPSf9dum4JBQkU5sVdUftcNNhgvF8REQnsAE8Kvc3I5SaYVigaIoaH4WtxPss9CP95F8nTfWB285fzi/7KGQuw/tn2J3dWcq71aWXJJ9g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717162574; c=relaxed/simple; bh=vQ11bK9p/errhGU+cq6SulAeneFsqE5o8JUd2PnAQdw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DKLPegt8x+1kheH9AGLFRz7Cp0wvJV6kwiYqPymRNSya9l14cEyr3qxBleMqVsjL/x9AgoJFZKNFAGvZr4uF0O+6Lw+FdTdzpVr7R77dID/mOR7gggMXIa+dCc1K+l5xHXY244K6CsIacKUw5okbkP7IVcG6SWiqRE/Acq6OZNk= 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=yza6EQ+l; 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=WHxUhk+JvUedQtAT8ttJV6/LW6nSiIM50H+9WqdW+Nc=; b=yza6EQ+lK+43+PHW4DgB5EwMDk ky5eitb+serbJk9uK/4AyEhJkS0vf7EQGFv7gdb5HqgH1yB3FWdttmEz3IT3Yz+Hf88FHX+bcfZ6Z MzHdPARO5FYuKJVRjWGH1SHUDfGHEuCWNN7yHLSA35tghg/u974kAgwSbXxMLKMwOyCjuJsgClRxa S/e6JMoGcBdvf1tYmdVPHg+NrFDDQj8VXsiI6PHtYbZHzynXCVplOKvuSNv1na32NOL9Q4pcmNIG4 LbZ8TeAp3OcaLsGyCqtL07qfnGrcORWSZB+tE8i0rrlHoH3YoYP1Ypat2tRel+Lj0huSfwmBzujGA CfIzorrQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sD2QW-0000000AMYi-2Acy; Fri, 31 May 2024 13:36:12 +0000 Date: Fri, 31 May 2024 06:36:12 -0700 From: Christoph Hellwig To: Zhang Yi Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, djwong@kernel.org, hch@infradead.org, brauner@kernel.org, david@fromorbit.com, chandanbabu@kernel.org, jack@suse.cz, willy@infradead.org, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [RFC PATCH v4 6/8] xfs: correct the truncate blocksize of realtime inode Message-ID: References: <20240529095206.2568162-1-yi.zhang@huaweicloud.com> <20240529095206.2568162-7-yi.zhang@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: <20240529095206.2568162-7-yi.zhang@huaweicloud.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Wed, May 29, 2024 at 05:52:04PM +0800, Zhang Yi wrote: > + if (xfs_inode_has_bigrtalloc(ip)) > + first_unmap_block = xfs_rtb_roundup_rtx(mp, first_unmap_block); Given that first_unmap_block is a xfs_fileoff_t and not a xfs_rtblock_t, this looks a bit confusing. I'd suggest to just open code the arithmetics in xfs_rtb_roundup_rtx. For future proofing my also use xfs_inode_alloc_unitsize() as in the hunk below instead of hard coding the rtextsize. I.e.: first_unmap_block = XFS_B_TO_FSB(mp, roundup_64(new_size, xfs_inode_alloc_unitsize(ip)));