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>
This commit is contained in:
parent
f3bf67c6c6
commit
f34061f554
|
@ -1008,6 +1008,7 @@ xfs_rtfree_extent(
|
||||||
/* Find all the free records within a given range. */
|
/* Find all the free records within a given range. */
|
||||||
int
|
int
|
||||||
xfs_rtalloc_query_range(
|
xfs_rtalloc_query_range(
|
||||||
|
struct xfs_mount *mp,
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
const struct xfs_rtalloc_rec *low_rec,
|
const struct xfs_rtalloc_rec *low_rec,
|
||||||
const struct xfs_rtalloc_rec *high_rec,
|
const struct xfs_rtalloc_rec *high_rec,
|
||||||
|
@ -1015,7 +1016,6 @@ xfs_rtalloc_query_range(
|
||||||
void *priv)
|
void *priv)
|
||||||
{
|
{
|
||||||
struct xfs_rtalloc_rec rec;
|
struct xfs_rtalloc_rec rec;
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
|
||||||
xfs_rtblock_t rtstart;
|
xfs_rtblock_t rtstart;
|
||||||
xfs_rtblock_t rtend;
|
xfs_rtblock_t rtend;
|
||||||
xfs_rtblock_t high_key;
|
xfs_rtblock_t high_key;
|
||||||
|
@ -1048,7 +1048,7 @@ xfs_rtalloc_query_range(
|
||||||
rec.ar_startext = rtstart;
|
rec.ar_startext = rtstart;
|
||||||
rec.ar_extcount = rtend - rtstart + 1;
|
rec.ar_extcount = rtend - rtstart + 1;
|
||||||
|
|
||||||
error = fn(tp, &rec, priv);
|
error = fn(mp, tp, &rec, priv);
|
||||||
if (error)
|
if (error)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1062,6 +1062,7 @@ xfs_rtalloc_query_range(
|
||||||
/* Find all the free records. */
|
/* Find all the free records. */
|
||||||
int
|
int
|
||||||
xfs_rtalloc_query_all(
|
xfs_rtalloc_query_all(
|
||||||
|
struct xfs_mount *mp,
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
xfs_rtalloc_query_range_fn fn,
|
xfs_rtalloc_query_range_fn fn,
|
||||||
void *priv)
|
void *priv)
|
||||||
|
@ -1069,10 +1070,10 @@ xfs_rtalloc_query_all(
|
||||||
struct xfs_rtalloc_rec keys[2];
|
struct xfs_rtalloc_rec keys[2];
|
||||||
|
|
||||||
keys[0].ar_startext = 0;
|
keys[0].ar_startext = 0;
|
||||||
keys[1].ar_startext = tp->t_mountp->m_sb.sb_rextents - 1;
|
keys[1].ar_startext = mp->m_sb.sb_rextents - 1;
|
||||||
keys[0].ar_extcount = keys[1].ar_extcount = 0;
|
keys[0].ar_extcount = keys[1].ar_extcount = 0;
|
||||||
|
|
||||||
return xfs_rtalloc_query_range(tp, &keys[0], &keys[1], fn, priv);
|
return xfs_rtalloc_query_range(mp, tp, &keys[0], &keys[1], fn, priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the given extent all free? */
|
/* Is the given extent all free? */
|
||||||
|
|
|
@ -40,6 +40,7 @@ xchk_setup_rt(
|
||||||
/* Scrub a free extent record from the realtime bitmap. */
|
/* Scrub a free extent record from the realtime bitmap. */
|
||||||
STATIC int
|
STATIC int
|
||||||
xchk_rtbitmap_rec(
|
xchk_rtbitmap_rec(
|
||||||
|
struct xfs_mount *mp,
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
const struct xfs_rtalloc_rec *rec,
|
const struct xfs_rtalloc_rec *rec,
|
||||||
void *priv)
|
void *priv)
|
||||||
|
@ -48,10 +49,10 @@ xchk_rtbitmap_rec(
|
||||||
xfs_rtblock_t startblock;
|
xfs_rtblock_t startblock;
|
||||||
xfs_rtblock_t blockcount;
|
xfs_rtblock_t blockcount;
|
||||||
|
|
||||||
startblock = rec->ar_startext * tp->t_mountp->m_sb.sb_rextsize;
|
startblock = rec->ar_startext * mp->m_sb.sb_rextsize;
|
||||||
blockcount = rec->ar_extcount * tp->t_mountp->m_sb.sb_rextsize;
|
blockcount = rec->ar_extcount * mp->m_sb.sb_rextsize;
|
||||||
|
|
||||||
if (!xfs_verify_rtext(sc->mp, startblock, blockcount))
|
if (!xfs_verify_rtext(mp, startblock, blockcount))
|
||||||
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, 0);
|
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +115,7 @@ xchk_rtbitmap(
|
||||||
if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
|
if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = xfs_rtalloc_query_all(sc->tp, xchk_rtbitmap_rec, sc);
|
error = xfs_rtalloc_query_all(sc->mp, sc->tp, xchk_rtbitmap_rec, sc);
|
||||||
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, &error))
|
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, &error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
|
@ -450,11 +450,11 @@ xfs_getfsmap_logdev(
|
||||||
/* Transform a rtbitmap "record" into a fsmap */
|
/* Transform a rtbitmap "record" into a fsmap */
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_getfsmap_rtdev_rtbitmap_helper(
|
xfs_getfsmap_rtdev_rtbitmap_helper(
|
||||||
|
struct xfs_mount *mp,
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
const struct xfs_rtalloc_rec *rec,
|
const struct xfs_rtalloc_rec *rec,
|
||||||
void *priv)
|
void *priv)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
|
||||||
struct xfs_getfsmap_info *info = priv;
|
struct xfs_getfsmap_info *info = priv;
|
||||||
struct xfs_rmap_irec irec;
|
struct xfs_rmap_irec irec;
|
||||||
xfs_daddr_t rec_daddr;
|
xfs_daddr_t rec_daddr;
|
||||||
|
@ -535,7 +535,7 @@ xfs_getfsmap_rtdev_rtbitmap_query(
|
||||||
do_div(alow.ar_startext, mp->m_sb.sb_rextsize);
|
do_div(alow.ar_startext, mp->m_sb.sb_rextsize);
|
||||||
if (do_div(ahigh.ar_startext, mp->m_sb.sb_rextsize))
|
if (do_div(ahigh.ar_startext, mp->m_sb.sb_rextsize))
|
||||||
ahigh.ar_startext++;
|
ahigh.ar_startext++;
|
||||||
error = xfs_rtalloc_query_range(tp, &alow, &ahigh,
|
error = xfs_rtalloc_query_range(mp, tp, &alow, &ahigh,
|
||||||
xfs_getfsmap_rtdev_rtbitmap_helper, info);
|
xfs_getfsmap_rtdev_rtbitmap_helper, info);
|
||||||
if (error)
|
if (error)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -547,7 +547,7 @@ xfs_getfsmap_rtdev_rtbitmap_query(
|
||||||
info->last = true;
|
info->last = true;
|
||||||
ahigh.ar_startext = min(mp->m_sb.sb_rextents, ahigh.ar_startext);
|
ahigh.ar_startext = min(mp->m_sb.sb_rextents, ahigh.ar_startext);
|
||||||
|
|
||||||
error = xfs_getfsmap_rtdev_rtbitmap_helper(tp, &ahigh, info);
|
error = xfs_getfsmap_rtdev_rtbitmap_helper(mp, tp, &ahigh, info);
|
||||||
if (error)
|
if (error)
|
||||||
goto err;
|
goto err;
|
||||||
err:
|
err:
|
||||||
|
|
|
@ -22,6 +22,7 @@ struct xfs_rtalloc_rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (*xfs_rtalloc_query_range_fn)(
|
typedef int (*xfs_rtalloc_query_range_fn)(
|
||||||
|
struct xfs_mount *mp,
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
const struct xfs_rtalloc_rec *rec,
|
const struct xfs_rtalloc_rec *rec,
|
||||||
void *priv);
|
void *priv);
|
||||||
|
@ -123,11 +124,11 @@ int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
|
||||||
int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
||||||
xfs_rtblock_t start, xfs_extlen_t len,
|
xfs_rtblock_t start, xfs_extlen_t len,
|
||||||
struct xfs_buf **rbpp, xfs_fsblock_t *rsb);
|
struct xfs_buf **rbpp, xfs_fsblock_t *rsb);
|
||||||
int xfs_rtalloc_query_range(struct xfs_trans *tp,
|
int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
|
||||||
const struct xfs_rtalloc_rec *low_rec,
|
const struct xfs_rtalloc_rec *low_rec,
|
||||||
const struct xfs_rtalloc_rec *high_rec,
|
const struct xfs_rtalloc_rec *high_rec,
|
||||||
xfs_rtalloc_query_range_fn fn, void *priv);
|
xfs_rtalloc_query_range_fn fn, void *priv);
|
||||||
int xfs_rtalloc_query_all(struct xfs_trans *tp,
|
int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
|
||||||
xfs_rtalloc_query_range_fn fn,
|
xfs_rtalloc_query_range_fn fn,
|
||||||
void *priv);
|
void *priv);
|
||||||
bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
|
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,
|
||||||
# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
|
# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
|
||||||
# define xfs_growfs_rt(mp,in) (ENOSYS)
|
# define xfs_growfs_rt(mp,in) (ENOSYS)
|
||||||
# define xfs_rtalloc_query_range(t,l,h,f,p) (ENOSYS)
|
# define xfs_rtalloc_query_range(t,l,h,f,p) (ENOSYS)
|
||||||
# define xfs_rtalloc_query_all(t,f,p) (ENOSYS)
|
# define xfs_rtalloc_query_all(m,t,f,p) (ENOSYS)
|
||||||
# define xfs_rtbuf_get(m,t,b,i,p) (ENOSYS)
|
# define xfs_rtbuf_get(m,t,b,i,p) (ENOSYS)
|
||||||
# define xfs_verify_rtbno(m, r) (false)
|
# define xfs_verify_rtbno(m, r) (false)
|
||||||
# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (ENOSYS)
|
# define xfs_rtalloc_extent_is_free(m,t,s,l,i) (ENOSYS)
|
||||||
|
|
Loading…
Reference in New Issue