Skip to content

Commit 62d597a

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: pass the fsbno to xfs_perag_intent_get
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 <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 980faec commit 62d597a

File tree

6 files changed

+11
-23
lines changed

6 files changed

+11
-23
lines changed

fs/xfs/xfs_bmap_item.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,21 +324,17 @@ xfs_bmap_update_get_group(
324324
struct xfs_mount *mp,
325325
struct xfs_bmap_intent *bi)
326326
{
327-
xfs_agnumber_t agno;
328-
329327
if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork))
330328
return;
331329

332-
agno = XFS_FSB_TO_AGNO(mp, bi->bi_bmap.br_startblock);
333-
334330
/*
335331
* Bump the intent count on behalf of the deferred rmap and refcount
336332
* intent items that that we can queue when we finish this bmap work.
337333
* This new intent item will bump the intent count before the bmap
338334
* intent drops the intent count, ensuring that the intent count
339335
* remains nonzero across the transaction roll.
340336
*/
341-
bi->bi_pag = xfs_perag_intent_get(mp, agno);
337+
bi->bi_pag = xfs_perag_intent_get(mp, bi->bi_bmap.br_startblock);
342338
}
343339

344340
/* Add this deferred BUI to the transaction. */

fs/xfs/xfs_drain.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ static inline int xfs_defer_drain_wait(struct xfs_defer_drain *dr)
9494
}
9595

9696
/*
97-
* Get a passive reference to an AG and declare an intent to update its
98-
* metadata.
97+
* Get a passive reference to the AG that contains a fsbno and declare an intent
98+
* to update its metadata.
9999
*/
100100
struct xfs_perag *
101101
xfs_perag_intent_get(
102102
struct xfs_mount *mp,
103-
xfs_agnumber_t agno)
103+
xfs_fsblock_t fsbno)
104104
{
105105
struct xfs_perag *pag;
106106

107-
pag = xfs_perag_get(mp, agno);
107+
pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, fsbno));
108108
if (!pag)
109109
return NULL;
110110

fs/xfs/xfs_drain.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void xfs_drain_wait_enable(void);
6262
* until the item is finished or cancelled.
6363
*/
6464
struct xfs_perag *xfs_perag_intent_get(struct xfs_mount *mp,
65-
xfs_agnumber_t agno);
65+
xfs_fsblock_t fsbno);
6666
void xfs_perag_intent_put(struct xfs_perag *pag);
6767

6868
void xfs_perag_intent_hold(struct xfs_perag *pag);
@@ -76,7 +76,8 @@ struct xfs_defer_drain { /* empty */ };
7676
#define xfs_defer_drain_free(dr) ((void)0)
7777
#define xfs_defer_drain_init(dr) ((void)0)
7878

79-
#define xfs_perag_intent_get(mp, agno) xfs_perag_get((mp), (agno))
79+
#define xfs_perag_intent_get(mp, fsbno) \
80+
xfs_perag_get((mp), XFS_FSB_TO_AGNO(mp, fsbno))
8081
#define xfs_perag_intent_put(pag) xfs_perag_put(pag)
8182

8283
static inline void xfs_perag_intent_hold(struct xfs_perag *pag) { }

fs/xfs/xfs_extfree_item.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,7 @@ xfs_extent_free_get_group(
424424
struct xfs_mount *mp,
425425
struct xfs_extent_free_item *xefi)
426426
{
427-
xfs_agnumber_t agno;
428-
429-
agno = XFS_FSB_TO_AGNO(mp, xefi->xefi_startblock);
430-
xefi->xefi_pag = xfs_perag_intent_get(mp, agno);
427+
xefi->xefi_pag = xfs_perag_intent_get(mp, xefi->xefi_startblock);
431428
}
432429

433430
/* Release a passive AG ref after some freeing work. */

fs/xfs/xfs_refcount_item.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,7 @@ xfs_refcount_update_get_group(
330330
struct xfs_mount *mp,
331331
struct xfs_refcount_intent *ri)
332332
{
333-
xfs_agnumber_t agno;
334-
335-
agno = XFS_FSB_TO_AGNO(mp, ri->ri_startblock);
336-
ri->ri_pag = xfs_perag_intent_get(mp, agno);
333+
ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_startblock);
337334
}
338335

339336
/* Release a passive AG ref after finishing refcounting work. */

fs/xfs/xfs_rmap_item.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,7 @@ xfs_rmap_update_get_group(
356356
struct xfs_mount *mp,
357357
struct xfs_rmap_intent *ri)
358358
{
359-
xfs_agnumber_t agno;
360-
361-
agno = XFS_FSB_TO_AGNO(mp, ri->ri_bmap.br_startblock);
362-
ri->ri_pag = xfs_perag_intent_get(mp, agno);
359+
ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_bmap.br_startblock);
363360
}
364361

365362
/* Release a passive AG ref after finishing rmapping work. */

0 commit comments

Comments
 (0)