]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: pass the fsbno to xfs_perag_intent_get
authorChristoph Hellwig <hch@lst.de>
Tue, 2 Jul 2024 18:22:51 +0000 (11:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 2 Jul 2024 18:37:01 +0000 (11:37 -0700)
All callers of xfs_perag_intent_get have a fsbno and need boilerplate
code to turn that into an agno.  Just pass the fsbno to
xfs_perag_intent_get and look up the agno there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_drain.c
fs/xfs/xfs_drain.h
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c

index a19d62e78aa1e6a50881bf0a3793b7cc02555ea3..e224b49b7cff6d6274c9c4611f6d4166185bc831 100644 (file)
@@ -324,13 +324,9 @@ xfs_bmap_update_get_group(
        struct xfs_mount        *mp,
        struct xfs_bmap_intent  *bi)
 {
-       xfs_agnumber_t          agno;
-
        if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork))
                return;
 
-       agno = XFS_FSB_TO_AGNO(mp, bi->bi_bmap.br_startblock);
-
        /*
         * Bump the intent count on behalf of the deferred rmap and refcount
         * intent items that that we can queue when we finish this bmap work.
@@ -338,7 +334,7 @@ xfs_bmap_update_get_group(
         * intent drops the intent count, ensuring that the intent count
         * remains nonzero across the transaction roll.
         */
-       bi->bi_pag = xfs_perag_intent_get(mp, agno);
+       bi->bi_pag = xfs_perag_intent_get(mp, bi->bi_bmap.br_startblock);
 }
 
 /* Add this deferred BUI to the transaction. */
index 005a66be44a259e6d2b8e6a2898d45beeeb4b705..7bdb9688c0f5e3729ed4ea1744dbfeec22b6ae46 100644 (file)
@@ -94,17 +94,17 @@ static inline int xfs_defer_drain_wait(struct xfs_defer_drain *dr)
 }
 
 /*
- * Get a passive reference to an AG and declare an intent to update its
- * metadata.
+ * Get a passive reference to the AG that contains a fsbno and declare an intent
+ * to update its metadata.
  */
 struct xfs_perag *
 xfs_perag_intent_get(
        struct xfs_mount        *mp,
-       xfs_agnumber_t          agno)
+       xfs_fsblock_t           fsbno)
 {
        struct xfs_perag        *pag;
 
-       pag = xfs_perag_get(mp, agno);
+       pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, fsbno));
        if (!pag)
                return NULL;
 
index 50a5772a8296c0735f608ac399f303b3f580c9a4..775164f54ea6de400ab9eac738cb443ae1c14a1f 100644 (file)
@@ -62,7 +62,7 @@ void xfs_drain_wait_enable(void);
  * until the item is finished or cancelled.
  */
 struct xfs_perag *xfs_perag_intent_get(struct xfs_mount *mp,
-               xfs_agnumber_t agno);
+               xfs_fsblock_t fsbno);
 void xfs_perag_intent_put(struct xfs_perag *pag);
 
 void xfs_perag_intent_hold(struct xfs_perag *pag);
@@ -76,7 +76,8 @@ struct xfs_defer_drain { /* empty */ };
 #define xfs_defer_drain_free(dr)               ((void)0)
 #define xfs_defer_drain_init(dr)               ((void)0)
 
-#define xfs_perag_intent_get(mp, agno)         xfs_perag_get((mp), (agno))
+#define xfs_perag_intent_get(mp, fsbno) \
+       xfs_perag_get((mp), XFS_FSB_TO_AGNO(mp, fsbno))
 #define xfs_perag_intent_put(pag)              xfs_perag_put(pag)
 
 static inline void xfs_perag_intent_hold(struct xfs_perag *pag) { }
index 5a76af9d8560f0256fe4ffe1d9ce76c5a96b4ba7..98d0fe0175f1fcc8aab7fae7a84b61dfc1d5bd13 100644 (file)
@@ -424,10 +424,7 @@ xfs_extent_free_get_group(
        struct xfs_mount                *mp,
        struct xfs_extent_free_item     *xefi)
 {
-       xfs_agnumber_t                  agno;
-
-       agno = XFS_FSB_TO_AGNO(mp, xefi->xefi_startblock);
-       xefi->xefi_pag = xfs_perag_intent_get(mp, agno);
+       xefi->xefi_pag = xfs_perag_intent_get(mp, xefi->xefi_startblock);
 }
 
 /* Release a passive AG ref after some freeing work. */
index 14919b33e4fe2274832b762842488cc70a6dfda7..78e106d05aa207f488ee6a093936d270f58defc8 100644 (file)
@@ -330,10 +330,7 @@ xfs_refcount_update_get_group(
        struct xfs_mount                *mp,
        struct xfs_refcount_intent      *ri)
 {
-       xfs_agnumber_t                  agno;
-
-       agno = XFS_FSB_TO_AGNO(mp, ri->ri_startblock);
-       ri->ri_pag = xfs_perag_intent_get(mp, agno);
+       ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_startblock);
 }
 
 /* Release a passive AG ref after finishing refcounting work. */
index e473124e29ccbdc87bb7ba97bce09ccffbad813f..2e732aded58e0d6d44fe677c2e1e920530c50e21 100644 (file)
@@ -356,10 +356,7 @@ xfs_rmap_update_get_group(
        struct xfs_mount        *mp,
        struct xfs_rmap_intent  *ri)
 {
-       xfs_agnumber_t          agno;
-
-       agno = XFS_FSB_TO_AGNO(mp, ri->ri_bmap.br_startblock);
-       ri->ri_pag = xfs_perag_intent_get(mp, agno);
+       ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_bmap.br_startblock);
 }
 
 /* Release a passive AG ref after finishing rmapping work. */