Whamcloud - gitweb
ChangeLog:
[tools/e2fsprogs.git] / debugfs / ncheck.c
index b5298c2..83fe9b5 100644 (file)
@@ -92,13 +92,15 @@ void do_ncheck(int argc, char **argv)
 
        iw.num_inodes = iw.inodes_left = argc-1;
 
-       retval = ext2fs_open_inode_scan(fs, 0, &scan);
+       retval = ext2fs_open_inode_scan(current_fs, 0, &scan);
        if (retval) {
                com_err("ncheck", retval, "while opening inode scan");
                goto error_out;
        }
 
-       retval = ext2fs_get_next_inode(scan, &ino, &inode);
+       do {
+               retval = ext2fs_get_next_inode(scan, &ino, &inode);
+       } while (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE);
        if (retval) {
                com_err("ncheck", retval, "while starting inode scan");
                goto error_out;
@@ -120,7 +122,7 @@ void do_ncheck(int argc, char **argv)
                iw.position = 0;
                iw.parent = ino;
                
-               retval = ext2fs_dir_iterate(fs, ino, 0, 0,
+               retval = ext2fs_dir_iterate(current_fs, ino, 0, 0,
                                            ncheck_proc, &iw);
                if (retval) {
                        com_err("ncheck", retval,
@@ -132,7 +134,10 @@ void do_ncheck(int argc, char **argv)
                        break;
 
        next:
-               retval = ext2fs_get_next_inode(scan, &ino, &inode);
+               do {
+                       retval = ext2fs_get_next_inode(scan, &ino, &inode);
+               } while (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE);
+
                if (retval) {
                        com_err("ncheck", retval,
                                "while doing inode scan");
@@ -143,7 +148,7 @@ void do_ncheck(int argc, char **argv)
        for (i=0, iinfo = iw.iarray; i < iw.num_inodes; i++, iinfo++) {
                if (iinfo->parent == 0)
                        continue;
-               retval = ext2fs_get_pathname(fs, iinfo->parent,
+               retval = ext2fs_get_pathname(current_fs, iinfo->parent,
                                             iinfo->ino, &iinfo->pathname);
                if (retval)
                        com_err("ncheck", retval,