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(void)
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 inode_buffer_blocks
= atoi(optarg
);
74 device_name
= argv
[optind
];
76 int fd
= open(device_name
, O_RDONLY
, 0);
79 com_err("open", errno
,
80 _("while opening %s for flushing"), device_name
);
83 if ((retval
= ext2fs_sync_device(fd
, 1))) {
84 com_err("ext2fs_sync_device", retval
,
85 _("while trying to flush %s"), device_name
);
92 int main (int argc
, char *argv
[])
95 int exit_value
= FSCK_OK
;
99 struct ext2_inode inode
;
100 ext2_inode_scan scan
;
102 init_resource_track(&global_rtrack
);
106 retval
= ext2fs_open(device_name
, 0,
107 0, 0, unix_io_manager
, &fs
);
109 com_err(program_name
, retval
, _("while trying to open %s"),
114 ehandler_init(fs
->io
);
116 retval
= ext2fs_open_inode_scan(fs
, inode_buffer_blocks
, &scan
);
118 com_err(program_name
, retval
, _("while opening inode scan"));
123 retval
= ext2fs_get_next_inode(scan
, &ino
, &inode
);
125 com_err(program_name
, retval
,
126 _("while getting next inode"));
134 print_resource_track(NULL
, &global_rtrack
);
135 printf(_("%d inodes scanned.\n"), num_inodes
);