• Home
  • Raw
  • Download

Lines Matching refs:fs

69 static void print_header(struct filefrag_struct *fs)  in print_header()  argument
71 if (fs->options & VERBOSE_OPT) { in print_header()
72 fprintf(fs->f, "%4s %*s %*s %*s %*s\n", "ext", in print_header()
73 fs->logical_width, "logical", fs->physical_width, in print_header()
74 "physical", fs->physical_width, "expected", in print_header()
75 fs->logical_width, "length"); in print_header()
79 static void report_filefrag(struct filefrag_struct *fs) in report_filefrag() argument
81 if (fs->num == 0) in report_filefrag()
83 if (fs->options & VERBOSE_OPT) { in report_filefrag()
84 if (fs->expected) in report_filefrag()
85 fprintf(fs->f, "%4d %*lu %*llu %*llu %*lu\n", fs->ext, in report_filefrag()
86 fs->logical_width, in report_filefrag()
87 (unsigned long) fs->logical_start, in report_filefrag()
88 fs->physical_width, fs->physical_start, in report_filefrag()
89 fs->physical_width, fs->expected, in report_filefrag()
90 fs->logical_width, (unsigned long) fs->num); in report_filefrag()
92 fprintf(fs->f, "%4d %*lu %*llu %*s %*lu\n", fs->ext, in report_filefrag()
93 fs->logical_width, in report_filefrag()
94 (unsigned long) fs->logical_start, in report_filefrag()
95 fs->physical_width, fs->physical_start, in report_filefrag()
96 fs->physical_width, "", in report_filefrag()
97 fs->logical_width, (unsigned long) fs->num); in report_filefrag()
99 fs->ext++; in report_filefrag()
108 struct filefrag_struct *fs = private; in filefrag_blocks_proc() local
113 if ((fs->num == 0) || (blockcnt != fs->logical_start + fs->num) || in filefrag_blocks_proc()
114 (*blocknr != fs->physical_start + fs->num)) { in filefrag_blocks_proc()
115 report_filefrag(fs); in filefrag_blocks_proc()
116 if (blockcnt == fs->logical_start + fs->num) in filefrag_blocks_proc()
117 fs->expected = fs->physical_start + fs->num; in filefrag_blocks_proc()
119 fs->expected = 0; in filefrag_blocks_proc()
120 fs->logical_start = blockcnt; in filefrag_blocks_proc()
121 fs->physical_start = *blocknr; in filefrag_blocks_proc()
122 fs->num = 1; in filefrag_blocks_proc()
123 fs->cont_ext++; in filefrag_blocks_proc()
125 fs->num++; in filefrag_blocks_proc()
130 struct filefrag_struct *fs) in filefrag() argument
135 fs->logical_width = int_log10((EXT2_I_SIZE(inode) + blocksize - 1) / in filefrag()
137 if (fs->logical_width < 7) in filefrag()
138 fs->logical_width = 7; in filefrag()
139 fs->ext = 0; in filefrag()
140 fs->cont_ext = 0; in filefrag()
141 fs->logical_start = 0; in filefrag()
142 fs->physical_start = 0; in filefrag()
143 fs->num = 0; in filefrag()
145 if (fs->options & VERBOSE_OPT) { in filefrag()
152 fprintf(fs->f, "\n%s has %llu block(s), i_size is %llu\n", in filefrag()
153 fs->name, num_blocks, EXT2_I_SIZE(inode)); in filefrag()
155 print_header(fs); in filefrag()
159 filefrag_blocks_proc, fs); in filefrag()
164 report_filefrag(fs); in filefrag()
165 fprintf(fs->f, "%s: %d contiguous extents%s\n", fs->name, fs->ext, in filefrag()
177 struct filefrag_struct *fs = private; in filefrag_dir_proc() local
195 cp = malloc(strlen(fs->dir_name) + strlen(name) + 2); in filefrag_dir_proc()
198 fs->dir_name, name); in filefrag_dir_proc()
202 sprintf(cp, "%s/%s", fs->dir_name, name); in filefrag_dir_proc()
203 fs->name = cp; in filefrag_dir_proc()
205 if (debugfs_read_inode(ino, &inode, fs->name)) in filefrag_dir_proc()
208 filefrag(ino, &inode, fs); in filefrag_dir_proc()
210 if ((fs->options & RECURSIVE_OPT) && LINUX_S_ISDIR(inode.i_mode)) { in filefrag_dir_proc()
216 fs->name); in filefrag_dir_proc()
222 if (fs->dir_last) in filefrag_dir_proc()
223 fs->dir_last->next = p; in filefrag_dir_proc()
225 fs->dir_list = p; in filefrag_dir_proc()
226 fs->dir_last = p; in filefrag_dir_proc()
231 fs->name = 0; in filefrag_dir_proc()
236 static void dir_iterate(ext2_ino_t ino, struct filefrag_struct *fs) in dir_iterate() argument
241 fs->dir_name = fs->name; in dir_iterate()
245 0, filefrag_dir_proc, fs); in dir_iterate()
250 fs->dir_list = p->next; in dir_iterate()
251 if (!fs->dir_list) in dir_iterate()
252 fs->dir_last = 0; in dir_iterate()
255 p = fs->dir_list; in dir_iterate()
259 fs->dir_name = p->name; in dir_iterate()
266 struct filefrag_struct fs; in do_filefrag() local
271 memset(&fs, 0, sizeof(fs)); in do_filefrag()
279 fs.options |= DIR_OPT; in do_filefrag()
282 fs.options |= VERBOSE_OPT; in do_filefrag()
285 fs.options |= RECURSIVE_OPT; in do_filefrag()
300 fs.name = "."; in do_filefrag()
303 fs.name = argv[optind]; in do_filefrag()
311 fs.f = open_pager(); in do_filefrag()
312 fs.physical_width = int_log10(ext2fs_blocks_count(current_fs->super)); in do_filefrag()
313 fs.physical_width++; in do_filefrag()
314 if (fs.physical_width < 8) in do_filefrag()
315 fs.physical_width = 8; in do_filefrag()
317 if (!LINUX_S_ISDIR(inode.i_mode) || (fs.options & DIR_OPT)) in do_filefrag()
318 filefrag(ino, &inode, &fs); in do_filefrag()
320 dir_iterate(ino, &fs); in do_filefrag()
322 fprintf(fs.f, "\n"); in do_filefrag()
323 close_pager(fs.f); in do_filefrag()