diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-04-17 10:38:59 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-04-17 10:38:59 -0400 |
commit | c0a4ef38ac90d9053fcf3e22f81520a507c1a7bd (patch) | |
tree | d8747f48d70272d3834bf947c3b41e6abeb922c0 | |
parent | d00a6d7b40b44ee6b03f492a6c58f5bc4649c784 (diff) |
ext4: use ext4_get_group_desc()
Use ext4_get_group_desc() in ext4_get_inode_block() instead of open
coding the functionality.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: adilger@clusterfs.com
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mingming Cao <cmm@us.ibm.com>
-rw-r--r-- | fs/ext4/inode.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 24a2604dde7b..aa0fb985b15e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2511,12 +2511,10 @@ out_stop: | |||
2511 | static ext4_fsblk_t ext4_get_inode_block(struct super_block *sb, | 2511 | static ext4_fsblk_t ext4_get_inode_block(struct super_block *sb, |
2512 | unsigned long ino, struct ext4_iloc *iloc) | 2512 | unsigned long ino, struct ext4_iloc *iloc) |
2513 | { | 2513 | { |
2514 | unsigned long desc, group_desc; | ||
2515 | ext4_group_t block_group; | 2514 | ext4_group_t block_group; |
2516 | unsigned long offset; | 2515 | unsigned long offset; |
2517 | ext4_fsblk_t block; | 2516 | ext4_fsblk_t block; |
2518 | struct buffer_head *bh; | 2517 | struct ext4_group_desc *gdp; |
2519 | struct ext4_group_desc * gdp; | ||
2520 | 2518 | ||
2521 | if (!ext4_valid_inum(sb, ino)) { | 2519 | if (!ext4_valid_inum(sb, ino)) { |
2522 | /* | 2520 | /* |
@@ -2528,22 +2526,10 @@ static ext4_fsblk_t ext4_get_inode_block(struct super_block *sb, | |||
2528 | } | 2526 | } |
2529 | 2527 | ||
2530 | block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); | 2528 | block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); |
2531 | if (block_group >= EXT4_SB(sb)->s_groups_count) { | 2529 | gdp = ext4_get_group_desc(sb, block_group, NULL); |
2532 | ext4_error(sb,"ext4_get_inode_block","group >= groups count"); | 2530 | if (!gdp) |
2533 | return 0; | 2531 | return 0; |
2534 | } | ||
2535 | smp_rmb(); | ||
2536 | group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb); | ||
2537 | desc = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1); | ||
2538 | bh = EXT4_SB(sb)->s_group_desc[group_desc]; | ||
2539 | if (!bh) { | ||
2540 | ext4_error (sb, "ext4_get_inode_block", | ||
2541 | "Descriptor not loaded"); | ||
2542 | return 0; | ||
2543 | } | ||
2544 | 2532 | ||
2545 | gdp = (struct ext4_group_desc *)((__u8 *)bh->b_data + | ||
2546 | desc * EXT4_DESC_SIZE(sb)); | ||
2547 | /* | 2533 | /* |
2548 | * Figure out the offset within the block group inode table | 2534 | * Figure out the offset within the block group inode table |
2549 | */ | 2535 | */ |