Skip to content

Commit 6af1300

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: return the busy generation from xfs_extent_busy_list_empty
This avoid having to poke into the internals of the busy tracking in xrep_setup_ag_allocbt. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent eb4a84a commit 6af1300

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

fs/xfs/scrub/alloc_repair.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,12 @@ int
132132
xrep_setup_ag_allocbt(
133133
struct xfs_scrub *sc)
134134
{
135-
unsigned int busy_gen;
136-
137135
/*
138136
* Make sure the busy extent list is clear because we can't put extents
139137
* on there twice.
140138
*/
141-
busy_gen = READ_ONCE(sc->sa.pag->pagb_gen);
142-
if (xfs_extent_busy_list_empty(sc->sa.pag))
139+
if (xfs_extent_busy_list_empty(sc->sa.pag, &busy_gen))
143140
return 0;
144-
145141
return xfs_extent_busy_flush(sc->tp, sc->sa.pag, busy_gen, 0);
146142
}
147143

@@ -849,6 +845,7 @@ xrep_allocbt(
849845
{
850846
struct xrep_abt *ra;
851847
struct xfs_mount *mp = sc->mp;
848+
unsigned int busy_gen;
852849
char *descr;
853850
int error;
854851

@@ -869,7 +866,7 @@ xrep_allocbt(
869866
* on there twice. In theory we cleared this before we started, but
870867
* let's not risk the filesystem.
871868
*/
872-
if (!xfs_extent_busy_list_empty(sc->sa.pag)) {
869+
if (!xfs_extent_busy_list_empty(sc->sa.pag, &busy_gen)) {
873870
error = -EDEADLOCK;
874871
goto out_ra;
875872
}

fs/xfs/xfs_extent_busy.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,14 @@ xfs_extent_busy_ag_cmp(
667667
/* Are there any busy extents in this AG? */
668668
bool
669669
xfs_extent_busy_list_empty(
670-
struct xfs_perag *pag)
670+
struct xfs_perag *pag,
671+
unsigned *busy_gen)
671672
{
672673
bool res;
673674

674675
spin_lock(&pag->pagb_lock);
675676
res = RB_EMPTY_ROOT(&pag->pagb_tree);
677+
*busy_gen = READ_ONCE(pag->pagb_gen);
676678
spin_unlock(&pag->pagb_lock);
677679
return res;
678680
}

fs/xfs/xfs_extent_busy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ static inline void xfs_extent_busy_sort(struct list_head *list)
8383
list_sort(NULL, list, xfs_extent_busy_ag_cmp);
8484
}
8585

86-
bool xfs_extent_busy_list_empty(struct xfs_perag *pag);
86+
bool xfs_extent_busy_list_empty(struct xfs_perag *pag, unsigned int *busy_gen);
8787

8888
#endif /* __XFS_EXTENT_BUSY_H__ */

0 commit comments

Comments
 (0)