M_DIROPS(mp)->node_hdr_from_disk(&nodehdr, node);
if (nodehdr.magic != XFS_DA_NODE_MAGIC &&
- nodehdr.magic != XFS_DA3_NODE_MAGIC) {
+ nodehdr.magic != XFS_DA3_NODE_MAGIC) {
do_warn(_("bad dir/attr magic number in inode %" PRIu64 ", "
"file bno = %u, fsbno = %" PRIu64 "\n"),
da_cursor->ino, bno, fsbno);
}
btree = M_DIROPS(mp)->node_tree_p(node);
- if (nodehdr.count > geo->node_ents) {
+ if (nodehdr.count > geo->node_ents) {
do_warn(_("bad record count in inode %" PRIu64 ", "
"count = %d, max = %d\n"),
da_cursor->ino, nodehdr.count, geo->node_ents);
i = -1;
goto error_out;
}
- } else {
- if (nodehdr.level == i - 1) {
+ } else {
+ if (nodehdr.level == i - 1) {
i--;
- } else {
+ } else {
do_warn(_("bad attribute fork btree "
"for inode %" PRIu64 "\n"),
da_cursor->ino);
return(1);
error_out:
- while (i > 1 && i <= da_cursor->active) {
+ while (i > 1 && i <= da_cursor->active) {
libxfs_putbuf(da_cursor->level[i].bp);
i++;
}
* that all entries are used, encountered and expected hashvals
* match, etc.
*/
- if (entry != nodehdr.count - 1) {
+ if (entry != nodehdr.count - 1) {
do_warn(_("directory/attribute block used/count "
"inconsistency - %d/%hu\n"),
entry, nodehdr.count);
be32_to_cpu(btree[entry].hashval));
bad++;
}
- if (nodehdr.forw != 0) {
+ if (nodehdr.forw != 0) {
do_warn(_("bad directory/attribute forward block pointer, "
"expected 0, saw %u\n"),
nodehdr.forw);
}
if (cursor->level[p_level].hashval != be32_to_cpu(btree[entry].hashval)) {
- if (!no_modify) {
+ if (!no_modify) {
do_warn(_("correcting bad hashval in non-leaf "
"dir/attr block\n\tin (level %d) in "
"inode %" PRIu64 ".\n"),
btree[entry].hashval = cpu_to_be32(
cursor->level[p_level].hashval);
cursor->level[this_level].dirty++;
- } else {
+ } else {
do_warn(_("would correct bad hashval in non-leaf "
"dir/attr block\n\tin (level %d) in "
"inode %" PRIu64 ".\n"),
/*
* bail out if this is the root block (top of tree)
*/
- if (this_level >= cursor->active) {
+ if (this_level >= cursor->active) {
#ifdef XR_DIR_TRACE
fprintf(stderr, "verify_final_da_path returns 0 (ok)\n");
#endif
* block and move on to the next block.
* and update cursor value for said level
*/
- if (entry >= nodehdr.count) {
+ if (entry >= nodehdr.count) {
/*
* update the hash value for this level before
* validating it. bno value should be ok since
*/
bad = 0;
if (nodehdr.magic != XFS_DA_NODE_MAGIC &&
- nodehdr.magic != XFS_DA3_NODE_MAGIC) {
+ nodehdr.magic != XFS_DA3_NODE_MAGIC) {
do_warn(
_("bad magic number %x in block %u (%" PRIu64 ") for directory inode %" PRIu64 "\n"),
nodehdr.magic,
dabno, fsbno, cursor->ino);
bad++;
}
- if (bad) {
+ if (bad) {
#ifdef XR_DIR_TRACE
fprintf(stderr, "verify_da_path returns 1 (bad) #4\n");
#endif
/*
* ditto for block numbers
*/
- if (cursor->level[p_level].bno != be32_to_cpu(btree[entry].before)) {
+ if (cursor->level[p_level].bno != be32_to_cpu(btree[entry].before)) {
#ifdef XR_DIR_TRACE
fprintf(stderr, "bad directory btree pointer, child bno "
"should be %d, block bno is %d, hashval is %u\n",
* block against the hashval in the current entry
*/
if (cursor->level[p_level].hashval !=
- be32_to_cpu(btree[entry].hashval)) {
- if (!no_modify) {
+ be32_to_cpu(btree[entry].hashval)) {
+ if (!no_modify) {
do_warn(_("correcting bad hashval in interior "
"dir/attr block\n\tin (level %d) in "
"inode %" PRIu64 ".\n"),
btree[entry].hashval = cpu_to_be32(
cursor->level[p_level].hashval);
cursor->level[this_level].dirty++;
- } else {
+ } else {
do_warn(_("would correct bad hashval in interior "
"dir/attr block\n\tin (level %d) in "
"inode %" PRIu64 ".\n"),
M_DIROPS(mp)->node_hdr_from_disk(&nodehdr, node);
if (nodehdr.magic == XFS_DIR2_LEAFN_MAGIC ||
- nodehdr.magic == XFS_DIR3_LEAFN_MAGIC) {
+ nodehdr.magic == XFS_DIR3_LEAFN_MAGIC) {
if ( i != -1 ) {
do_warn(
_("found non-root LEAFN node in inode %" PRIu64 " bno = %u\n"),
}
if (nodehdr.magic != XFS_DA_NODE_MAGIC &&
- nodehdr.magic != XFS_DA3_NODE_MAGIC) {
+ nodehdr.magic != XFS_DA3_NODE_MAGIC) {
libxfs_putbuf(bp);
do_warn(
_("bad dir magic number 0x%x in inode %" PRIu64 " bno = %u\n"),
goto error_out;
}
btree = M_DIROPS(mp)->node_tree_p(node);
- if (nodehdr.count > geo->node_ents) {
+ if (nodehdr.count > geo->node_ents) {
do_warn(
_("bad record count in inode %" PRIu64 ", count = %d, max = %d\n"),
da_cursor->ino, nodehdr.count, geo->node_ents);
goto error_out;
}
} else {
- if (nodehdr.level == i - 1) {
+ if (nodehdr.level == i - 1) {
i--;
- } else {
+ } else {
do_warn(
_("bad directory btree for directory inode %" PRIu64 "\n"),
da_cursor->ino);
return(1);
error_out:
- while (i > 1 && i <= da_cursor->active) {
+ while (i > 1 && i <= da_cursor->active) {
libxfs_putbuf(da_cursor->level[i].bp);
i++;
}
* that all entries are used, encountered and expected hashvals
* match, etc.
*/
- if (entry != nodehdr.count - 1) {
+ if (entry != nodehdr.count - 1) {
do_warn(
_("directory block used/count inconsistency - %d / %hu\n"),
entry, nodehdr.count);
* hash values monotonically increasing ???
*/
if (cursor->level[this_level].hashval >=
- be32_to_cpu(btree[entry].hashval)) {
+ be32_to_cpu(btree[entry].hashval)) {
do_warn(_("directory/attribute block hashvalue inconsistency, "
"expected > %u / saw %u\n"),
cursor->level[this_level].hashval,
be32_to_cpu(btree[entry].hashval));
bad++;
}
- if (nodehdr.forw != 0) {
+ if (nodehdr.forw != 0) {
do_warn(_("bad directory/attribute forward block pointer, "
"expected 0, saw %u\n"),
nodehdr.forw);
bad++;
}
- if (bad) {
+ if (bad) {
do_warn(_("bad directory block in inode %" PRIu64 "\n"), cursor->ino);
return(1);
}
}
if (cursor->level[p_level].hashval !=
- be32_to_cpu(btree[entry].hashval)) {
- if (!no_modify) {
+ be32_to_cpu(btree[entry].hashval)) {
+ if (!no_modify) {
do_warn(
_("correcting bad hashval in non-leaf dir block\n"
"\tin (level %d) in inode %" PRIu64 ".\n"),
btree[entry].hashval = cpu_to_be32(
cursor->level[p_level].hashval);
cursor->level[this_level].dirty++;
- } else {
+ } else {
do_warn(
_("would correct bad hashval in non-leaf dir block\n"
"\tin (level %d) in inode %" PRIu64 ".\n"),
return(0);
}
/*
- * set hashvalue to correctl reflect the now-validated
+ * set hashvalue to correctly reflect the now-validated
* last entry in this block and continue upwards validation
*/
cursor->level[this_level].hashval = hashval;
* block and move on to the next block.
* and update cursor value for said level
*/
- if (entry >= nodehdr.count) {
+ if (entry >= nodehdr.count) {
/*
* update the hash value for this level before
* validating it. bno value should be ok since
dabno, cursor->ino);
bad++;
}
- if (nodehdr.back != cursor->level[this_level].bno) {
+ if (nodehdr.back != cursor->level[this_level].bno) {
do_warn(
_("bad back pointer in block %u for directory inode %" PRIu64 "\n"),
dabno, cursor->ino);
bad++;
}
- if (nodehdr.count > geo->node_ents) {
+ if (nodehdr.count > geo->node_ents) {
do_warn(
_("entry count %d too large in block %u for directory inode %" PRIu64 "\n"),
nodehdr.count,
dabno, cursor->ino);
bad++;
}
- if (nodehdr.level != this_level) {
+ if (nodehdr.level != this_level) {
do_warn(
_("bad level %d in block %u for directory inode %" PRIu64 "\n"),
nodehdr.level,
dabno, cursor->ino);
bad++;
}
- if (bad) {
+ if (bad) {
#ifdef XR_DIR_TRACE
fprintf(stderr, "verify_dir2_path returns 1 (bad) #4\n");
#endif
libxfs_writebuf(cursor->level[this_level].bp, 0);
else
libxfs_putbuf(cursor->level[this_level].bp);
+
+ /* switch cursor to point at the new buffer we just read */
cursor->level[this_level].bp = bp;
cursor->level[this_level].dirty = 0;
cursor->level[this_level].bno = dabno;
* block against the hashval in the current entry
*/
if (cursor->level[p_level].hashval !=
- be32_to_cpu(btree[entry].hashval)) {
- if (!no_modify) {
+ be32_to_cpu(btree[entry].hashval)) {
+ if (!no_modify) {
do_warn(
_("correcting bad hashval in interior dir block\n"
"\tin (level %d) in inode %" PRIu64 ".\n"),
btree[entry].hashval = cpu_to_be32(
cursor->level[p_level].hashval);
cursor->level[this_level].dirty++;
- } else {
+ } else {
do_warn(
_("would correct bad hashval in interior dir block\n"
"\tin (level %d) in inode %" PRIu64 ".\n"),