aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/inode.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-04-28 05:16:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:44 -0400
commite0e369a7dd39894465b6501a9492173e8104a19b (patch)
treee0cd041af90cf2262a6ca0f4b14dcbd7520ae025 /fs/ext3/inode.c
parent22a5daf5375a900e1a4efe8ffe2daef9be01e873 (diff)
ext3: use ext3_get_group_desc()
Use ext3_get_group_desc() Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r--fs/ext3/inode.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index c683609b0e3a..e2acbc7a3c3f 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -2454,11 +2454,10 @@ out_stop:
2454static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, 2454static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2455 unsigned long ino, struct ext3_iloc *iloc) 2455 unsigned long ino, struct ext3_iloc *iloc)
2456{ 2456{
2457 unsigned long desc, group_desc, block_group; 2457 unsigned long block_group;
2458 unsigned long offset; 2458 unsigned long offset;
2459 ext3_fsblk_t block; 2459 ext3_fsblk_t block;
2460 struct buffer_head *bh; 2460 struct ext3_group_desc *gdp;
2461 struct ext3_group_desc * gdp;
2462 2461
2463 if (!ext3_valid_inum(sb, ino)) { 2462 if (!ext3_valid_inum(sb, ino)) {
2464 /* 2463 /*
@@ -2470,27 +2469,15 @@ static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2470 } 2469 }
2471 2470
2472 block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); 2471 block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb);
2473 if (block_group >= EXT3_SB(sb)->s_groups_count) { 2472 gdp = ext3_get_group_desc(sb, block_group, NULL);
2474 ext3_error(sb,"ext3_get_inode_block","group >= groups count"); 2473 if (!gdp)
2475 return 0;
2476 }
2477 smp_rmb();
2478 group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(sb);
2479 desc = block_group & (EXT3_DESC_PER_BLOCK(sb) - 1);
2480 bh = EXT3_SB(sb)->s_group_desc[group_desc];
2481 if (!bh) {
2482 ext3_error (sb, "ext3_get_inode_block",
2483 "Descriptor not loaded");
2484 return 0; 2474 return 0;
2485 }
2486
2487 gdp = (struct ext3_group_desc *)bh->b_data;
2488 /* 2475 /*
2489 * Figure out the offset within the block group inode table 2476 * Figure out the offset within the block group inode table
2490 */ 2477 */
2491 offset = ((ino - 1) % EXT3_INODES_PER_GROUP(sb)) * 2478 offset = ((ino - 1) % EXT3_INODES_PER_GROUP(sb)) *
2492 EXT3_INODE_SIZE(sb); 2479 EXT3_INODE_SIZE(sb);
2493 block = le32_to_cpu(gdp[desc].bg_inode_table) + 2480 block = le32_to_cpu(gdp->bg_inode_table) +
2494 (offset >> EXT3_BLOCK_SIZE_BITS(sb)); 2481 (offset >> EXT3_BLOCK_SIZE_BITS(sb));
2495 2482
2496 iloc->block_group = block_group; 2483 iloc->block_group = block_group;