Skip to content

Commit f34061f

Browse files
Darrick J. Wongdchinner
authored andcommitted
xfs: pass explicit mount pointer to rtalloc query functions
Pass an explicit xfs_mount pointer to the rtalloc query functions so that they can support transactionless queries. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent f3bf67c commit f34061f

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

fs/xfs/libxfs/xfs_rtbitmap.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,14 +1008,14 @@ xfs_rtfree_extent(
10081008
/* Find all the free records within a given range. */
10091009
int
10101010
xfs_rtalloc_query_range(
1011+
struct xfs_mount *mp,
10111012
struct xfs_trans *tp,
10121013
const struct xfs_rtalloc_rec *low_rec,
10131014
const struct xfs_rtalloc_rec *high_rec,
10141015
xfs_rtalloc_query_range_fn fn,
10151016
void *priv)
10161017
{
10171018
struct xfs_rtalloc_rec rec;
1018-
struct xfs_mount *mp = tp->t_mountp;
10191019
xfs_rtblock_t rtstart;
10201020
xfs_rtblock_t rtend;
10211021
xfs_rtblock_t high_key;
@@ -1048,7 +1048,7 @@ xfs_rtalloc_query_range(
10481048
rec.ar_startext = rtstart;
10491049
rec.ar_extcount = rtend - rtstart + 1;
10501050

1051-
error = fn(tp, &rec, priv);
1051+
error = fn(mp, tp, &rec, priv);
10521052
if (error)
10531053
break;
10541054
}
@@ -1062,17 +1062,18 @@ xfs_rtalloc_query_range(
10621062
/* Find all the free records. */
10631063
int
10641064
xfs_rtalloc_query_all(
1065+
struct xfs_mount *mp,
10651066
struct xfs_trans *tp,
10661067
xfs_rtalloc_query_range_fn fn,
10671068
void *priv)
10681069
{
10691070
struct xfs_rtalloc_rec keys[2];
10701071

10711072
keys[0].ar_startext = 0;
1072-
keys[1].ar_startext = tp->t_mountp->m_sb.sb_rextents - 1;
1073+
keys[1].ar_startext = mp->m_sb.sb_rextents - 1;
10731074
keys[0].ar_extcount = keys[1].ar_extcount = 0;
10741075

1075-
return xfs_rtalloc_query_range(tp, &keys[0], &keys[1], fn, priv);
1076+
return xfs_rtalloc_query_range(mp, tp, &keys[0], &keys[1], fn, priv);
10761077
}
10771078

10781079
/* Is the given extent all free? */

fs/xfs/scrub/rtbitmap.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ xchk_setup_rt(
4040
/* Scrub a free extent record from the realtime bitmap. */
4141
STATIC int
4242
xchk_rtbitmap_rec(
43+
struct xfs_mount *mp,
4344
struct xfs_trans *tp,
4445
const struct xfs_rtalloc_rec *rec,
4546
void *priv)
@@ -48,10 +49,10 @@ xchk_rtbitmap_rec(
4849
xfs_rtblock_t startblock;
4950
xfs_rtblock_t blockcount;
5051

51-
startblock = rec->ar_startext * tp->t_mountp->m_sb.sb_rextsize;
52-
blockcount = rec->ar_extcount * tp->t_mountp->m_sb.sb_rextsize;
52+
startblock = rec->ar_startext * mp->m_sb.sb_rextsize;
53+
blockcount = rec->ar_extcount * mp->m_sb.sb_rextsize;
5354

54-
if (!xfs_verify_rtext(sc->mp, startblock, blockcount))
55+
if (!xfs_verify_rtext(mp, startblock, blockcount))
5556
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, 0);
5657
return 0;
5758
}
@@ -114,7 +115,7 @@ xchk_rtbitmap(
114115
if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
115116
return error;
116117

117-
error = xfs_rtalloc_query_all(sc->tp, xchk_rtbitmap_rec, sc);
118+
error = xfs_rtalloc_query_all(sc->mp, sc->tp, xchk_rtbitmap_rec, sc);
118119
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, &error))
119120
goto out;
120121

fs/xfs/xfs_fsmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,11 @@ xfs_getfsmap_logdev(
450450
/* Transform a rtbitmap "record" into a fsmap */
451451
STATIC int
452452
xfs_getfsmap_rtdev_rtbitmap_helper(
453+
struct xfs_mount *mp,
453454
struct xfs_trans *tp,
454455
const struct xfs_rtalloc_rec *rec,
455456
void *priv)
456457
{
457-
struct xfs_mount *mp = tp->t_mountp;
458458
struct xfs_getfsmap_info *info = priv;
459459
struct xfs_rmap_irec irec;
460460
xfs_daddr_t rec_daddr;
@@ -535,7 +535,7 @@ xfs_getfsmap_rtdev_rtbitmap_query(
535535
do_div(alow.ar_startext, mp->m_sb.sb_rextsize);
536536
if (do_div(ahigh.ar_startext, mp->m_sb.sb_rextsize))
537537
ahigh.ar_startext++;
538-
error = xfs_rtalloc_query_range(tp, &alow, &ahigh,
538+
error = xfs_rtalloc_query_range(mp, tp, &alow, &ahigh,
539539
xfs_getfsmap_rtdev_rtbitmap_helper, info);
540540
if (error)
541541
goto err;
@@ -547,7 +547,7 @@ xfs_getfsmap_rtdev_rtbitmap_query(
547547
info->last = true;
548548
ahigh.ar_startext = min(mp->m_sb.sb_rextents, ahigh.ar_startext);
549549

550-
error = xfs_getfsmap_rtdev_rtbitmap_helper(tp, &ahigh, info);
550+
error = xfs_getfsmap_rtdev_rtbitmap_helper(mp, tp, &ahigh, info);
551551
if (error)
552552
goto err;
553553
err:

fs/xfs/xfs_rtalloc.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct xfs_rtalloc_rec {
2222
};
2323

2424
typedef int (*xfs_rtalloc_query_range_fn)(
25+
struct xfs_mount *mp,
2526
struct xfs_trans *tp,
2627
const struct xfs_rtalloc_rec *rec,
2728
void *priv);
@@ -123,11 +124,11 @@ int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
123124
int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
124125
xfs_rtblock_t start, xfs_extlen_t len,
125126
struct xfs_buf **rbpp, xfs_fsblock_t *rsb);
126-
int xfs_rtalloc_query_range(struct xfs_trans *tp,
127+
int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
127128
const struct xfs_rtalloc_rec *low_rec,
128129
const struct xfs_rtalloc_rec *high_rec,
129130
xfs_rtalloc_query_range_fn fn, void *priv);
130-
int xfs_rtalloc_query_all(struct xfs_trans *tp,
131+
int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
131132
xfs_rtalloc_query_range_fn fn,
132133
void *priv);
133134
bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
@@ -140,7 +141,7 @@ int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
140141
# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
141142
# define xfs_growfs_rt(mp,in) (ENOSYS)
142143
# define xfs_rtalloc_query_range(t,l,h,f,p) (ENOSYS)
143-
# define xfs_rtalloc_query_all(t,f,p) (ENOSYS)
144+
# define xfs_rtalloc_query_all(m,t,f,p) (ENOSYS)
144145
# define xfs_rtbuf_get(m,t,b,i,p) (ENOSYS)
145146
# define xfs_verify_rtbno(m, r) (false)
146147
# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (ENOSYS)

0 commit comments

Comments
 (0)