2 * Test to see how quickly we can scan the inode table (not doing
19 #include <sys/ioctl.h>
24 #include "et/com_err.h"
26 #include "../version.h"
28 extern int isatty(int);
30 const char * program_name = "iscan";
31 const char * device_name = NULL;
36 int inode_buffer_blocks = 0;
37 int invalid_bitmaps = 0;
39 struct resource_track global_rtrack;
41 static void usage(void)
44 _("Usage: %s [-F] [-I inode_buffer_blocks] device\n"),
49 static void PRS(int argc, char *argv[])
54 extern void *mallwatch;
60 initialize_ext2_error_table();
64 while ((c = getopt (argc, argv, "FI")) != EOF)
70 inode_buffer_blocks = atoi(optarg);
75 device_name = argv[optind];
77 int fd = open(device_name, O_RDONLY, 0);
80 com_err("open", errno,
81 _("while opening %s for flushing"), device_name);
84 if ((retval = ext2fs_sync_device(fd, 1))) {
85 com_err("ext2fs_sync_device", retval,
86 _("while trying to flush %s"), device_name);
93 int main (int argc, char *argv[])
96 int exit_value = FSCK_OK;
100 struct ext2_inode inode;
101 ext2_inode_scan scan;
103 init_resource_track(&global_rtrack);
107 retval = ext2fs_open(device_name, 0,
108 0, 0, unix_io_manager, &fs);
110 com_err(program_name, retval, _("while trying to open '%s'"),
115 ehandler_init(fs->io);
117 retval = ext2fs_open_inode_scan(fs, inode_buffer_blocks, &scan);
119 com_err(program_name, retval, _("while opening inode scan"));
124 retval = ext2fs_get_next_inode(scan, &ino, &inode);
126 com_err(program_name, retval,
127 _("while getting next inode"));
135 print_resource_track(NULL, &global_rtrack);
136 printf(_("%u inodes scanned.\n"), num_inodes);