aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <alexandre.ratchov@bull.net>2006-10-11 04:21:15 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:18 -0400
commit8fadc14323684c547f74cf2f4d13517c6c264731 (patch)
tree2b3eedf241a0d7c86f6b808f76e267ded28506ed /fs/ext4/super.c
parent0d1ee42f27d30eed1659f3e85bcbbc7b3711f61f (diff)
[PATCH] ext4: move block number hi bits
move '_hi' bits of block numbers in the larger part of the block group descriptor structure Signed-off-by: Alexandre Ratchov <alexandre.ratchov@bull.net> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bc8848bff2f1..811011fc5c94 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -63,40 +63,52 @@ static void ext4_write_super (struct super_block * sb);
63static void ext4_write_super_lockfs(struct super_block *sb); 63static void ext4_write_super_lockfs(struct super_block *sb);
64 64
65 65
66ext4_fsblk_t ext4_block_bitmap(struct ext4_group_desc *bg) 66ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
67 struct ext4_group_desc *bg)
67{ 68{
68 return le32_to_cpu(bg->bg_block_bitmap) | 69 return le32_to_cpu(bg->bg_block_bitmap) |
69 ((ext4_fsblk_t)le16_to_cpu(bg->bg_block_bitmap_hi) << 32); 70 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
71 (ext4_fsblk_t)le32_to_cpu(bg->bg_block_bitmap_hi) << 32 : 0);
70} 72}
71 73
72ext4_fsblk_t ext4_inode_bitmap(struct ext4_group_desc *bg) 74ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
75 struct ext4_group_desc *bg)
73{ 76{
74 return le32_to_cpu(bg->bg_inode_bitmap) | 77 return le32_to_cpu(bg->bg_inode_bitmap) |
75 ((ext4_fsblk_t)le16_to_cpu(bg->bg_inode_bitmap_hi) << 32); 78 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
79 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
76} 80}
77 81
78ext4_fsblk_t ext4_inode_table(struct ext4_group_desc *bg) 82ext4_fsblk_t ext4_inode_table(struct super_block *sb,
83 struct ext4_group_desc *bg)
79{ 84{
80 return le32_to_cpu(bg->bg_inode_table) | 85 return le32_to_cpu(bg->bg_inode_table) |
81 ((ext4_fsblk_t)le16_to_cpu(bg->bg_inode_table_hi) << 32); 86 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
87 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0);
82} 88}
83 89
84void ext4_block_bitmap_set(struct ext4_group_desc *bg, ext4_fsblk_t blk) 90void ext4_block_bitmap_set(struct super_block *sb,
91 struct ext4_group_desc *bg, ext4_fsblk_t blk)
85{ 92{
86 bg->bg_block_bitmap = cpu_to_le32((u32)blk); 93 bg->bg_block_bitmap = cpu_to_le32((u32)blk);
87 bg->bg_block_bitmap_hi = cpu_to_le16(blk >> 32); 94 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
95 bg->bg_block_bitmap_hi = cpu_to_le32(blk >> 32);
88} 96}
89 97
90void ext4_inode_bitmap_set(struct ext4_group_desc *bg, ext4_fsblk_t blk) 98void ext4_inode_bitmap_set(struct super_block *sb,
99 struct ext4_group_desc *bg, ext4_fsblk_t blk)
91{ 100{
92 bg->bg_inode_bitmap = cpu_to_le32((u32)blk); 101 bg->bg_inode_bitmap = cpu_to_le32((u32)blk);
93 bg->bg_inode_bitmap_hi = cpu_to_le16(blk >> 32); 102 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
103 bg->bg_inode_bitmap_hi = cpu_to_le32(blk >> 32);
94} 104}
95 105
96void ext4_inode_table_set(struct ext4_group_desc *bg, ext4_fsblk_t blk) 106void ext4_inode_table_set(struct super_block *sb,
107 struct ext4_group_desc *bg, ext4_fsblk_t blk)
97{ 108{
98 bg->bg_inode_table = cpu_to_le32((u32)blk); 109 bg->bg_inode_table = cpu_to_le32((u32)blk);
99 bg->bg_inode_table_hi = cpu_to_le16(blk >> 32); 110 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
111 bg->bg_inode_table_hi = cpu_to_le32(blk >> 32);
100} 112}
101 113
102/* 114/*
@@ -1239,7 +1251,7 @@ static int ext4_check_descriptors (struct super_block * sb)
1239 if ((i % EXT4_DESC_PER_BLOCK(sb)) == 0) 1251 if ((i % EXT4_DESC_PER_BLOCK(sb)) == 0)
1240 gdp = (struct ext4_group_desc *) 1252 gdp = (struct ext4_group_desc *)
1241 sbi->s_group_desc[desc_block++]->b_data; 1253 sbi->s_group_desc[desc_block++]->b_data;
1242 block_bitmap = ext4_block_bitmap(gdp); 1254 block_bitmap = ext4_block_bitmap(sb, gdp);
1243 if (block_bitmap < first_block || block_bitmap > last_block) 1255 if (block_bitmap < first_block || block_bitmap > last_block)
1244 { 1256 {
1245 ext4_error (sb, "ext4_check_descriptors", 1257 ext4_error (sb, "ext4_check_descriptors",
@@ -1248,7 +1260,7 @@ static int ext4_check_descriptors (struct super_block * sb)
1248 i, block_bitmap); 1260 i, block_bitmap);
1249 return 0; 1261 return 0;
1250 } 1262 }
1251 inode_bitmap = ext4_inode_bitmap(gdp); 1263 inode_bitmap = ext4_inode_bitmap(sb, gdp);
1252 if (inode_bitmap < first_block || inode_bitmap > last_block) 1264 if (inode_bitmap < first_block || inode_bitmap > last_block)
1253 { 1265 {
1254 ext4_error (sb, "ext4_check_descriptors", 1266 ext4_error (sb, "ext4_check_descriptors",
@@ -1257,7 +1269,7 @@ static int ext4_check_descriptors (struct super_block * sb)
1257 i, inode_bitmap); 1269 i, inode_bitmap);
1258 return 0; 1270 return 0;
1259 } 1271 }
1260 inode_table = ext4_inode_table(gdp); 1272 inode_table = ext4_inode_table(sb, gdp);
1261 if (inode_table < first_block || 1273 if (inode_table < first_block ||
1262 inode_table + sbi->s_itb_per_group > last_block) 1274 inode_table + sbi->s_itb_per_group > last_block)
1263 { 1275 {
@@ -1622,11 +1634,11 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1622 } 1634 }
1623 sbi->s_desc_size = le16_to_cpu(es->s_desc_size); 1635 sbi->s_desc_size = le16_to_cpu(es->s_desc_size);
1624 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { 1636 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
1625 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE || 1637 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
1626 sbi->s_desc_size > EXT4_MAX_DESC_SIZE || 1638 sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||
1627 sbi->s_desc_size & (sbi->s_desc_size - 1)) { 1639 sbi->s_desc_size & (sbi->s_desc_size - 1)) {
1628 printk(KERN_ERR 1640 printk(KERN_ERR
1629 "EXT4-fs: unsupported descriptor size %ld\n", 1641 "EXT4-fs: unsupported descriptor size %lu\n",
1630 sbi->s_desc_size); 1642 sbi->s_desc_size);
1631 goto failed_mount; 1643 goto failed_mount;
1632 } 1644 }