Lines Matching refs:fs

68 static void print_header(struct filefrag_struct *fs)
70 if (fs->options & VERBOSE_OPT) {
71 fprintf(fs->f, "%4s %*s %*s %*s %*s\n", "ext",
72 fs->logical_width, "logical", fs->physical_width,
73 "physical", fs->physical_width, "expected",
74 fs->logical_width, "length");
78 static void report_filefrag(struct filefrag_struct *fs)
80 if (fs->num == 0)
82 if (fs->options & VERBOSE_OPT) {
83 if (fs->expected)
84 fprintf(fs->f, "%4d %*lu %*llu %*llu %*lu\n", fs->ext,
85 fs->logical_width,
86 (unsigned long) fs->logical_start,
87 fs->physical_width, fs->physical_start,
88 fs->physical_width, fs->expected,
89 fs->logical_width, (unsigned long) fs->num);
91 fprintf(fs->f, "%4d %*lu %*llu %*s %*lu\n", fs->ext,
92 fs->logical_width,
93 (unsigned long) fs->logical_start,
94 fs->physical_width, fs->physical_start,
95 fs->physical_width, "",
96 fs->logical_width, (unsigned long) fs->num);
98 fs->ext++;
107 struct filefrag_struct *fs = private;
112 if ((fs->num == 0) || (blockcnt != fs->logical_start + fs->num) ||
113 (*blocknr != fs->physical_start + fs->num)) {
114 report_filefrag(fs);
115 if (blockcnt == fs->logical_start + fs->num)
116 fs->expected = fs->physical_start + fs->num;
118 fs->expected = 0;
119 fs->logical_start = blockcnt;
120 fs->physical_start = *blocknr;
121 fs->num = 1;
122 fs->cont_ext++;
124 fs->num++;
129 struct filefrag_struct *fs)
134 fs->logical_width = int_log10((EXT2_I_SIZE(inode) + blocksize - 1) /
136 if (fs->logical_width < 7)
137 fs->logical_width = 7;
138 fs->ext = 0;
139 fs->cont_ext = 0;
140 fs->logical_start = 0;
141 fs->physical_start = 0;
142 fs->num = 0;
144 if (fs->options & VERBOSE_OPT) {
152 fprintf(fs->f, "\n%s has %llu block(s), i_size is %llu\n",
153 fs->name, num_blocks, EXT2_I_SIZE(inode));
155 print_header(fs);
158 filefrag_blocks_proc, fs);
162 report_filefrag(fs);
163 fprintf(fs->f, "%s: %d contiguous extents%s\n", fs->name, fs->ext,
175 struct filefrag_struct *fs = private;
193 cp = malloc(strlen(fs->dir_name) + strlen(name) + 2);
196 fs->dir_name, name);
200 sprintf(cp, "%s/%s", fs->dir_name, name);
201 fs->name = cp;
203 if (debugfs_read_inode(ino, &inode, fs->name))
206 filefrag(ino, &inode, fs);
208 if ((fs->options & RECURSIVE_OPT) && LINUX_S_ISDIR(inode.i_mode)) {
214 fs->name);
220 if (fs->dir_last)
221 fs->dir_last->next = p;
223 fs->dir_list = p;
224 fs->dir_last = p;
229 fs->name = 0;
234 static void dir_iterate(ext2_ino_t ino, struct filefrag_struct *fs)
239 fs->dir_name = fs->name;
243 0, filefrag_dir_proc, fs);
248 fs->dir_list = p->next;
249 if (!fs->dir_list)
250 fs->dir_last = 0;
253 p = fs->dir_list;
257 fs->dir_name = p->name;
263 struct filefrag_struct fs;
268 memset(&fs, 0, sizeof(fs));
276 fs.options |= DIR_OPT;
279 fs.options |= VERBOSE_OPT;
282 fs.options |= RECURSIVE_OPT;
297 fs.name = ".";
300 fs.name = argv[optind];
308 fs.f = open_pager();
309 fs.physical_width = int_log10(ext2fs_blocks_count(current_fs->super));
310 fs.physical_width++;
311 if (fs.physical_width < 8)
312 fs.physical_width = 8;
314 if (!LINUX_S_ISDIR(inode.i_mode) || (fs.options & DIR_OPT))
315 filefrag(ino, &inode, &fs);
317 dir_iterate(ino, &fs);
319 fprintf(fs.f, "\n");
320 close_pager(fs.f);