All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: zhangshida2026@163.com
Cc: Carlos Maiolino <cem@kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shida Zhang <zhangshida@kylinos.cn>
Subject: Re: [PATCH v3 2/2] xfs: optimize getfsmap by reusing and advancing the refcount cursor
Date: Tue, 1 Dec 2026 00:31:24 -0800	[thread overview]
Message-ID: <aw6F3HAc8VNri_ZZ@infradead.org> (raw)
In-Reply-To: <20261201074947.3338021-3-zhangshida2026@163.com>

On Tue, Dec 01, 2026 at 03:49:47PM +0800, zhangshida2026@163.com wrote:
> 
> +	bool			rc_done;	/* no more shared records to find */

overly long line.  Just stip the "to find".

>  static void
>  xfs_getfsmap_del_cursors(
> -	struct xfs_btree_cur	*bt_cur,
> -	int			error)
> +	struct xfs_getfsmap_info	*info,
> +	struct xfs_btree_cur		*bt_cur,
> +	int				error)

As pointed out last time, please just put the final alignment in place
in the previous patch instead of the churn here.

> +	/* Advance to the first record that ends after agbno. */
> +	while (rc->rc_startblock + rc->rc_blockcount <= agbno) {
> +		error = xfs_btree_increment(info->refcount_cur, 0, &have);
> +		if (error)
> +			goto out_error;
> +		if (!have) {
> +			info->rc_done = true;
> +			return 0;
> +		}
> +		error = xfs_refcount_get_rec(info->refcount_cur, &info->rc_cur, &i);

Overly long line.

> +		if (error)
> +			goto out_error;
> +		if (XFS_IS_CORRUPT(mp, i != 1)) {
> +			xfs_btree_mark_sick(info->refcount_cur);
> +			error = -EFSCORRUPTED;
> +			goto out_error;
> +		}
> +	}
>  
> -	*stat = flen > 0;
> +	/* Shared iff this SHARED record overlaps the query range. */
> +	if (rc->rc_domain == XFS_REFC_DOMAIN_SHARED &&
> +	    rc->rc_startblock < agbno + XFS_BB_TO_FSBT(mp, frec->len_daddr))

As point out by Sashiko last round, the iteration above should just
break out once the record isn't in the shared domain, saving potentially
pointless iteration‥


      reply	other threads:[~2026-12-01  8:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:49 [PATCH v3 0/2] xfs: optimize getfsmap by reusing and advancing the refcount cursor zhangshida2026
2026-12-01  7:49 ` [PATCH v3 1/2] xfs: factor out a xfs_getfsmap_del_cursors helper zhangshida2026
2026-12-01  7:49 ` [PATCH v3 2/2] xfs: optimize getfsmap by reusing and advancing the refcount cursor zhangshida2026
2026-12-01  8:31   ` Christoph Hellwig [this message]

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=aw6F3HAc8VNri_ZZ@infradead.org \
    --to=hch@infradead.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zhangshida2026@163.com \
    --cc=zhangshida@kylinos.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.