2 * rehash.c --- rebuild hash tree directories
4 * Copyright (C) 2002 Theodore Ts'o
7 * This file may be redistributed under the terms of the GNU Public
11 * This algorithm is designed for simplicity of implementation and to
12 * pack the directory as much as possible. It however requires twice
13 * as much memory as the size of the directory. The maximum size
14 * directory supported using a 4k blocksize is roughly a gigabyte, and
15 * so there may very well be problems with machines that don't have
16 * virtual memory, and obscenely large directories.
18 * An alternate algorithm which is much more disk intensive could be
19 * written, and probably will need to be written in the future. The
20 * design goals of such an algorithm are: (a) use (roughly) constant
21 * amounts of memory, no matter how large the directory, (b) the
22 * directory must be safe at all times, even if e2fsck is interrupted
23 * in the middle, (c) we must use minimal amounts of extra disk
24 * blocks. This pretty much requires an incremental approach, where
25 * we are reading from one part of the directory, and inserting into
26 * the front half. So the algorithm will have to keep track of a
27 * moving block boundary between the new tree and the old tree, and
28 * files will need to be moved from the old directory and inserted
29 * into the new tree. If the new directory requires space which isn't
30 * yet available, blocks from the beginning part of the old directory
31 * may need to be moved to the end of the directory to make room for
34 * --------------------------------------------------------
35 * | new tree | | old tree |
36 * --------------------------------------------------------
40 * This is going to be a pain in the tuckus to implement, and will
41 * require a lot more disk accesses. So I'm going to skip it for now;
42 * it's only really going to be an issue for really, really big
43 * filesystems (when we reach the level of tens of millions of files
44 * in a single directory). It will probably be easier to simply
45 * require that e2fsck use VM first.
57 struct fill_dir_struct
{
59 struct ext2_inode
*inode
;
63 struct hash_entry
*harray
;
64 int max_array
, num_array
;
65 unsigned int dir_size
;
72 ext2_dirhash_t minor_hash
;
74 struct ext2_dir_entry
*dir
;
81 ext2_dirhash_t
*hashes
;
84 static int fill_dir_block(ext2_filsys fs
,
87 blk64_t ref_block
EXT2FS_ATTR((unused
)),
88 int ref_offset
EXT2FS_ATTR((unused
)),
91 struct fill_dir_struct
*fd
= (struct fill_dir_struct
*) priv_data
;
92 struct hash_entry
*new_array
, *ent
;
93 struct ext2_dir_entry
*dirent
;
95 unsigned int offset
, dir_offset
, rec_len
;
101 offset
= blockcnt
* fs
->blocksize
;
102 if (offset
+ fs
->blocksize
> fd
->inode
->i_size
) {
103 fd
->err
= EXT2_ET_DIR_CORRUPTED
;
106 dir
= (fd
->buf
+offset
);
107 if (HOLE_BLKADDR(*block_nr
)) {
108 memset(dir
, 0, fs
->blocksize
);
109 dirent
= (struct ext2_dir_entry
*) dir
;
110 (void) ext2fs_set_rec_len(fs
, fs
->blocksize
, dirent
);
112 fd
->err
= ext2fs_read_dir_block3(fs
, *block_nr
, dir
, 0);
116 hash_alg
= fs
->super
->s_def_hash_version
;
117 if ((hash_alg
<= EXT2_HASH_TEA
) &&
118 (fs
->super
->s_flags
& EXT2_FLAGS_UNSIGNED_HASH
))
120 /* While the directory block is "hot", index it. */
122 while (dir_offset
< fs
->blocksize
) {
123 dirent
= (struct ext2_dir_entry
*) (dir
+ dir_offset
);
124 (void) ext2fs_get_rec_len(fs
, dirent
, &rec_len
);
125 if (((dir_offset
+ rec_len
) > fs
->blocksize
) ||
127 ((rec_len
% 4) != 0) ||
128 (((dirent
->name_len
& 0xFF)+8U) > rec_len
)) {
129 fd
->err
= EXT2_ET_DIR_CORRUPTED
;
132 dir_offset
+= rec_len
;
133 if (dirent
->inode
== 0)
135 if (!fd
->compress
&& ((dirent
->name_len
&0xFF) == 1) &&
136 (dirent
->name
[0] == '.'))
138 if (!fd
->compress
&& ((dirent
->name_len
&0xFF) == 2) &&
139 (dirent
->name
[0] == '.') && (dirent
->name
[1] == '.')) {
140 fd
->parent
= dirent
->inode
;
143 if (fd
->num_array
>= fd
->max_array
) {
144 new_array
= realloc(fd
->harray
,
145 sizeof(struct hash_entry
) * (fd
->max_array
+500));
150 fd
->harray
= new_array
;
151 fd
->max_array
+= 500;
153 ent
= fd
->harray
+ fd
->num_array
++;
155 fd
->dir_size
+= EXT2_DIR_REC_LEN(dirent
->name_len
& 0xFF);
156 ent
->ino
= dirent
->inode
;
158 ent
->hash
= ent
->minor_hash
= 0;
160 fd
->err
= ext2fs_dirhash(hash_alg
, dirent
->name
,
161 dirent
->name_len
& 0xFF,
162 fs
->super
->s_hash_seed
,
163 &ent
->hash
, &ent
->minor_hash
);
172 /* Used for sorting the hash entry */
173 static EXT2_QSORT_TYPE
ino_cmp(const void *a
, const void *b
)
175 const struct hash_entry
*he_a
= (const struct hash_entry
*) a
;
176 const struct hash_entry
*he_b
= (const struct hash_entry
*) b
;
178 return (he_a
->ino
- he_b
->ino
);
181 /* Used for sorting the hash entry */
182 static EXT2_QSORT_TYPE
name_cmp(const void *a
, const void *b
)
184 const struct hash_entry
*he_a
= (const struct hash_entry
*) a
;
185 const struct hash_entry
*he_b
= (const struct hash_entry
*) b
;
189 min_len
= he_a
->dir
->name_len
;
190 if (min_len
> he_b
->dir
->name_len
)
191 min_len
= he_b
->dir
->name_len
;
193 ret
= strncmp(he_a
->dir
->name
, he_b
->dir
->name
, min_len
);
195 if (he_a
->dir
->name_len
> he_b
->dir
->name_len
)
197 else if (he_a
->dir
->name_len
< he_b
->dir
->name_len
)
200 ret
= he_b
->dir
->inode
- he_a
->dir
->inode
;
205 /* Used for sorting the hash entry */
206 static EXT2_QSORT_TYPE
hash_cmp(const void *a
, const void *b
)
208 const struct hash_entry
*he_a
= (const struct hash_entry
*) a
;
209 const struct hash_entry
*he_b
= (const struct hash_entry
*) b
;
212 if (he_a
->hash
> he_b
->hash
)
214 else if (he_a
->hash
< he_b
->hash
)
217 if (he_a
->minor_hash
> he_b
->minor_hash
)
219 else if (he_a
->minor_hash
< he_b
->minor_hash
)
222 ret
= name_cmp(a
, b
);
227 static errcode_t
alloc_size_dir(ext2_filsys fs
, struct out_dir
*outdir
,
233 new_mem
= realloc(outdir
->buf
, blocks
* fs
->blocksize
);
236 outdir
->buf
= new_mem
;
237 new_mem
= realloc(outdir
->hashes
,
238 blocks
* sizeof(ext2_dirhash_t
));
241 outdir
->hashes
= new_mem
;
243 outdir
->buf
= malloc(blocks
* fs
->blocksize
);
244 outdir
->hashes
= malloc(blocks
* sizeof(ext2_dirhash_t
));
247 outdir
->max
= blocks
;
251 static void free_out_dir(struct out_dir
*outdir
)
254 free(outdir
->hashes
);
259 static errcode_t
get_next_block(ext2_filsys fs
, struct out_dir
*outdir
,
264 if (outdir
->num
>= outdir
->max
) {
265 retval
= alloc_size_dir(fs
, outdir
, outdir
->max
+ 50);
269 *ret
= outdir
->buf
+ (outdir
->num
++ * fs
->blocksize
);
270 memset(*ret
, 0, fs
->blocksize
);
275 * This function is used to make a unique filename. We do this by
276 * appending ~0, and then incrementing the number. However, we cannot
277 * expand the length of the filename beyond the padding available in
278 * the directory entry.
280 static void mutate_name(char *str
, __u16
*len
)
283 __u16 l
= *len
& 0xFF, h
= *len
& 0xff00;
286 * First check to see if it looks the name has been mutated
289 for (i
= l
-1; i
> 0; i
--) {
290 if (!isdigit(str
[i
]))
293 if ((i
== l
-1) || (str
[i
] != '~')) {
303 for (i
= l
-1; i
>= 0; i
--) {
304 if (isdigit(str
[i
])) {
316 else if (str
[0] == 'Z') {
334 static int duplicate_search_and_fix(e2fsck_t ctx
, ext2_filsys fs
,
336 struct fill_dir_struct
*fd
)
338 struct problem_context pctx
;
339 struct hash_entry
*ent
, *prev
;
346 clear_problem_context(&pctx
);
349 hash_alg
= fs
->super
->s_def_hash_version
;
350 if ((hash_alg
<= EXT2_HASH_TEA
) &&
351 (fs
->super
->s_flags
& EXT2_FLAGS_UNSIGNED_HASH
))
354 for (i
=1; i
< fd
->num_array
; i
++) {
355 ent
= fd
->harray
+ i
;
357 if (!ent
->dir
->inode
||
358 ((ent
->dir
->name_len
& 0xFF) !=
359 (prev
->dir
->name_len
& 0xFF)) ||
360 (strncmp(ent
->dir
->name
, prev
->dir
->name
,
361 ent
->dir
->name_len
& 0xFF)))
363 pctx
.dirent
= ent
->dir
;
364 if ((ent
->dir
->inode
== prev
->dir
->inode
) &&
365 fix_problem(ctx
, PR_2_DUPLICATE_DIRENT
, &pctx
)) {
366 e2fsck_adjust_inode_count(ctx
, ent
->dir
->inode
, -1);
371 memcpy(new_name
, ent
->dir
->name
, ent
->dir
->name_len
& 0xFF);
372 new_len
= ent
->dir
->name_len
;
373 mutate_name(new_name
, &new_len
);
374 for (j
=0; j
< fd
->num_array
; j
++) {
377 (fd
->harray
[j
].dir
->name_len
& 0xFF)) ||
378 (strncmp(new_name
, fd
->harray
[j
].dir
->name
,
381 mutate_name(new_name
, &new_len
);
385 new_name
[new_len
& 0xFF] = 0;
387 if (fix_problem(ctx
, PR_2_NON_UNIQUE_FILE
, &pctx
)) {
388 memcpy(ent
->dir
->name
, new_name
, new_len
& 0xFF);
389 ent
->dir
->name_len
= new_len
;
390 ext2fs_dirhash(hash_alg
, ent
->dir
->name
,
391 ent
->dir
->name_len
& 0xFF,
392 fs
->super
->s_hash_seed
,
393 &ent
->hash
, &ent
->minor_hash
);
401 static errcode_t
copy_dir_entries(e2fsck_t ctx
,
402 struct fill_dir_struct
*fd
,
403 struct out_dir
*outdir
)
405 ext2_filsys fs
= ctx
->fs
;
408 struct hash_entry
*ent
;
409 struct ext2_dir_entry
*dirent
;
410 unsigned int rec_len
, prev_rec_len
, left
, slack
, offset
;
412 ext2_dirhash_t prev_hash
;
414 if (ctx
->htree_slack_percentage
== 255) {
415 profile_get_uint(ctx
->profile
, "options",
416 "indexed_dir_slack_percentage",
418 &ctx
->htree_slack_percentage
);
419 if (ctx
->htree_slack_percentage
> 100)
420 ctx
->htree_slack_percentage
= 20;
424 retval
= alloc_size_dir(fs
, outdir
,
425 (fd
->dir_size
/ fs
->blocksize
) + 2);
428 outdir
->num
= fd
->compress
? 0 : 1;
430 outdir
->hashes
[0] = 0;
432 if ((retval
= get_next_block(fs
, outdir
, &block_start
)))
434 dirent
= (struct ext2_dir_entry
*) block_start
;
437 left
= fs
->blocksize
;
438 slack
= fd
->compress
? 12 :
439 (fs
->blocksize
* ctx
->htree_slack_percentage
)/100;
442 for (i
= 0; i
< fd
->num_array
; i
++) {
443 ent
= fd
->harray
+ i
;
444 if (ent
->dir
->inode
== 0)
446 rec_len
= EXT2_DIR_REC_LEN(ent
->dir
->name_len
& 0xFF);
447 if (rec_len
> left
) {
449 left
+= prev_rec_len
;
450 retval
= ext2fs_set_rec_len(fs
, left
, dirent
);
454 if ((retval
= get_next_block(fs
, outdir
,
459 left
= fs
->blocksize
- offset
;
460 dirent
= (struct ext2_dir_entry
*) (block_start
+ offset
);
462 if (ent
->hash
== prev_hash
)
463 outdir
->hashes
[outdir
->num
-1] = ent
->hash
| 1;
465 outdir
->hashes
[outdir
->num
-1] = ent
->hash
;
467 dirent
->inode
= ent
->dir
->inode
;
468 dirent
->name_len
= ent
->dir
->name_len
;
469 retval
= ext2fs_set_rec_len(fs
, rec_len
, dirent
);
472 prev_rec_len
= rec_len
;
473 memcpy(dirent
->name
, ent
->dir
->name
, dirent
->name_len
& 0xFF);
477 prev_rec_len
+= left
;
478 retval
= ext2fs_set_rec_len(fs
, prev_rec_len
, dirent
);
484 prev_hash
= ent
->hash
;
487 retval
= ext2fs_set_rec_len(fs
, rec_len
+ left
, dirent
);
493 static struct ext2_dx_root_info
*set_root_node(ext2_filsys fs
, char *buf
,
494 ext2_ino_t ino
, ext2_ino_t parent
)
496 struct ext2_dir_entry
*dir
;
497 struct ext2_dx_root_info
*root
;
498 struct ext2_dx_countlimit
*limits
;
501 if (fs
->super
->s_feature_incompat
& EXT2_FEATURE_INCOMPAT_FILETYPE
)
502 filetype
= EXT2_FT_DIR
<< 8;
504 memset(buf
, 0, fs
->blocksize
);
505 dir
= (struct ext2_dir_entry
*) buf
;
508 dir
->name_len
= 1 | filetype
;
510 dir
= (struct ext2_dir_entry
*) (buf
+ 12);
514 dir
->name_len
= 2 | filetype
;
515 dir
->rec_len
= fs
->blocksize
- 12;
517 root
= (struct ext2_dx_root_info
*) (buf
+24);
518 root
->reserved_zero
= 0;
519 root
->hash_version
= fs
->super
->s_def_hash_version
;
520 root
->info_length
= 8;
521 root
->indirect_levels
= 0;
522 root
->unused_flags
= 0;
524 limits
= (struct ext2_dx_countlimit
*) (buf
+32);
525 limits
->limit
= (fs
->blocksize
- 32) / sizeof(struct ext2_dx_entry
);
532 static struct ext2_dx_entry
*set_int_node(ext2_filsys fs
, char *buf
)
534 struct ext2_dir_entry
*dir
;
535 struct ext2_dx_countlimit
*limits
;
537 memset(buf
, 0, fs
->blocksize
);
538 dir
= (struct ext2_dir_entry
*) buf
;
540 (void) ext2fs_set_rec_len(fs
, fs
->blocksize
, dir
);
542 limits
= (struct ext2_dx_countlimit
*) (buf
+8);
543 limits
->limit
= (fs
->blocksize
- 8) / sizeof(struct ext2_dx_entry
);
546 return (struct ext2_dx_entry
*) limits
;
550 * This function takes the leaf nodes which have been written in
551 * outdir, and populates the root node and any necessary interior nodes.
553 static errcode_t
calculate_tree(ext2_filsys fs
,
554 struct out_dir
*outdir
,
558 struct ext2_dx_root_info
*root_info
;
559 struct ext2_dx_entry
*root
, *dx_ent
= 0;
560 struct ext2_dx_countlimit
*root_limit
, *limit
;
563 int i
, c1
, c2
, nblks
;
564 int limit_offset
, root_offset
;
566 root_info
= set_root_node(fs
, outdir
->buf
, ino
, parent
);
567 root_offset
= limit_offset
= ((char *) root_info
- outdir
->buf
) +
568 root_info
->info_length
;
569 root_limit
= (struct ext2_dx_countlimit
*) (outdir
->buf
+ limit_offset
);
570 c1
= root_limit
->limit
;
573 /* Write out the pointer blocks */
575 /* Just write out the root block, and we're done */
576 root
= (struct ext2_dx_entry
*) (outdir
->buf
+ root_offset
);
577 for (i
=1; i
< nblks
; i
++) {
578 root
->block
= ext2fs_cpu_to_le32(i
);
581 ext2fs_cpu_to_le32(outdir
->hashes
[i
]);
588 root_info
->indirect_levels
= 1;
589 for (i
=1; i
< nblks
; i
++) {
594 limit
->limit
= limit
->count
=
595 ext2fs_cpu_to_le16(limit
->limit
);
596 root
= (struct ext2_dx_entry
*)
597 (outdir
->buf
+ root_offset
);
598 root
->block
= ext2fs_cpu_to_le32(outdir
->num
);
601 ext2fs_cpu_to_le32(outdir
->hashes
[i
]);
602 if ((retval
= get_next_block(fs
, outdir
,
605 dx_ent
= set_int_node(fs
, block_start
);
606 limit
= (struct ext2_dx_countlimit
*) dx_ent
;
608 root_offset
+= sizeof(struct ext2_dx_entry
);
611 dx_ent
->block
= ext2fs_cpu_to_le32(i
);
612 if (c2
!= limit
->limit
)
614 ext2fs_cpu_to_le32(outdir
->hashes
[i
]);
618 limit
->count
= ext2fs_cpu_to_le16(limit
->limit
- c2
);
619 limit
->limit
= ext2fs_cpu_to_le16(limit
->limit
);
621 root_limit
= (struct ext2_dx_countlimit
*) (outdir
->buf
+ limit_offset
);
622 root_limit
->count
= ext2fs_cpu_to_le16(root_limit
->limit
- c1
);
623 root_limit
->limit
= ext2fs_cpu_to_le16(root_limit
->limit
);
628 struct write_dir_struct
{
629 struct out_dir
*outdir
;
636 * Helper function which writes out a directory block.
638 static int write_dir_block(ext2_filsys fs
,
640 e2_blkcnt_t blockcnt
,
641 blk64_t ref_block
EXT2FS_ATTR((unused
)),
642 int ref_offset
EXT2FS_ATTR((unused
)),
645 struct write_dir_struct
*wd
= (struct write_dir_struct
*) priv_data
;
650 printf("%u: write_dir_block %lld:%lld", wd
->ino
, blockcnt
, *block_nr
);
652 if (*block_nr
== 0) {
658 /* Don't free blocks at the end of the directory, they will be
659 * truncated by the caller. */
660 if (blockcnt
>= wd
->outdir
->num
) {
662 printf(" - not freed\n");
673 dir
= wd
->outdir
->buf
+ (blockcnt
* fs
->blocksize
);
674 wd
->err
= ext2fs_write_dir_block3(fs
, *block_nr
, dir
, 0);
676 printf(" - write (%d)\n", wd
->err
);
683 static errcode_t
write_directory(e2fsck_t ctx
, ext2_filsys fs
,
684 struct out_dir
*outdir
,
685 ext2_ino_t ino
, int compress
)
687 struct write_dir_struct wd
;
689 struct ext2_inode inode
;
691 retval
= e2fsck_expand_directory(ctx
, ino
, -1, outdir
->num
);
700 retval
= ext2fs_block_iterate3(fs
, ino
, 0, NULL
,
701 write_dir_block
, &wd
);
707 e2fsck_read_inode(ctx
, ino
, &inode
, "rehash_dir");
709 inode
.i_flags
&= ~EXT2_INDEX_FL
;
711 inode
.i_flags
|= EXT2_INDEX_FL
;
713 printf("%u: set inode size to %u blocks = %u bytes\n",
714 ino
, outdir
->num
, outdir
->num
* fs
->blocksize
);
716 retval
= ext2fs_inode_size_set(fs
, &inode
, (ext2_off64_t
)outdir
->num
*
721 /* ext2fs_punch() calls ext2fs_write_inode() which writes the size */
722 return ext2fs_punch(fs
, ino
, &inode
, NULL
, outdir
->num
, ~0ULL);
725 errcode_t
e2fsck_rehash_dir(e2fsck_t ctx
, ext2_ino_t ino
)
727 ext2_filsys fs
= ctx
->fs
;
729 struct ext2_inode inode
;
731 struct fill_dir_struct fd
= { NULL
};
732 struct out_dir outdir
= { 0 };
734 e2fsck_read_inode(ctx
, ino
, &inode
, "rehash_dir");
737 dir_buf
= malloc(inode
.i_size
);
741 fd
.max_array
= inode
.i_size
/ 32;
742 fd
.harray
= malloc(fd
.max_array
* sizeof(struct hash_entry
));
750 if (!(fs
->super
->s_feature_compat
& EXT2_FEATURE_COMPAT_DIR_INDEX
) ||
751 (inode
.i_size
/ fs
->blocksize
) < 2)
756 /* Read in the entire directory into memory */
757 retval
= ext2fs_block_iterate3(fs
, ino
, 0, 0,
758 fill_dir_block
, &fd
);
765 * If the entries read are less than a block, then don't index
768 if (!fd
.compress
&& (fd
.dir_size
< (fs
->blocksize
- 24))) {
776 printf("%d entries (%d bytes) found in inode %d\n",
777 fd
.num_array
, fd
.dir_size
, ino
);
782 if (fd
.compress
&& fd
.num_array
> 1)
783 qsort(fd
.harray
+2, fd
.num_array
-2, sizeof(struct hash_entry
),
786 qsort(fd
.harray
, fd
.num_array
, sizeof(struct hash_entry
),
790 * Look for duplicates
792 if (duplicate_search_and_fix(ctx
, fs
, ino
, &fd
))
795 if (ctx
->options
& E2F_OPT_NO
) {
800 /* Sort non-hashed directories by inode number */
801 if (fd
.compress
&& fd
.num_array
> 1)
802 qsort(fd
.harray
+2, fd
.num_array
-2,
803 sizeof(struct hash_entry
), ino_cmp
);
806 * Copy the directory entries. In a htree directory these
807 * will become the leaf nodes.
809 retval
= copy_dir_entries(ctx
, &fd
, &outdir
);
813 free(dir_buf
); dir_buf
= 0;
816 /* Calculate the interior nodes */
817 retval
= calculate_tree(fs
, &outdir
, ino
, fd
.parent
);
822 retval
= write_directory(ctx
, fs
, &outdir
, ino
, fd
.compress
);
830 free_out_dir(&outdir
);
834 void e2fsck_rehash_directories(e2fsck_t ctx
)
836 struct problem_context pctx
;
837 #ifdef RESOURCE_TRACK
838 struct resource_track rtrack
;
840 struct dir_info
*dir
;
841 ext2_u32_iterate iter
;
842 struct dir_info_iter
* dirinfo_iter
= 0;
845 int cur
, max
, all_dirs
, first
= 1;
847 init_resource_track(&rtrack
, ctx
->fs
->io
);
848 all_dirs
= ctx
->options
& E2F_OPT_COMPRESS_DIRS
;
850 if (!ctx
->dirs_to_hash
&& !all_dirs
)
853 e2fsck_get_lost_and_found(ctx
, 0);
855 clear_problem_context(&pctx
);
859 dirinfo_iter
= e2fsck_dir_info_iter_begin(ctx
);
860 max
= e2fsck_get_num_dirinfo(ctx
);
862 retval
= ext2fs_u32_list_iterate_begin(ctx
->dirs_to_hash
,
865 pctx
.errcode
= retval
;
866 fix_problem(ctx
, PR_3A_OPTIMIZE_ITER
, &pctx
);
869 max
= ext2fs_u32_list_count(ctx
->dirs_to_hash
);
873 if ((dir
= e2fsck_dir_info_iter(ctx
,
878 if (!ext2fs_u32_list_iterate(iter
, &ino
))
881 if (ino
== ctx
->lost_and_found
)
885 fix_problem(ctx
, PR_3A_PASS_HEADER
, &pctx
);
889 fix_problem(ctx
, PR_3A_OPTIMIZE_DIR
, &pctx
);
891 pctx
.errcode
= e2fsck_rehash_dir(ctx
, ino
);
893 end_problem_latch(ctx
, PR_LATCH_OPTIMIZE_DIR
);
894 fix_problem(ctx
, PR_3A_OPTIMIZE_DIR_ERR
, &pctx
);
896 if (ctx
->progress
&& !ctx
->progress_fd
)
897 e2fsck_simple_progress(ctx
, "Rebuilding directory",
898 100.0 * (float) (++cur
) / (float) max
, ino
);
900 end_problem_latch(ctx
, PR_LATCH_OPTIMIZE_DIR
);
902 e2fsck_dir_info_iter_end(ctx
, dirinfo_iter
);
904 ext2fs_u32_list_iterate_end(iter
);
906 if (ctx
->dirs_to_hash
)
907 ext2fs_u32_list_free(ctx
->dirs_to_hash
);
908 ctx
->dirs_to_hash
= 0;
910 print_resource_track(ctx
, "Pass 3A", &rtrack
, ctx
->fs
->io
);