reiserfs: Fix signedness issues for large file systems

Now that we handle file systems > 8 TB, we end up printing large negative
numbers instead of actual block numbers. This patch fixes those places
to use unsigned ints for block numbers.

Signed-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
Jeff Mahoney committed 2012-10-11 11:56:48 -04:00
1 parent 5d4f1fa494
commit 0265fd70c1
13 files changed
+47 -44

No files matched your search

+11 -11
View File
@@ -59,11 +59,11 @@ Options:\n\
#if 1
struct reiserfs_fsstat {
int nr_internals;
int nr_leaves;
int nr_files;
int nr_directories;
int nr_unformatted;
unsigned int nr_internals;
unsigned int nr_leaves;
unsigned int nr_files;
unsigned int nr_directories;
unsigned int nr_unformatted;
} g_stat_info;
#endif
@@ -465,14 +465,14 @@ static void init_bitmap (reiserfs_filsys_t * fs)
case ALL_BLOCKS:
input_bitmap (fs) = reiserfs_create_bitmap (block_count);
reiserfs_bitmap_fill (input_bitmap (fs));
reiserfs_warning (stderr, "Whole device (%d blocks) is to be scanned\n",
reiserfs_warning (stderr, "Whole device (%u blocks) is to be scanned\n",
reiserfs_bitmap_ones (input_bitmap (fs)));
break;
case USED_BLOCKS:
reiserfs_warning (stderr, "Loading on-disk bitmap .. ");
input_bitmap (fs) = reiserfs_create_bitmap (block_count);
reiserfs_bitmap_copy (input_bitmap (fs), fs->fs_bitmap2);
reiserfs_warning (stderr, "%d bits set - done\n",
reiserfs_warning (stderr, "%lu bits set - done\n",
reiserfs_bitmap_ones (input_bitmap (fs)));
break;
case UNUSED_BLOCKS:
@@ -480,7 +480,7 @@ static void init_bitmap (reiserfs_filsys_t * fs)
input_bitmap (fs) = reiserfs_create_bitmap (block_count);
reiserfs_bitmap_copy (input_bitmap (fs), fs->fs_bitmap2);
reiserfs_bitmap_invert (input_bitmap (fs));
reiserfs_warning (stderr, "%d bits set - done\n",
reiserfs_warning (stderr, "%lu bits set - done\n",
reiserfs_bitmap_ones (input_bitmap (fs)));
break;
case EXTERN_BITMAP:
@@ -494,7 +494,7 @@ static void init_bitmap (reiserfs_filsys_t * fs)
reiserfs_exit (1, "could not load fitmap from \"%s\"",
input_bitmap_file_name(fs));
}
reiserfs_warning (stderr, "%d blocks marked in the given bitmap\n",
reiserfs_warning (stderr, "%u blocks marked in the given bitmap\n",
reiserfs_bitmap_ones (input_bitmap (fs)));
fclose (fp);
break;
@@ -554,8 +554,8 @@ static void do_dump_tree (reiserfs_filsys_t * fs)
}
/* print the statistic */
printf ("\t%d internal + %d leaves + %d "
"unformatted nodes = %d blocks\n",
printf ("\t%u internal + %u leaves + %u "
"unformatted nodes = %u blocks\n",
g_stat_info.nr_internals, g_stat_info.nr_leaves,
g_stat_info.nr_unformatted, g_stat_info.nr_internals +
g_stat_info.nr_leaves + g_stat_info.nr_unformatted);
+9 -9
View File
@@ -8,7 +8,7 @@
/* counters for each kind of blocks */
int packed,
unsigned int packed,
packed_leaves,
full_blocks,
having_ih_array, /* blocks with broken block head */
@@ -638,7 +638,7 @@ static void pack_frozen_data (reiserfs_filsys_t * fs)
}
reiserfs_warning (stderr, "ok\n");fflush (stderr);
reiserfs_warning (stderr,
"Super block, bitmaps, journal - %d blocks - done, %d blocks left\n",
"Super block, bitmaps, journal - %u blocks - done, %u blocks left\n",
packed, reiserfs_bitmap_ones (what_to_pack));
}
@@ -693,13 +693,13 @@ void pack_partition (reiserfs_filsys_t * fs)
magic16 = END_MAGIC;
fwrite_le16 (&magic16);
fprintf (stderr, "\nPacked %d blocks:\n"
"\tcompessed %d\n"
"\tfull blocks %d\n"
"\t\tleaves with broken block head %d\n"
"\t\tcorrupted leaves %d\n"
"\t\tinternals %d\n"
"\t\tdescriptors %d\n",
fprintf (stderr, "\nPacked %u blocks:\n"
"\tcompessed %u\n"
"\tfull blocks %u\n"
"\t\tleaves with broken block head %u\n"
"\t\tcorrupted leaves %u\n"
"\t\tinternals %u\n"
"\t\tdescriptors %u\n",
packed,
packed_leaves, full_blocks, having_ih_array,
bad_leaves, internals, descs);
+1 -1
View File
@@ -1032,7 +1032,7 @@ void do_scan (reiserfs_filsys_t * fs)
/* step 2: */
done = 0;
total = reiserfs_bitmap_ones (input_bitmap (fs));
printf ("%ld bits set in bitmap\n", total);
printf ("%lu bits set in bitmap\n", total);
for (i = 0; i < get_sb_block_count (fs->fs_ondisk_sb); i ++) {
int type;
+1 -1
View File
@@ -245,7 +245,7 @@ void do_stat (reiserfs_filsys_t * fs)
reiserfs_exit (1, "could not open %s to save bitmap: %m\n",
input_bitmap_file_name(fs));
}
reiserfs_warning (stderr, "Updated bitmap contains %d blocks marked\n",
reiserfs_warning (stderr, "Updated bitmap contains %u blocks marked\n",
reiserfs_bitmap_ones (input_bitmap (fs)));
reiserfs_bitmap_save (fp, input_bitmap (fs));