diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-02-06 04:40:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:21 -0500 |
commit | 197cd65accc6a274dabcd81f4811ba5d9a4856df (patch) | |
tree | a41f7b375887c505f8c6a374ad643bb4c1222ed5 /fs | |
parent | 144704e5227362cbd694b0b3c3aa4ac99a0115c9 (diff) |
ext[234]: use ext[234]_get_group_desc()
Use ext[234]_get_group_desc() to get group descriptor from group number.
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext2/super.c | 12 | ||||
-rw-r--r-- | fs/ext3/super.c | 13 | ||||
-rw-r--r-- | fs/ext4/super.c | 14 |
3 files changed, 12 insertions, 27 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 75af3fbe8384..1ba18b72d43a 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -617,27 +617,24 @@ static int ext2_setup_super (struct super_block * sb, | |||
617 | return res; | 617 | return res; |
618 | } | 618 | } |
619 | 619 | ||
620 | static int ext2_check_descriptors (struct super_block * sb) | 620 | static int ext2_check_descriptors(struct super_block *sb) |
621 | { | 621 | { |
622 | int i; | 622 | int i; |
623 | int desc_block = 0; | ||
624 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 623 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
625 | unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | 624 | unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); |
626 | unsigned long last_block; | 625 | unsigned long last_block; |
627 | struct ext2_group_desc * gdp = NULL; | ||
628 | 626 | ||
629 | ext2_debug ("Checking group descriptors"); | 627 | ext2_debug ("Checking group descriptors"); |
630 | 628 | ||
631 | for (i = 0; i < sbi->s_groups_count; i++) | 629 | for (i = 0; i < sbi->s_groups_count; i++) { |
632 | { | 630 | struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); |
631 | |||
633 | if (i == sbi->s_groups_count - 1) | 632 | if (i == sbi->s_groups_count - 1) |
634 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 633 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
635 | else | 634 | else |
636 | last_block = first_block + | 635 | last_block = first_block + |
637 | (EXT2_BLOCKS_PER_GROUP(sb) - 1); | 636 | (EXT2_BLOCKS_PER_GROUP(sb) - 1); |
638 | 637 | ||
639 | if ((i % EXT2_DESC_PER_BLOCK(sb)) == 0) | ||
640 | gdp = (struct ext2_group_desc *) sbi->s_group_desc[desc_block++]->b_data; | ||
641 | if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || | 638 | if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || |
642 | le32_to_cpu(gdp->bg_block_bitmap) > last_block) | 639 | le32_to_cpu(gdp->bg_block_bitmap) > last_block) |
643 | { | 640 | { |
@@ -667,7 +664,6 @@ static int ext2_check_descriptors (struct super_block * sb) | |||
667 | return 0; | 664 | return 0; |
668 | } | 665 | } |
669 | first_block += EXT2_BLOCKS_PER_GROUP(sb); | 666 | first_block += EXT2_BLOCKS_PER_GROUP(sb); |
670 | gdp++; | ||
671 | } | 667 | } |
672 | return 1; | 668 | return 1; |
673 | } | 669 | } |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 15e75139b7e8..343677e8c350 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1252,28 +1252,24 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | /* Called at mount-time, super-block is locked */ | 1254 | /* Called at mount-time, super-block is locked */ |
1255 | static int ext3_check_descriptors (struct super_block * sb) | 1255 | static int ext3_check_descriptors(struct super_block *sb) |
1256 | { | 1256 | { |
1257 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 1257 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
1258 | ext3_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | 1258 | ext3_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); |
1259 | ext3_fsblk_t last_block; | 1259 | ext3_fsblk_t last_block; |
1260 | struct ext3_group_desc * gdp = NULL; | ||
1261 | int desc_block = 0; | ||
1262 | int i; | 1260 | int i; |
1263 | 1261 | ||
1264 | ext3_debug ("Checking group descriptors"); | 1262 | ext3_debug ("Checking group descriptors"); |
1265 | 1263 | ||
1266 | for (i = 0; i < sbi->s_groups_count; i++) | 1264 | for (i = 0; i < sbi->s_groups_count; i++) { |
1267 | { | 1265 | struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL); |
1266 | |||
1268 | if (i == sbi->s_groups_count - 1) | 1267 | if (i == sbi->s_groups_count - 1) |
1269 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 1268 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
1270 | else | 1269 | else |
1271 | last_block = first_block + | 1270 | last_block = first_block + |
1272 | (EXT3_BLOCKS_PER_GROUP(sb) - 1); | 1271 | (EXT3_BLOCKS_PER_GROUP(sb) - 1); |
1273 | 1272 | ||
1274 | if ((i % EXT3_DESC_PER_BLOCK(sb)) == 0) | ||
1275 | gdp = (struct ext3_group_desc *) | ||
1276 | sbi->s_group_desc[desc_block++]->b_data; | ||
1277 | if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || | 1273 | if (le32_to_cpu(gdp->bg_block_bitmap) < first_block || |
1278 | le32_to_cpu(gdp->bg_block_bitmap) > last_block) | 1274 | le32_to_cpu(gdp->bg_block_bitmap) > last_block) |
1279 | { | 1275 | { |
@@ -1306,7 +1302,6 @@ static int ext3_check_descriptors (struct super_block * sb) | |||
1306 | return 0; | 1302 | return 0; |
1307 | } | 1303 | } |
1308 | first_block += EXT3_BLOCKS_PER_GROUP(sb); | 1304 | first_block += EXT3_BLOCKS_PER_GROUP(sb); |
1309 | gdp++; | ||
1310 | } | 1305 | } |
1311 | 1306 | ||
1312 | sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); | 1307 | sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 055a0cd0168e..c89bb8797765 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1458,7 +1458,7 @@ int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 block_group, | |||
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | /* Called at mount-time, super-block is locked */ | 1460 | /* Called at mount-time, super-block is locked */ |
1461 | static int ext4_check_descriptors (struct super_block * sb) | 1461 | static int ext4_check_descriptors(struct super_block *sb) |
1462 | { | 1462 | { |
1463 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 1463 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
1464 | ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | 1464 | ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); |
@@ -1466,8 +1466,6 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1466 | ext4_fsblk_t block_bitmap; | 1466 | ext4_fsblk_t block_bitmap; |
1467 | ext4_fsblk_t inode_bitmap; | 1467 | ext4_fsblk_t inode_bitmap; |
1468 | ext4_fsblk_t inode_table; | 1468 | ext4_fsblk_t inode_table; |
1469 | struct ext4_group_desc * gdp = NULL; | ||
1470 | int desc_block = 0; | ||
1471 | int flexbg_flag = 0; | 1469 | int flexbg_flag = 0; |
1472 | ext4_group_t i; | 1470 | ext4_group_t i; |
1473 | 1471 | ||
@@ -1476,17 +1474,15 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1476 | 1474 | ||
1477 | ext4_debug ("Checking group descriptors"); | 1475 | ext4_debug ("Checking group descriptors"); |
1478 | 1476 | ||
1479 | for (i = 0; i < sbi->s_groups_count; i++) | 1477 | for (i = 0; i < sbi->s_groups_count; i++) { |
1480 | { | 1478 | struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); |
1479 | |||
1481 | if (i == sbi->s_groups_count - 1 || flexbg_flag) | 1480 | if (i == sbi->s_groups_count - 1 || flexbg_flag) |
1482 | last_block = ext4_blocks_count(sbi->s_es) - 1; | 1481 | last_block = ext4_blocks_count(sbi->s_es) - 1; |
1483 | else | 1482 | else |
1484 | last_block = first_block + | 1483 | last_block = first_block + |
1485 | (EXT4_BLOCKS_PER_GROUP(sb) - 1); | 1484 | (EXT4_BLOCKS_PER_GROUP(sb) - 1); |
1486 | 1485 | ||
1487 | if ((i % EXT4_DESC_PER_BLOCK(sb)) == 0) | ||
1488 | gdp = (struct ext4_group_desc *) | ||
1489 | sbi->s_group_desc[desc_block++]->b_data; | ||
1490 | block_bitmap = ext4_block_bitmap(sb, gdp); | 1486 | block_bitmap = ext4_block_bitmap(sb, gdp); |
1491 | if (block_bitmap < first_block || block_bitmap > last_block) | 1487 | if (block_bitmap < first_block || block_bitmap > last_block) |
1492 | { | 1488 | { |
@@ -1524,8 +1520,6 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1524 | } | 1520 | } |
1525 | if (!flexbg_flag) | 1521 | if (!flexbg_flag) |
1526 | first_block += EXT4_BLOCKS_PER_GROUP(sb); | 1522 | first_block += EXT4_BLOCKS_PER_GROUP(sb); |
1527 | gdp = (struct ext4_group_desc *) | ||
1528 | ((__u8 *)gdp + EXT4_DESC_SIZE(sb)); | ||
1529 | } | 1523 | } |
1530 | 1524 | ||
1531 | ext4_free_blocks_count_set(sbi->s_es, ext4_count_free_blocks(sb)); | 1525 | ext4_free_blocks_count_set(sbi->s_es, ext4_count_free_blocks(sb)); |