Commit 00b10d48 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: rename xfs_bitmap to xbitmap

Shorten the name of xfs_bitmap to xbitmap since the scrub bitmap has
nothing to do with the libxfs bitmap.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent 37a6547d
......@@ -429,10 +429,10 @@ xrep_agf(
struct xrep_agfl {
/* Bitmap of other OWN_AG metadata blocks. */
struct xfs_bitmap agmetablocks;
struct xbitmap agmetablocks;
/* Bitmap of free space. */
struct xfs_bitmap *freesp;
struct xbitmap *freesp;
struct xfs_scrub *sc;
};
......@@ -455,12 +455,12 @@ xrep_agfl_walk_rmap(
if (rec->rm_owner == XFS_RMAP_OWN_AG) {
fsb = XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.agno,
rec->rm_startblock);
error = xfs_bitmap_set(ra->freesp, fsb, rec->rm_blockcount);
error = xbitmap_set(ra->freesp, fsb, rec->rm_blockcount);
if (error)
return error;
}
return xfs_bitmap_set_btcur_path(&ra->agmetablocks, cur);
return xbitmap_set_btcur_path(&ra->agmetablocks, cur);
}
/*
......@@ -476,19 +476,19 @@ STATIC int
xrep_agfl_collect_blocks(
struct xfs_scrub *sc,
struct xfs_buf *agf_bp,
struct xfs_bitmap *agfl_extents,
struct xbitmap *agfl_extents,
xfs_agblock_t *flcount)
{
struct xrep_agfl ra;
struct xfs_mount *mp = sc->mp;
struct xfs_btree_cur *cur;
struct xfs_bitmap_range *br;
struct xfs_bitmap_range *n;
struct xbitmap_range *br;
struct xbitmap_range *n;
int error;
ra.sc = sc;
ra.freesp = agfl_extents;
xfs_bitmap_init(&ra.agmetablocks);
xbitmap_init(&ra.agmetablocks);
/* Find all space used by the free space btrees & rmapbt. */
cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno);
......@@ -500,7 +500,7 @@ xrep_agfl_collect_blocks(
/* Find all blocks currently being used by the bnobt. */
cur = xfs_allocbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno,
XFS_BTNUM_BNO);
error = xfs_bitmap_set_btblocks(&ra.agmetablocks, cur);
error = xbitmap_set_btblocks(&ra.agmetablocks, cur);
if (error)
goto err;
xfs_btree_del_cursor(cur, error);
......@@ -508,7 +508,7 @@ xrep_agfl_collect_blocks(
/* Find all blocks currently being used by the cntbt. */
cur = xfs_allocbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno,
XFS_BTNUM_CNT);
error = xfs_bitmap_set_btblocks(&ra.agmetablocks, cur);
error = xbitmap_set_btblocks(&ra.agmetablocks, cur);
if (error)
goto err;
......@@ -518,8 +518,8 @@ xrep_agfl_collect_blocks(
* Drop the freesp meta blocks that are in use by btrees.
* The remaining blocks /should/ be AGFL blocks.
*/
error = xfs_bitmap_disunion(agfl_extents, &ra.agmetablocks);
xfs_bitmap_destroy(&ra.agmetablocks);
error = xbitmap_disunion(agfl_extents, &ra.agmetablocks);
xbitmap_destroy(&ra.agmetablocks);
if (error)
return error;
......@@ -528,7 +528,7 @@ xrep_agfl_collect_blocks(
* the AGFL we'll free them later.
*/
*flcount = 0;
for_each_xfs_bitmap_extent(br, n, agfl_extents) {
for_each_xbitmap_extent(br, n, agfl_extents) {
*flcount += br->len;
if (*flcount > xfs_agfl_size(mp))
break;
......@@ -538,7 +538,7 @@ xrep_agfl_collect_blocks(
return 0;
err:
xfs_bitmap_destroy(&ra.agmetablocks);
xbitmap_destroy(&ra.agmetablocks);
xfs_btree_del_cursor(cur, error);
return error;
}
......@@ -573,13 +573,13 @@ STATIC void
xrep_agfl_init_header(
struct xfs_scrub *sc,
struct xfs_buf *agfl_bp,
struct xfs_bitmap *agfl_extents,
struct xbitmap *agfl_extents,
xfs_agblock_t flcount)
{
struct xfs_mount *mp = sc->mp;
__be32 *agfl_bno;
struct xfs_bitmap_range *br;
struct xfs_bitmap_range *n;
struct xbitmap_range *br;
struct xbitmap_range *n;
struct xfs_agfl *agfl;
xfs_agblock_t agbno;
unsigned int fl_off;
......@@ -603,7 +603,7 @@ xrep_agfl_init_header(
*/
fl_off = 0;
agfl_bno = xfs_buf_to_agfl_bno(agfl_bp);
for_each_xfs_bitmap_extent(br, n, agfl_extents) {
for_each_xbitmap_extent(br, n, agfl_extents) {
agbno = XFS_FSB_TO_AGBNO(mp, br->start);
trace_xrep_agfl_insert(mp, sc->sa.agno, agbno, br->len);
......@@ -637,7 +637,7 @@ int
xrep_agfl(
struct xfs_scrub *sc)
{
struct xfs_bitmap agfl_extents;
struct xbitmap agfl_extents;
struct xfs_mount *mp = sc->mp;
struct xfs_buf *agf_bp;
struct xfs_buf *agfl_bp;
......@@ -649,7 +649,7 @@ xrep_agfl(
return -EOPNOTSUPP;
xchk_perag_get(sc->mp, &sc->sa);
xfs_bitmap_init(&agfl_extents);
xbitmap_init(&agfl_extents);
/*
* Read the AGF so that we can query the rmapbt. We hope that there's
......@@ -699,7 +699,7 @@ xrep_agfl(
error = xrep_reap_extents(sc, &agfl_extents, &XFS_RMAP_OINFO_AG,
XFS_AG_RESV_AGFL);
err:
xfs_bitmap_destroy(&agfl_extents);
xbitmap_destroy(&agfl_extents);
return error;
}
......
......@@ -18,14 +18,14 @@
* This is the logical equivalent of bitmap |= mask(start, len).
*/
int
xfs_bitmap_set(
struct xfs_bitmap *bitmap,
xbitmap_set(
struct xbitmap *bitmap,
uint64_t start,
uint64_t len)
{
struct xfs_bitmap_range *bmr;
struct xbitmap_range *bmr;
bmr = kmem_alloc(sizeof(struct xfs_bitmap_range), KM_MAYFAIL);
bmr = kmem_alloc(sizeof(struct xbitmap_range), KM_MAYFAIL);
if (!bmr)
return -ENOMEM;
......@@ -39,13 +39,13 @@ xfs_bitmap_set(
/* Free everything related to this bitmap. */
void
xfs_bitmap_destroy(
struct xfs_bitmap *bitmap)
xbitmap_destroy(
struct xbitmap *bitmap)
{
struct xfs_bitmap_range *bmr;
struct xfs_bitmap_range *n;
struct xbitmap_range *bmr;
struct xbitmap_range *n;
for_each_xfs_bitmap_extent(bmr, n, bitmap) {
for_each_xbitmap_extent(bmr, n, bitmap) {
list_del(&bmr->list);
kmem_free(bmr);
}
......@@ -53,24 +53,24 @@ xfs_bitmap_destroy(
/* Set up a per-AG block bitmap. */
void
xfs_bitmap_init(
struct xfs_bitmap *bitmap)
xbitmap_init(
struct xbitmap *bitmap)
{
INIT_LIST_HEAD(&bitmap->list);
}
/* Compare two btree extents. */
static int
xfs_bitmap_range_cmp(
xbitmap_range_cmp(
void *priv,
struct list_head *a,
struct list_head *b)
{
struct xfs_bitmap_range *ap;
struct xfs_bitmap_range *bp;
struct xbitmap_range *ap;
struct xbitmap_range *bp;
ap = container_of(a, struct xfs_bitmap_range, list);
bp = container_of(b, struct xfs_bitmap_range, list);
ap = container_of(a, struct xbitmap_range, list);
bp = container_of(b, struct xbitmap_range, list);
if (ap->start > bp->start)
return 1;
......@@ -96,14 +96,14 @@ xfs_bitmap_range_cmp(
#define LEFT_ALIGNED (1 << 0)
#define RIGHT_ALIGNED (1 << 1)
int
xfs_bitmap_disunion(
struct xfs_bitmap *bitmap,
struct xfs_bitmap *sub)
xbitmap_disunion(
struct xbitmap *bitmap,
struct xbitmap *sub)
{
struct list_head *lp;
struct xfs_bitmap_range *br;
struct xfs_bitmap_range *new_br;
struct xfs_bitmap_range *sub_br;
struct xbitmap_range *br;
struct xbitmap_range *new_br;
struct xbitmap_range *sub_br;
uint64_t sub_start;
uint64_t sub_len;
int state;
......@@ -113,8 +113,8 @@ xfs_bitmap_disunion(
return 0;
ASSERT(!list_empty(&sub->list));
list_sort(NULL, &bitmap->list, xfs_bitmap_range_cmp);
list_sort(NULL, &sub->list, xfs_bitmap_range_cmp);
list_sort(NULL, &bitmap->list, xbitmap_range_cmp);
list_sort(NULL, &sub->list, xbitmap_range_cmp);
/*
* Now that we've sorted both lists, we iterate bitmap once, rolling
......@@ -124,11 +124,11 @@ xfs_bitmap_disunion(
* list traversal is similar to merge sort, but we're deleting
* instead. In this manner we avoid O(n^2) operations.
*/
sub_br = list_first_entry(&sub->list, struct xfs_bitmap_range,
sub_br = list_first_entry(&sub->list, struct xbitmap_range,
list);
lp = bitmap->list.next;
while (lp != &bitmap->list) {
br = list_entry(lp, struct xfs_bitmap_range, list);
br = list_entry(lp, struct xbitmap_range, list);
/*
* Advance sub_br and/or br until we find a pair that
......@@ -181,7 +181,7 @@ xfs_bitmap_disunion(
* Deleting from the middle: add the new right extent
* and then shrink the left extent.
*/
new_br = kmem_alloc(sizeof(struct xfs_bitmap_range),
new_br = kmem_alloc(sizeof(struct xbitmap_range),
KM_MAYFAIL);
if (!new_br) {
error = -ENOMEM;
......@@ -247,8 +247,8 @@ xfs_bitmap_disunion(
* blocks going from the leaf towards the root.
*/
int
xfs_bitmap_set_btcur_path(
struct xfs_bitmap *bitmap,
xbitmap_set_btcur_path(
struct xbitmap *bitmap,
struct xfs_btree_cur *cur)
{
struct xfs_buf *bp;
......@@ -261,7 +261,7 @@ xfs_bitmap_set_btcur_path(
if (!bp)
continue;
fsb = XFS_DADDR_TO_FSB(cur->bc_mp, bp->b_bn);
error = xfs_bitmap_set(bitmap, fsb, 1);
error = xbitmap_set(bitmap, fsb, 1);
if (error)
return error;
}
......@@ -271,12 +271,12 @@ xfs_bitmap_set_btcur_path(
/* Collect a btree's block in the bitmap. */
STATIC int
xfs_bitmap_collect_btblock(
xbitmap_collect_btblock(
struct xfs_btree_cur *cur,
int level,
void *priv)
{
struct xfs_bitmap *bitmap = priv;
struct xbitmap *bitmap = priv;
struct xfs_buf *bp;
xfs_fsblock_t fsbno;
......@@ -285,15 +285,15 @@ xfs_bitmap_collect_btblock(
return 0;
fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, bp->b_bn);
return xfs_bitmap_set(bitmap, fsbno, 1);
return xbitmap_set(bitmap, fsbno, 1);
}
/* Walk the btree and mark the bitmap wherever a btree block is found. */
int
xfs_bitmap_set_btblocks(
struct xfs_bitmap *bitmap,
xbitmap_set_btblocks(
struct xbitmap *bitmap,
struct xfs_btree_cur *cur)
{
return xfs_btree_visit_blocks(cur, xfs_bitmap_collect_btblock,
return xfs_btree_visit_blocks(cur, xbitmap_collect_btblock,
XFS_BTREE_VISIT_ALL, bitmap);
}
......@@ -6,31 +6,31 @@
#ifndef __XFS_SCRUB_BITMAP_H__
#define __XFS_SCRUB_BITMAP_H__
struct xfs_bitmap_range {
struct xbitmap_range {
struct list_head list;
uint64_t start;
uint64_t len;
};
struct xfs_bitmap {
struct xbitmap {
struct list_head list;
};
void xfs_bitmap_init(struct xfs_bitmap *bitmap);
void xfs_bitmap_destroy(struct xfs_bitmap *bitmap);
void xbitmap_init(struct xbitmap *bitmap);
void xbitmap_destroy(struct xbitmap *bitmap);
#define for_each_xfs_bitmap_extent(bex, n, bitmap) \
#define for_each_xbitmap_extent(bex, n, bitmap) \
list_for_each_entry_safe((bex), (n), &(bitmap)->list, list)
#define for_each_xfs_bitmap_block(b, bex, n, bitmap) \
#define for_each_xbitmap_block(b, bex, n, bitmap) \
list_for_each_entry_safe((bex), (n), &(bitmap)->list, list) \
for ((b) = bex->start; (b) < bex->start + bex->len; (b)++)
for ((b) = (bex)->start; (b) < (bex)->start + (bex)->len; (b)++)
int xfs_bitmap_set(struct xfs_bitmap *bitmap, uint64_t start, uint64_t len);
int xfs_bitmap_disunion(struct xfs_bitmap *bitmap, struct xfs_bitmap *sub);
int xfs_bitmap_set_btcur_path(struct xfs_bitmap *bitmap,
int xbitmap_set(struct xbitmap *bitmap, uint64_t start, uint64_t len);
int xbitmap_disunion(struct xbitmap *bitmap, struct xbitmap *sub);
int xbitmap_set_btcur_path(struct xbitmap *bitmap,
struct xfs_btree_cur *cur);
int xfs_bitmap_set_btblocks(struct xfs_bitmap *bitmap,
int xbitmap_set_btblocks(struct xbitmap *bitmap,
struct xfs_btree_cur *cur);
#endif /* __XFS_SCRUB_BITMAP_H__ */
......@@ -436,10 +436,10 @@ xrep_init_btblock(
int
xrep_invalidate_blocks(
struct xfs_scrub *sc,
struct xfs_bitmap *bitmap)
struct xbitmap *bitmap)
{
struct xfs_bitmap_range *bmr;
struct xfs_bitmap_range *n;
struct xbitmap_range *bmr;
struct xbitmap_range *n;
struct xfs_buf *bp;
xfs_fsblock_t fsbno;
......@@ -451,7 +451,7 @@ xrep_invalidate_blocks(
* because we never own those; and if we can't TRYLOCK the buffer we
* assume it's owned by someone else.
*/
for_each_xfs_bitmap_block(fsbno, bmr, n, bitmap) {
for_each_xbitmap_block(fsbno, bmr, n, bitmap) {
/* Skip AG headers and post-EOFS blocks */
if (!xfs_verify_fsbno(sc->mp, fsbno))
continue;
......@@ -597,18 +597,18 @@ xrep_reap_block(
int
xrep_reap_extents(
struct xfs_scrub *sc,
struct xfs_bitmap *bitmap,
struct xbitmap *bitmap,
const struct xfs_owner_info *oinfo,
enum xfs_ag_resv_type type)
{
struct xfs_bitmap_range *bmr;
struct xfs_bitmap_range *n;
struct xbitmap_range *bmr;
struct xbitmap_range *n;
xfs_fsblock_t fsbno;
int error = 0;
ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb));
for_each_xfs_bitmap_block(fsbno, bmr, n, bitmap) {
for_each_xbitmap_block(fsbno, bmr, n, bitmap) {
ASSERT(sc->ip != NULL ||
XFS_FSB_TO_AGNO(sc->mp, fsbno) == sc->sa.agno);
trace_xrep_dispose_btree_extent(sc->mp,
......
......@@ -28,11 +28,11 @@ int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb,
struct xfs_buf **bpp, xfs_btnum_t btnum,
const struct xfs_buf_ops *ops);
struct xfs_bitmap;
struct xbitmap;
int xrep_fix_freelist(struct xfs_scrub *sc, bool can_shrink);
int xrep_invalidate_blocks(struct xfs_scrub *sc, struct xfs_bitmap *btlist);
int xrep_reap_extents(struct xfs_scrub *sc, struct xfs_bitmap *exlist,
int xrep_invalidate_blocks(struct xfs_scrub *sc, struct xbitmap *btlist);
int xrep_reap_extents(struct xfs_scrub *sc, struct xbitmap *exlist,
const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
struct xrep_find_ag_btree {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment