All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: sandeen@sandeen.net, djwong@kernel.org
Cc: Brian Foster <bfoster@redhat.com>,
	Dave Chinner <dchinner@redhat.com>,
	linux-xfs@vger.kernel.org
Subject: [PATCH 09/48] xfs: fold perag loop iteration logic into helper function
Date: Wed, 19 Jan 2022 16:24:01 -0800	[thread overview]
Message-ID: <164263824189.865554.51073696809603760.stgit@magnolia> (raw)
In-Reply-To: <164263819185.865554.6000499997543946756.stgit@magnolia>

From: Brian Foster <bfoster@redhat.com>

Source kernel commit: bf2307b195135ed9c95eebb38920d8bd41843092

Fold the loop iteration logic into a helper in preparation for
further fixups. No functional change in this patch.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 libxfs/xfs_ag.h |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)


diff --git a/libxfs/xfs_ag.h b/libxfs/xfs_ag.h
index 2522f766..95570df0 100644
--- a/libxfs/xfs_ag.h
+++ b/libxfs/xfs_ag.h
@@ -126,12 +126,22 @@ void xfs_perag_put(struct xfs_perag *pag);
  * for_each_perag_from() because they terminate at sb_agcount where there are
  * no perag structures in tree beyond end_agno.
  */
+static inline struct xfs_perag *
+xfs_perag_next(
+	struct xfs_perag	*pag,
+	xfs_agnumber_t		*next_agno)
+{
+	struct xfs_mount	*mp = pag->pag_mount;
+
+	*next_agno = pag->pag_agno + 1;
+	xfs_perag_put(pag);
+	return xfs_perag_get(mp, *next_agno);
+}
+
 #define for_each_perag_range(mp, next_agno, end_agno, pag) \
 	for ((pag) = xfs_perag_get((mp), (next_agno)); \
 		(pag) != NULL && (next_agno) <= (end_agno); \
-		(next_agno) = (pag)->pag_agno + 1, \
-		xfs_perag_put(pag), \
-		(pag) = xfs_perag_get((mp), (next_agno)))
+		(pag) = xfs_perag_next((pag), &(next_agno)))
 
 #define for_each_perag_from(mp, next_agno, pag) \
 	for_each_perag_range((mp), (next_agno), (mp)->m_sb.sb_agcount, (pag))


  parent reply	other threads:[~2022-01-20  0:24 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20  0:23 [PATCHSET 00/48] xfsprogs: sync libxfs with 5.16 Darrick J. Wong
2022-01-20  0:23 ` [PATCH 01/48] xfs: formalize the process of holding onto resources across a defer roll Darrick J. Wong
2022-01-20  0:23 ` [PATCH 02/48] xfs: port the defer ops capture and continue to resource capture Darrick J. Wong
2022-01-20  0:23 ` [PATCH 03/48] xfs: fix maxlevels comparisons in the btree staging code Darrick J. Wong
2022-01-20  0:23 ` [PATCH 04/48] xfs: remove xfs_btree_cur_t typedef Darrick J. Wong
2022-01-20  0:23 ` [PATCH 05/48] xfs: check that bc_nlevels never overflows Darrick J. Wong
2022-01-20  0:23 ` [PATCH 06/48] xfs: remove the xfs_dinode_t typedef Darrick J. Wong
2022-01-20  0:23 ` [PATCH 07/48] xfs: remove the xfs_dsb_t typedef Darrick J. Wong
2022-01-20  0:23 ` [PATCH 08/48] xfs: remove the xfs_dqblk_t typedef Darrick J. Wong
2022-01-20  0:24 ` Darrick J. Wong [this message]
2022-01-20  0:24 ` [PATCH 10/48] xfs: rename the next_agno perag iteration variable Darrick J. Wong
2022-01-20  0:24 ` [PATCH 11/48] xfs: terminate perag iteration reliably on agcount Darrick J. Wong
2022-01-20  0:24 ` [PATCH 12/48] xfs: fix perag reference leak on iteration race with growfs Darrick J. Wong
2022-01-20  0:24 ` [PATCH 13/48] xfs: remove xfs_btree_cur.bc_blocklog Darrick J. Wong
2022-01-20  0:24 ` [PATCH 14/48] xfs: reduce the size of nr_ops for refcount btree cursors Darrick J. Wong
2022-01-20  0:24 ` [PATCH 15/48] xfs: prepare xfs_btree_cur for dynamic cursor heights Darrick J. Wong
2022-01-20  0:24 ` [PATCH 16/48] xfs: rearrange xfs_btree_cur fields for better packing Darrick J. Wong
2022-01-20  0:24 ` [PATCH 17/48] xfs: refactor btree cursor allocation function Darrick J. Wong
2022-01-20  0:24 ` [PATCH 18/48] xfs: encode the max btree height in the cursor Darrick J. Wong
2022-01-20  0:24 ` [PATCH 19/48] xfs: dynamically allocate cursors based on maxlevels Darrick J. Wong
2022-01-20  0:25 ` [PATCH 20/48] xfs: rename m_ag_maxlevels to m_allocbt_maxlevels Darrick J. Wong
2022-01-20  0:25 ` [PATCH 21/48] xfs: compute maximum AG btree height for critical reservation calculation Darrick J. Wong
2022-01-20  0:25 ` [PATCH 22/48] xfs: clean up xfs_btree_{calc_size,compute_maxlevels} Darrick J. Wong
2022-01-20  0:25 ` [PATCH 23/48] xfs: compute the maximum height of the rmap btree when reflink enabled Darrick J. Wong
2022-01-20  0:25 ` [PATCH 24/48] xfs_db: fix metadump level comparisons Darrick J. Wong
2022-04-28  3:02   ` Eric Sandeen
2022-01-20  0:25 ` [PATCH 25/48] xfs_db: warn about suspicious finobt trees when metadumping Darrick J. Wong
2022-01-20  0:25 ` [PATCH 26/48] xfs_db: stop using XFS_BTREE_MAXLEVELS Darrick J. Wong
2022-01-20  0:25 ` [PATCH 27/48] xfs_repair: fix AG header btree level comparisons Darrick J. Wong
2022-04-28  3:03   ` Eric Sandeen
2022-01-20  0:25 ` [PATCH 28/48] xfs_repair: warn about suspicious btree levels in AG headers Darrick J. Wong
2022-01-20  0:25 ` [PATCH 29/48] xfs_repair: stop using XFS_BTREE_MAXLEVELS Darrick J. Wong
2022-01-20  0:25 ` [PATCH 30/48] xfs: kill XFS_BTREE_MAXLEVELS Darrick J. Wong
2022-01-20  0:26 ` [PATCH 31/48] xfs: compute absolute maximum nlevels for each btree type Darrick J. Wong
2022-01-20  0:26 ` [PATCH 32/48] xfs: use separate btree cursor cache " Darrick J. Wong
2022-01-20  0:26 ` [PATCH 33/48] xfs_db: support computing btheight for all cursor types Darrick J. Wong
2022-01-20  0:26 ` [PATCH 34/48] xfs_db: report absolute maxlevels for each btree type Darrick J. Wong
2022-01-20  0:26 ` [PATCH 35/48] libxfs: remove kmem_zone_destroy Darrick J. Wong
2022-01-20  0:26 ` [PATCH 36/48] libxfs: remove kmem_zone_init Darrick J. Wong
2022-01-20  0:26 ` [PATCH 37/48] xfs: remove kmem_zone typedef Darrick J. Wong
2022-01-20  0:26 ` [PATCH 38/48] xfs: rename _zone variables to _cache Darrick J. Wong
2022-01-20  0:26 ` [PATCH 39/48] libxfs: rename all the other " Darrick J. Wong
2022-01-20  0:26 ` [PATCH 40/48] libxfs: change zone to cache for all kmem functions Darrick J. Wong
2022-01-20  0:26 ` [PATCH 41/48] xfs: compact deferred intent item structures Darrick J. Wong
2022-01-20  0:27 ` [PATCH 42/48] xfs: create slab caches for frequently-used deferred items Darrick J. Wong
2022-01-20  0:27 ` [PATCH 43/48] xfs: rename xfs_bmap_add_free to xfs_free_extent_later Darrick J. Wong
2022-01-20  0:27 ` [PATCH 44/48] xfs: reduce the size of struct xfs_extent_free_item Darrick J. Wong
2022-01-20  0:27 ` [PATCH 45/48] xfs: remove unused parameter from refcount code Darrick J. Wong
2022-01-20  0:27 ` [PATCH 46/48] xfs: use swap() to make dabtree code cleaner Darrick J. Wong
2022-01-20  0:27 ` [PATCH 47/48] xfs: Fix the free logic of state in xfs_attr_node_hasname Darrick J. Wong
2022-01-20  0:27 ` [PATCH 48/48] libxfs: remove kernel stubs from xfs_shared.h 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=164263824189.865554.51073696809603760.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=dchinner@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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.