xfs: shorten xfs_scrub_ prefix
Shorten all the metadata checking xfs_scrub_ prefixes to xchk_. After this, the only xfs_scrub* symbols are the ones that pertain to both scrub and repair. Whitespace damage will be fixed in a subsequent patch. There are no functional changes. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
Esse commit está contido em:
@@ -35,8 +35,8 @@
|
||||
* operational errors in common.c.
|
||||
*/
|
||||
bool
|
||||
xfs_scrub_da_process_error(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_process_error(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
int *error)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ xfs_scrub_da_process_error(
|
||||
switch (*error) {
|
||||
case -EDEADLOCK:
|
||||
/* Used to restart an op with deadlock avoidance. */
|
||||
trace_xfs_scrub_deadlock_retry(sc->ip, sc->sm, *error);
|
||||
trace_xchk_deadlock_retry(sc->ip, sc->sm, *error);
|
||||
break;
|
||||
case -EFSBADCRC:
|
||||
case -EFSCORRUPTED:
|
||||
@@ -57,7 +57,7 @@ xfs_scrub_da_process_error(
|
||||
*error = 0;
|
||||
/* fall through */
|
||||
default:
|
||||
trace_xfs_scrub_file_op_error(sc, ds->dargs.whichfork,
|
||||
trace_xchk_file_op_error(sc, ds->dargs.whichfork,
|
||||
xfs_dir2_da_to_db(ds->dargs.geo,
|
||||
ds->state->path.blk[level].blkno),
|
||||
*error, __return_address);
|
||||
@@ -71,15 +71,15 @@ xfs_scrub_da_process_error(
|
||||
* operational errors in common.c.
|
||||
*/
|
||||
void
|
||||
xfs_scrub_da_set_corrupt(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_set_corrupt(
|
||||
struct xchk_da_btree *ds,
|
||||
int level)
|
||||
{
|
||||
struct xfs_scrub_context *sc = ds->sc;
|
||||
|
||||
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
|
||||
|
||||
trace_xfs_scrub_fblock_error(sc, ds->dargs.whichfork,
|
||||
trace_xchk_fblock_error(sc, ds->dargs.whichfork,
|
||||
xfs_dir2_da_to_db(ds->dargs.geo,
|
||||
ds->state->path.blk[level].blkno),
|
||||
__return_address);
|
||||
@@ -87,8 +87,8 @@ xfs_scrub_da_set_corrupt(
|
||||
|
||||
/* Find an entry at a certain level in a da btree. */
|
||||
STATIC void *
|
||||
xfs_scrub_da_btree_entry(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_btree_entry(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
int rec)
|
||||
{
|
||||
@@ -123,8 +123,8 @@ xfs_scrub_da_btree_entry(
|
||||
|
||||
/* Scrub a da btree hash (key). */
|
||||
int
|
||||
xfs_scrub_da_btree_hash(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_btree_hash(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
__be32 *hashp)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ xfs_scrub_da_btree_hash(
|
||||
/* Is this hash in order? */
|
||||
hash = be32_to_cpu(*hashp);
|
||||
if (hash < ds->hashes[level])
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
ds->hashes[level] = hash;
|
||||
|
||||
if (level == 0)
|
||||
@@ -144,10 +144,10 @@ xfs_scrub_da_btree_hash(
|
||||
|
||||
/* Is this hash no larger than the parent hash? */
|
||||
blks = ds->state->path.blk;
|
||||
entry = xfs_scrub_da_btree_entry(ds, level - 1, blks[level - 1].index);
|
||||
entry = xchk_da_btree_entry(ds, level - 1, blks[level - 1].index);
|
||||
parent_hash = be32_to_cpu(entry->hashval);
|
||||
if (parent_hash < hash)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -157,13 +157,13 @@ xfs_scrub_da_btree_hash(
|
||||
* pointer.
|
||||
*/
|
||||
STATIC bool
|
||||
xfs_scrub_da_btree_ptr_ok(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_btree_ptr_ok(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
xfs_dablk_t blkno)
|
||||
{
|
||||
if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) {
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ xfs_scrub_da_btree_ptr_ok(
|
||||
* leaf1, we must multiplex the verifiers.
|
||||
*/
|
||||
static void
|
||||
xfs_scrub_da_btree_read_verify(
|
||||
xchk_da_btree_read_verify(
|
||||
struct xfs_buf *bp)
|
||||
{
|
||||
struct xfs_da_blkinfo *info = bp->b_addr;
|
||||
@@ -198,7 +198,7 @@ xfs_scrub_da_btree_read_verify(
|
||||
}
|
||||
}
|
||||
static void
|
||||
xfs_scrub_da_btree_write_verify(
|
||||
xchk_da_btree_write_verify(
|
||||
struct xfs_buf *bp)
|
||||
{
|
||||
struct xfs_da_blkinfo *info = bp->b_addr;
|
||||
@@ -220,7 +220,7 @@ xfs_scrub_da_btree_write_verify(
|
||||
}
|
||||
}
|
||||
static void *
|
||||
xfs_scrub_da_btree_verify(
|
||||
xchk_da_btree_verify(
|
||||
struct xfs_buf *bp)
|
||||
{
|
||||
struct xfs_da_blkinfo *info = bp->b_addr;
|
||||
@@ -236,17 +236,17 @@ xfs_scrub_da_btree_verify(
|
||||
}
|
||||
}
|
||||
|
||||
static const struct xfs_buf_ops xfs_scrub_da_btree_buf_ops = {
|
||||
.name = "xfs_scrub_da_btree",
|
||||
.verify_read = xfs_scrub_da_btree_read_verify,
|
||||
.verify_write = xfs_scrub_da_btree_write_verify,
|
||||
.verify_struct = xfs_scrub_da_btree_verify,
|
||||
static const struct xfs_buf_ops xchk_da_btree_buf_ops = {
|
||||
.name = "xchk_da_btree",
|
||||
.verify_read = xchk_da_btree_read_verify,
|
||||
.verify_write = xchk_da_btree_write_verify,
|
||||
.verify_struct = xchk_da_btree_verify,
|
||||
};
|
||||
|
||||
/* Check a block's sibling. */
|
||||
STATIC int
|
||||
xfs_scrub_da_btree_block_check_sibling(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_btree_block_check_sibling(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
int direction,
|
||||
xfs_dablk_t sibling)
|
||||
@@ -265,7 +265,7 @@ xfs_scrub_da_btree_block_check_sibling(
|
||||
error = xfs_da3_path_shift(ds->state, &ds->state->altpath,
|
||||
direction, false, &retval);
|
||||
if (error == 0 && retval == 0)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
@@ -273,19 +273,19 @@ xfs_scrub_da_btree_block_check_sibling(
|
||||
/* Move the alternate cursor one block in the direction given. */
|
||||
error = xfs_da3_path_shift(ds->state, &ds->state->altpath,
|
||||
direction, false, &retval);
|
||||
if (!xfs_scrub_da_process_error(ds, level, &error))
|
||||
if (!xchk_da_process_error(ds, level, &error))
|
||||
return error;
|
||||
if (retval) {
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
return error;
|
||||
}
|
||||
if (ds->state->altpath.blk[level].bp)
|
||||
xfs_scrub_buffer_recheck(ds->sc,
|
||||
xchk_buffer_recheck(ds->sc,
|
||||
ds->state->altpath.blk[level].bp);
|
||||
|
||||
/* Compare upper level pointer to sibling pointer. */
|
||||
if (ds->state->altpath.blk[level].blkno != sibling)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
xfs_trans_brelse(ds->dargs.trans, ds->state->altpath.blk[level].bp);
|
||||
out:
|
||||
return error;
|
||||
@@ -293,8 +293,8 @@ out:
|
||||
|
||||
/* Check a block's sibling pointers. */
|
||||
STATIC int
|
||||
xfs_scrub_da_btree_block_check_siblings(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_btree_block_check_siblings(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
struct xfs_da_blkinfo *hdr)
|
||||
{
|
||||
@@ -308,7 +308,7 @@ xfs_scrub_da_btree_block_check_siblings(
|
||||
/* Top level blocks should not have sibling pointers. */
|
||||
if (level == 0) {
|
||||
if (forw != 0 || back != 0)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -316,10 +316,10 @@ xfs_scrub_da_btree_block_check_siblings(
|
||||
* Check back (left) and forw (right) pointers. These functions
|
||||
* absorb error codes for us.
|
||||
*/
|
||||
error = xfs_scrub_da_btree_block_check_sibling(ds, level, 0, back);
|
||||
error = xchk_da_btree_block_check_sibling(ds, level, 0, back);
|
||||
if (error)
|
||||
goto out;
|
||||
error = xfs_scrub_da_btree_block_check_sibling(ds, level, 1, forw);
|
||||
error = xchk_da_btree_block_check_sibling(ds, level, 1, forw);
|
||||
|
||||
out:
|
||||
memset(&ds->state->altpath, 0, sizeof(ds->state->altpath));
|
||||
@@ -328,8 +328,8 @@ out:
|
||||
|
||||
/* Load a dir/attribute block from a btree. */
|
||||
STATIC int
|
||||
xfs_scrub_da_btree_block(
|
||||
struct xfs_scrub_da_btree *ds,
|
||||
xchk_da_btree_block(
|
||||
struct xchk_da_btree *ds,
|
||||
int level,
|
||||
xfs_dablk_t blkno)
|
||||
{
|
||||
@@ -355,17 +355,17 @@ xfs_scrub_da_btree_block(
|
||||
|
||||
/* Check the pointer. */
|
||||
blk->blkno = blkno;
|
||||
if (!xfs_scrub_da_btree_ptr_ok(ds, level, blkno))
|
||||
if (!xchk_da_btree_ptr_ok(ds, level, blkno))
|
||||
goto out_nobuf;
|
||||
|
||||
/* Read the buffer. */
|
||||
error = xfs_da_read_buf(dargs->trans, dargs->dp, blk->blkno, -2,
|
||||
&blk->bp, dargs->whichfork,
|
||||
&xfs_scrub_da_btree_buf_ops);
|
||||
if (!xfs_scrub_da_process_error(ds, level, &error))
|
||||
&xchk_da_btree_buf_ops);
|
||||
if (!xchk_da_process_error(ds, level, &error))
|
||||
goto out_nobuf;
|
||||
if (blk->bp)
|
||||
xfs_scrub_buffer_recheck(ds->sc, blk->bp);
|
||||
xchk_buffer_recheck(ds->sc, blk->bp);
|
||||
|
||||
/*
|
||||
* We didn't find a dir btree root block, which means that
|
||||
@@ -378,7 +378,7 @@ xfs_scrub_da_btree_block(
|
||||
|
||||
/* It's /not/ ok for attr trees not to have a da btree. */
|
||||
if (blk->bp == NULL) {
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
goto out_nobuf;
|
||||
}
|
||||
|
||||
@@ -388,17 +388,17 @@ xfs_scrub_da_btree_block(
|
||||
|
||||
/* We only started zeroing the header on v5 filesystems. */
|
||||
if (xfs_sb_version_hascrc(&ds->sc->mp->m_sb) && hdr3->hdr.pad)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
|
||||
/* Check the owner. */
|
||||
if (xfs_sb_version_hascrc(&ip->i_mount->m_sb)) {
|
||||
owner = be64_to_cpu(hdr3->owner);
|
||||
if (owner != ip->i_ino)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
}
|
||||
|
||||
/* Check the siblings. */
|
||||
error = xfs_scrub_da_btree_block_check_siblings(ds, level, &hdr3->hdr);
|
||||
error = xchk_da_btree_block_check_siblings(ds, level, &hdr3->hdr);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
@@ -411,7 +411,7 @@ xfs_scrub_da_btree_block(
|
||||
blk->magic = XFS_ATTR_LEAF_MAGIC;
|
||||
blk->hashval = xfs_attr_leaf_lasthash(blk->bp, pmaxrecs);
|
||||
if (ds->tree_level != 0)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
break;
|
||||
case XFS_DIR2_LEAFN_MAGIC:
|
||||
case XFS_DIR3_LEAFN_MAGIC:
|
||||
@@ -420,7 +420,7 @@ xfs_scrub_da_btree_block(
|
||||
blk->magic = XFS_DIR2_LEAFN_MAGIC;
|
||||
blk->hashval = xfs_dir2_leaf_lasthash(ip, blk->bp, pmaxrecs);
|
||||
if (ds->tree_level != 0)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
break;
|
||||
case XFS_DIR2_LEAF1_MAGIC:
|
||||
case XFS_DIR3_LEAF1_MAGIC:
|
||||
@@ -429,7 +429,7 @@ xfs_scrub_da_btree_block(
|
||||
blk->magic = XFS_DIR2_LEAF1_MAGIC;
|
||||
blk->hashval = xfs_dir2_leaf_lasthash(ip, blk->bp, pmaxrecs);
|
||||
if (ds->tree_level != 0)
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
break;
|
||||
case XFS_DA_NODE_MAGIC:
|
||||
case XFS_DA3_NODE_MAGIC:
|
||||
@@ -443,13 +443,13 @@ xfs_scrub_da_btree_block(
|
||||
blk->hashval = be32_to_cpu(btree[*pmaxrecs - 1].hashval);
|
||||
if (level == 0) {
|
||||
if (nodehdr.level >= XFS_DA_NODE_MAXDEPTH) {
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
goto out_freebp;
|
||||
}
|
||||
ds->tree_level = nodehdr.level;
|
||||
} else {
|
||||
if (ds->tree_level != nodehdr.level) {
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
goto out_freebp;
|
||||
}
|
||||
}
|
||||
@@ -457,7 +457,7 @@ xfs_scrub_da_btree_block(
|
||||
/* XXX: Check hdr3.pad32 once we know how to fix it. */
|
||||
break;
|
||||
default:
|
||||
xfs_scrub_da_set_corrupt(ds, level);
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
goto out_freebp;
|
||||
}
|
||||
|
||||
@@ -473,13 +473,13 @@ out_nobuf:
|
||||
|
||||
/* Visit all nodes and leaves of a da btree. */
|
||||
int
|
||||
xfs_scrub_da_btree(
|
||||
xchk_da_btree(
|
||||
struct xfs_scrub_context *sc,
|
||||
int whichfork,
|
||||
xfs_scrub_da_btree_rec_fn scrub_fn,
|
||||
xchk_da_btree_rec_fn scrub_fn,
|
||||
void *private)
|
||||
{
|
||||
struct xfs_scrub_da_btree ds = {};
|
||||
struct xchk_da_btree ds = {};
|
||||
struct xfs_mount *mp = sc->mp;
|
||||
struct xfs_da_state_blk *blks;
|
||||
struct xfs_da_node_entry *key;
|
||||
@@ -517,7 +517,7 @@ xfs_scrub_da_btree(
|
||||
|
||||
/* Find the root of the da tree, if present. */
|
||||
blks = ds.state->path.blk;
|
||||
error = xfs_scrub_da_btree_block(&ds, level, blkno);
|
||||
error = xchk_da_btree_block(&ds, level, blkno);
|
||||
if (error)
|
||||
goto out_state;
|
||||
/*
|
||||
@@ -542,12 +542,12 @@ xfs_scrub_da_btree(
|
||||
}
|
||||
|
||||
/* Dispatch record scrubbing. */
|
||||
rec = xfs_scrub_da_btree_entry(&ds, level,
|
||||
rec = xchk_da_btree_entry(&ds, level,
|
||||
blks[level].index);
|
||||
error = scrub_fn(&ds, level, rec);
|
||||
if (error)
|
||||
break;
|
||||
if (xfs_scrub_should_terminate(sc, &error) ||
|
||||
if (xchk_should_terminate(sc, &error) ||
|
||||
(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
|
||||
break;
|
||||
|
||||
@@ -566,8 +566,8 @@ xfs_scrub_da_btree(
|
||||
}
|
||||
|
||||
/* Hashes in order for scrub? */
|
||||
key = xfs_scrub_da_btree_entry(&ds, level, blks[level].index);
|
||||
error = xfs_scrub_da_btree_hash(&ds, level, &key->hashval);
|
||||
key = xchk_da_btree_entry(&ds, level, blks[level].index);
|
||||
error = xchk_da_btree_hash(&ds, level, &key->hashval);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
@@ -575,7 +575,7 @@ xfs_scrub_da_btree(
|
||||
blkno = be32_to_cpu(key->before);
|
||||
level++;
|
||||
ds.tree_level--;
|
||||
error = xfs_scrub_da_btree_block(&ds, level, blkno);
|
||||
error = xchk_da_btree_block(&ds, level, blkno);
|
||||
if (error)
|
||||
goto out;
|
||||
if (blks[level].bp == NULL)
|
||||
|
Referência em uma nova issue
Block a user