2 * Test to see how quickly we can scan the inode table (not doing
21 #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(NOARGS)
44 _("Usage: %s [-F] [-I inode_buffer_blocks] device\n"),
49 static void PRS(int argc, char *argv[])
54 extern void *mallwatch;
59 initialize_ext2_error_table();
63 while ((c = getopt (argc, argv, "FI")) != EOF)
69 fprintf(stderr, _("-F not supported"));
74 inode_buffer_blocks = atoi(optarg);
79 device_name = argv[optind];
82 int fd = open(device_name, O_RDONLY, 0);
85 com_err("open", errno,
86 _("while opening %s for flushing"), device_name);
89 if (ioctl(fd, BLKFLSBUF, 0) < 0) {
90 com_err("BLKFLSBUF", errno,
91 _("while trying to flush %s"), device_name);
96 fprintf(stderr, _("BLKFLSBUF not supported"));
98 #endif /* BLKFLSBUF */
102 int main (int argc, char *argv[])
104 errcode_t retval = 0;
105 int exit_value = FSCK_OK;
109 struct ext2_inode inode;
110 ext2_inode_scan scan;
112 init_resource_track(&global_rtrack);
116 retval = ext2fs_open(device_name, 0,
117 0, 0, unix_io_manager, &fs);
119 com_err(program_name, retval, _("while trying to open %s"),
124 ehandler_init(fs->io);
126 retval = ext2fs_open_inode_scan(fs, inode_buffer_blocks, &scan);
128 com_err(program_name, retval, _("while opening inode scan"));
133 retval = ext2fs_get_next_inode(scan, &ino, &inode);
135 com_err(program_name, retval,
136 _("while getting next inode"));
144 print_resource_track(NULL, &global_rtrack);
145 printf(_("%d inodes scanned.\n"), num_inodes);