if (fs->options & VERBOSE_OPT) {
blk64_t num_blocks = ext2fs_inode_i_blocks(current_fs, inode);
- if (!(current_fs->super->s_feature_ro_compat &
- EXT4_FEATURE_RO_COMPAT_HUGE_FILE) ||
+ if (!ext2fs_has_feature_huge_file(current_fs->super) ||
!(inode->i_flags & EXT4_HUGE_FILE_FL))
num_blocks /= current_fs->blocksize / 512;
fs->name, num_blocks, EXT2_I_SIZE(inode));
}
print_header(fs);
- retval = ext2fs_block_iterate3(current_fs, ino,
- BLOCK_FLAG_READ_ONLY, NULL,
- filefrag_blocks_proc, fs);
- if (retval)
- com_err("ext2fs_block_iterate3", retval, 0);
+ if (ext2fs_inode_has_valid_blocks2(current_fs, inode)) {
+ retval = ext2fs_block_iterate3(current_fs, ino,
+ BLOCK_FLAG_READ_ONLY, NULL,
+ filefrag_blocks_proc, fs);
+ if (retval)
+ com_err("ext2fs_block_iterate3", retval, 0);
+ }
report_filefrag(fs);
fprintf(fs->f, "%s: %d contiguous extents%s\n", fs->name, fs->ext,
}
}
-void do_filefrag(int argc, char *argv[])
+void do_filefrag(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+ void *infop EXT2FS_ATTR((unused)))
{
struct filefrag_struct fs;
struct ext2_inode inode;
if (argc > optind+1) {
print_usage:
- com_err(0, 0, "Usage: filefrag [-dv] file");
+ com_err(0, 0, "Usage: filefrag [-dvr] file");
return;
}