aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/bitmap.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2007-10-19 02:39:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:35 -0400
commit3ee1667042c350003b9d3f35e5666cc8c43ce8aa (patch)
tree331217461b684c298397d7347431c500c5969148 /fs/reiserfs/bitmap.c
parent6c57c2c8d3862c8d5b908669654f6565da74ec19 (diff)
reiserfs: fix usage of signed ints for block numbers
Do a quick signedness check for block numbers. There are a number of places where signed integers are used for block numbers, which limits the usable file system size to 8 TiB. The disk format, excepting a problem which will be fixed in the following patch, supports file systems up to 16 TiB in size. This patch cleans up those sites so that we can enable the full usable size. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/bitmap.c')
-rw-r--r--fs/reiserfs/bitmap.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 28a1b06081fc..f7275176305e 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -47,7 +47,9 @@
47 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)) 47 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s))
48 48
49static inline void get_bit_address(struct super_block *s, 49static inline void get_bit_address(struct super_block *s,
50 b_blocknr_t block, int *bmap_nr, int *offset) 50 b_blocknr_t block,
51 unsigned int *bmap_nr,
52 unsigned int *offset)
51{ 53{
52 /* It is in the bitmap block number equal to the block 54 /* It is in the bitmap block number equal to the block
53 * number divided by the number of bits in a block. */ 55 * number divided by the number of bits in a block. */
@@ -58,7 +60,7 @@ static inline void get_bit_address(struct super_block *s,
58 60
59int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) 61int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
60{ 62{
61 int bmap, offset; 63 unsigned int bmap, offset;
62 64
63 if (block == 0 || block >= SB_BLOCK_COUNT(s)) { 65 if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
64 reiserfs_warning(s, 66 reiserfs_warning(s,
@@ -108,8 +110,8 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
108 110
109/* searches in journal structures for a given block number (bmap, off). If block 111/* searches in journal structures for a given block number (bmap, off). If block
110 is found in reiserfs journal it suggests next free block candidate to test. */ 112 is found in reiserfs journal it suggests next free block candidate to test. */
111static inline int is_block_in_journal(struct super_block *s, int bmap, int 113static inline int is_block_in_journal(struct super_block *s, unsigned int bmap,
112 off, int *next) 114 int off, int *next)
113{ 115{
114 b_blocknr_t tmp; 116 b_blocknr_t tmp;
115 117
@@ -130,8 +132,8 @@ static inline int is_block_in_journal(struct super_block *s, int bmap, int
130/* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap 132/* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap
131 * block; */ 133 * block; */
132static int scan_bitmap_block(struct reiserfs_transaction_handle *th, 134static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
133 int bmap_n, int *beg, int boundary, int min, 135 unsigned int bmap_n, int *beg, int boundary,
134 int max, int unfm) 136 int min, int max, int unfm)
135{ 137{
136 struct super_block *s = th->t_super; 138 struct super_block *s = th->t_super;
137 struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n]; 139 struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n];
@@ -307,16 +309,16 @@ __le32 reiserfs_choose_packing(struct inode * dir)
307 * bitmap and place new blocks there. Returns number of allocated blocks. */ 309 * bitmap and place new blocks there. Returns number of allocated blocks. */
308static int scan_bitmap(struct reiserfs_transaction_handle *th, 310static int scan_bitmap(struct reiserfs_transaction_handle *th,
309 b_blocknr_t * start, b_blocknr_t finish, 311 b_blocknr_t * start, b_blocknr_t finish,
310 int min, int max, int unfm, unsigned long file_block) 312 int min, int max, int unfm, sector_t file_block)
311{ 313{
312 int nr_allocated = 0; 314 int nr_allocated = 0;
313 struct super_block *s = th->t_super; 315 struct super_block *s = th->t_super;
314 /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr 316 /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr
315 * - Hans, it is not a block number - Zam. */ 317 * - Hans, it is not a block number - Zam. */
316 318
317 int bm, off; 319 unsigned int bm, off;
318 int end_bm, end_off; 320 unsigned int end_bm, end_off;
319 int off_max = s->s_blocksize << 3; 321 unsigned int off_max = s->s_blocksize << 3;
320 322
321 BUG_ON(!th->t_trans_id); 323 BUG_ON(!th->t_trans_id);
322 324
@@ -383,7 +385,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
383 struct reiserfs_super_block *rs; 385 struct reiserfs_super_block *rs;
384 struct buffer_head *sbh, *bmbh; 386 struct buffer_head *sbh, *bmbh;
385 struct reiserfs_bitmap_info *apbi; 387 struct reiserfs_bitmap_info *apbi;
386 int nr, offset; 388 unsigned int nr, offset;
387 389
388 BUG_ON(!th->t_trans_id); 390 BUG_ON(!th->t_trans_id);
389 391