public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/3] xfs: use the proper conversion helpers in xfs_rt_check_size
Date: Tue, 19 Nov 2024 08:21:42 -0800	[thread overview]
Message-ID: <20241119162142.GX9438@frogsfrogsfrogs> (raw)
In-Reply-To: <20241119154959.1302744-3-hch@lst.de>

On Tue, Nov 19, 2024 at 04:49:48PM +0100, Christoph Hellwig wrote:
> Use the proper helpers to deal with sparse rtbno encoding.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_rtalloc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index 90f4fdd47087..a991b750df81 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -1233,13 +1233,13 @@ xfs_rt_check_size(
>  	struct xfs_mount	*mp,
>  	xfs_rfsblock_t		last_block)
>  {
> -	xfs_daddr_t		daddr = XFS_FSB_TO_BB(mp, last_block);
> +	xfs_daddr_t		daddr = xfs_rtb_to_daddr(mp, last_block);
>  	struct xfs_buf		*bp;
>  	int			error;
>  
> -	if (XFS_BB_TO_FSB(mp, daddr) != last_block) {
> +	if (xfs_daddr_to_rtb(mp, daddr) != last_block) {

Er... this converts the daddr to a segmented xfs_rtblock_t type, but
last_block is a non segmented xfs_rfsblock_t type.  You can't compare
the two directly.  I think the code was correct without this patch.

--D

>  		xfs_warn(mp, "RT device size overflow: %llu != %llu",
> -			XFS_BB_TO_FSB(mp, daddr), last_block);
> +			xfs_daddr_to_rtb(mp, daddr), last_block);
>  		return -EFBIG;
>  	}
>  
> -- 
> 2.45.2
> 
> 

  reply	other threads:[~2024-11-19 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 15:49 small fixes for 6.13 Christoph Hellwig
2024-11-19 15:49 ` [PATCH 1/3] xfs: factor out a xfs_rt_check_size helper Christoph Hellwig
2024-11-19 16:15   ` Darrick J. Wong
2024-11-19 16:18     ` Christoph Hellwig
2024-11-19 15:49 ` [PATCH 2/3] xfs: use the proper conversion helpers in xfs_rt_check_size Christoph Hellwig
2024-11-19 16:21   ` Darrick J. Wong [this message]
2024-11-19 16:23     ` Christoph Hellwig
2024-11-19 15:49 ` [PATCH 3/3] xfs: don't call xfs_bmap_same_rtgroup in xfs_bmap_add_extent_hole_delay Christoph Hellwig
2024-11-19 16:21   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241119162142.GX9438@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox