diff options
author | Theodore Ts'o <tytso@mit.edu> | 2006-04-22 04:49:09 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2006-04-22 04:49:09 -0400 |
commit | 40198dd0bbf494c36881155e4227923cfe00abe6 (patch) | |
tree | 919be2fb49e894935b57bd78a8b3bc639f5be86f | |
parent | b116e781f6ea9b16d88741e9f1b4a9d0448807fa (diff) | |
download | e2fsprogs-40198dd0bbf494c36881155e4227923cfe00abe6.tar.gz |
Fix filefrag to be 32-bit clean
Currently filefrag uses signed int for block numbers, thus it reporting
corrupted block number for a file on a more than 8TB ext3. The following
trivial patch replace the signed int type block number with "unsigned
long type.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | misc/ChangeLog | 5 | ||||
-rw-r--r-- | misc/filefrag.c | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index 4140ad6c..605928a9 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2006-04-22 Theodore Ts'o <tytso@mit.edu> + + * filefrag.c: Make filefrag 32-bit clean, so that it works on + filesystems > 8TB. + 2006-03-29 Theodore Ts'o <tytso@mit.edu> * dumpe2fs.c (print_inline_journal_information): Print the size of diff --git a/misc/filefrag.c b/misc/filefrag.c index 8cd9d018..0a8b29db 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -71,7 +71,8 @@ static void frag_report(const char *filename) struct statfs fsinfo; struct stat64 fileinfo; int bs; - long i, fd, block, last_block = 0, numblocks; + long i, fd; + unsigned long block, last_block = 0, numblocks; long bpib; /* Blocks per indirect block */ long cylgroups; int discont = 0, expected; @@ -124,7 +125,7 @@ static void frag_report(const char *filename) if (verbose) { printf("File size of %s is %lld (%ld blocks)\n", filename, (long long) fileinfo.st_size, numblocks); - printf("First block: %ld\nLast block: %ld\n", + printf("First block: %lu\nLast block: %lu\n", get_bmap(fd, 0), get_bmap(fd, numblocks - 1)); } for (i=0; i < numblocks; i++) { @@ -141,7 +142,7 @@ static void frag_report(const char *filename) continue; if (last_block && (block != last_block +1) ) { if (verbose) - printf("Discontinuity: Block %ld is at %ld (was %ld)\n", + printf("Discontinuity: Block %ld is at %lu (was %lu)\n", i, block, last_block); discont++; } |