aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ialloc.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-10-11 04:21:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:18 -0400
commitf4e5bc244f23ee024a4dfa034b591b219b2bfb8f (patch)
treedf0cb1469de20ae9706a671ab8e9b049e1d93f63 /fs/ext4/ialloc.c
parent72b64b594081ef0a0717f6aad77e891c72ed4afa (diff)
[PATCH] ext4 64 bit divide fix
With CONFIG_LBD=n, sector_div() expands to a plain old divide. But ext4 is _not_ passing in a sector_t as the first argument, so... fs/built-in.o: In function `ext4_get_group_no_and_offset': fs/ext4/balloc.c:39: undefined reference to `__umoddi3' fs/ext4/balloc.c:41: undefined reference to `__udivdi3' fs/built-in.o: In function `find_group_orlov': fs/ext4/ialloc.c:278: undefined reference to `__udivdi3' fs/built-in.o: In function `ext4_fill_super': fs/ext4/super.c:1488: undefined reference to `__udivdi3' fs/ext4/super.c:1488: undefined reference to `__umoddi3' fs/ext4/super.c:1594: undefined reference to `__udivdi3' fs/ext4/super.c:1601: undefined reference to `__umoddi3' Fix that up by calling do_div() directly. Also cast the arg to u64. do_div() is only defined on u64, and ext4_fsblk_t is supposed to be opaque. Note especially the changes to find_group_orlov(). It was attempting to do do_div(int, unsigned long long); which is royally screwed up. Switched it to plain old divide. Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r--fs/ext4/ialloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 75608e1e5555..c88b439ba5cd 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -275,7 +275,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
275 avefreei = freei / ngroups; 275 avefreei = freei / ngroups;
276 freeb = percpu_counter_read_positive(&sbi->s_freeblocks_counter); 276 freeb = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
277 avefreeb = freeb; 277 avefreeb = freeb;
278 sector_div(avefreeb, ngroups); 278 do_div(avefreeb, ngroups);
279 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); 279 ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter);
280 280
281 if ((parent == sb->s_root->d_inode) || 281 if ((parent == sb->s_root->d_inode) ||
@@ -305,14 +305,14 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
305 } 305 }
306 306
307 blocks_per_dir = ext4_blocks_count(es) - freeb; 307 blocks_per_dir = ext4_blocks_count(es) - freeb;
308 sector_div(blocks_per_dir, ndirs); 308 do_div(blocks_per_dir, ndirs);
309 309
310 max_dirs = ndirs / ngroups + inodes_per_group / 16; 310 max_dirs = ndirs / ngroups + inodes_per_group / 16;
311 min_inodes = avefreei - inodes_per_group / 4; 311 min_inodes = avefreei - inodes_per_group / 4;
312 min_blocks = avefreeb - EXT4_BLOCKS_PER_GROUP(sb) / 4; 312 min_blocks = avefreeb - EXT4_BLOCKS_PER_GROUP(sb) / 4;
313 313
314 max_debt = EXT4_BLOCKS_PER_GROUP(sb); 314 max_debt = EXT4_BLOCKS_PER_GROUP(sb);
315 sector_div(max_debt, max(blocks_per_dir, (ext4_fsblk_t)BLOCK_COST)); 315 max_debt /= max_t(int, blocks_per_dir, BLOCK_COST);
316 if (max_debt * INODE_COST > inodes_per_group) 316 if (max_debt * INODE_COST > inodes_per_group)
317 max_debt = inodes_per_group / INODE_COST; 317 max_debt = inodes_per_group / INODE_COST;
318 if (max_debt > 255) 318 if (max_debt > 255)