From: Theodore Ts'o Date: Sat, 7 Mar 2020 18:13:55 +0000 (-0500) Subject: Merge branch 'maint' into next X-Git-Tag: v1.46.0~71 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=b84a5568c7421f494ecd9fe474df6754004df05c;p=tools%2Fe2fsprogs.git Merge branch 'maint' into next --- b84a5568c7421f494ecd9fe474df6754004df05c diff --cc misc/filefrag.c index c845bec,032535f..6308bc6 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@@ -53,9 -53,8 +53,9 @@@ extern int optind #include int verbose = 0; - int blocksize; /* Use specified blocksize (default 1kB) */ + unsigned int blocksize; /* Use specified blocksize (default 1kB) */ int sync_file = 0; /* fsync file before getting the mapping */ +int precache_file = 0; /* precache the file before getting the mapping */ int xattr_map = 0; /* get xattr mapping */ int force_bmap; /* force use of FIBMAP instead of FIEMAP */ int force_extent; /* print output in extent format always */ @@@ -478,20 -458,15 +478,20 @@@ static int frag_report(const char *file numblocks = (st.st_size + blksize - 1) / blksize; if (blocksize != 0) - blk_shift = int_log2(blocksize); + blk_shift = ulong_log2(blocksize); else - blk_shift = int_log2(blksize); + blk_shift = ulong_log2(blksize); - width = ulong_log10(numblocks); + if (use_extent_cache) + width = 10; + else - width = int_log10(numblocks); ++ width = ulong_log10(numblocks); if (width > logical_width) logical_width = width; - if (verbose) - printf("File size of %s is %llu (%llu block%s of %d bytes)\n", + if (verbose) { + __u32 state; + + printf("File size of %s is %llu (%llu block%s of %d bytes)", filename, (unsigned long long)st.st_size, numblocks * blksize >> blk_shift, numblocks == 1 ? "" : "s", 1 << blk_shift); @@@ -558,7 -517,7 +558,7 @@@ out_close static void usage(const char *progname) { - fprintf(stderr, "Usage: %s [-b{blocksize}] [-BeEksvxX] file ...\n", - fprintf(stderr, "Usage: %s [-b{blocksize}[KMG]] [-BeksvxX] file ...\n", ++ fprintf(stderr, "Usage: %s [-b{blocksize}[KMG]] [-BeEksvxX] file ...\n", progname); exit(1); }