]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - misc/e4defrag.c
e4defrag: adjust total count when files change during the run
[thirdparty/e2fsprogs.git] / misc / e4defrag.c
index 9d237da24ba2d5f1c610ea589e7bf3f4d8bce1b1..b0a825f3ef6a7b7c4e39afae5345d72aff0d0d31 100644 (file)
@@ -1055,6 +1055,8 @@ static int file_statistic(const char *file, const struct stat64 *buf,
        struct fiemap_extent_list *logical_list_head = NULL;
 
        defraged_file_count++;
+       if (defraged_file_count > total_count)
+               total_count = defraged_file_count;
 
        if (mode_flag & DETAIL) {
                if (total_count == 1 && regular_count == 1)
@@ -1421,6 +1423,8 @@ static int file_defrag(const char *file, const struct stat64 *buf,
        struct fiemap_extent_group      *orig_group_tmp = NULL;
 
        defraged_file_count++;
+       if (defraged_file_count > total_count)
+               total_count = defraged_file_count;
 
        if (mode_flag & DETAIL) {
                printf("[%u/%u]", defraged_file_count, total_count);