diff options
author | Tao Ma <tao.ma@oracle.com> | 2010-04-13 02:38:06 -0400 |
---|---|---|
committer | Tao Ma <tao.ma@oracle.com> | 2010-04-13 02:38:06 -0400 |
commit | 8571882c21e5073b2f96147ec4ff9b7042339e1b (patch) | |
tree | 1f7925e293e656e5c1c6cd2c2876ea977a7277e5 /fs/ocfs2/ocfs2_fs.h | |
parent | 4711954eaa8d30f653fda238cecf919f1ae40d6f (diff) |
ocfs2: ocfs2_group_bitmap_size has to handle old volume.
ocfs2_group_bitmap_size has to handle the case when the
volume don't have discontiguous block group support. So
pass the feature_incompat in and check it.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'fs/ocfs2/ocfs2_fs.h')
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index a17bce591ee3..67bb8a77e868 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -1338,15 +1338,21 @@ static inline u16 ocfs2_local_alloc_size(struct super_block *sb) | |||
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | static inline int ocfs2_group_bitmap_size(struct super_block *sb, | 1340 | static inline int ocfs2_group_bitmap_size(struct super_block *sb, |
1341 | int suballocator) | 1341 | int suballocator, |
1342 | u32 feature_incompat) | ||
1342 | { | 1343 | { |
1343 | int size; | 1344 | int size = sb->s_blocksize - |
1345 | offsetof(struct ocfs2_group_desc, bg_bitmap); | ||
1344 | 1346 | ||
1345 | if (suballocator) | 1347 | /* |
1348 | * The cluster allocator uses the entire block. Suballocators have | ||
1349 | * never used more than OCFS2_MAX_BG_BITMAP_SIZE. Unfortunately, older | ||
1350 | * code expects bg_size set to the maximum. Thus we must keep | ||
1351 | * bg_size as-is unless discontig_bg is enabled. | ||
1352 | */ | ||
1353 | if (suballocator && | ||
1354 | (feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG)) | ||
1346 | size = OCFS2_MAX_BG_BITMAP_SIZE; | 1355 | size = OCFS2_MAX_BG_BITMAP_SIZE; |
1347 | else | ||
1348 | size = sb->s_blocksize - | ||
1349 | offsetof(struct ocfs2_group_desc, bg_bitmap); | ||
1350 | 1356 | ||
1351 | return size; | 1357 | return size; |
1352 | } | 1358 | } |
@@ -1479,15 +1485,22 @@ static inline int ocfs2_local_alloc_size(int blocksize) | |||
1479 | return size; | 1485 | return size; |
1480 | } | 1486 | } |
1481 | 1487 | ||
1482 | static inline int ocfs2_group_bitmap_size(int blocksize, int suballocator) | 1488 | static inline int ocfs2_group_bitmap_size(int blocksize, |
1489 | int suballocator, | ||
1490 | uint32_t feature_incompat) | ||
1483 | { | 1491 | { |
1484 | int size; | 1492 | int size = sb->s_blocksize - |
1493 | offsetof(struct ocfs2_group_desc, bg_bitmap); | ||
1485 | 1494 | ||
1486 | if (suballocator) | 1495 | /* |
1496 | * The cluster allocator uses the entire block. Suballocators have | ||
1497 | * never used more than OCFS2_MAX_BG_BITMAP_SIZE. Unfortunately, older | ||
1498 | * code expects bg_size set to the maximum. Thus we must keep | ||
1499 | * bg_size as-is unless discontig_bg is enabled. | ||
1500 | */ | ||
1501 | if (suballocator && | ||
1502 | (feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG)) | ||
1487 | size = OCFS2_MAX_BG_BITMAP_SIZE; | 1503 | size = OCFS2_MAX_BG_BITMAP_SIZE; |
1488 | else | ||
1489 | size = blocksize - | ||
1490 | offsetof(struct ocfs2_group_desc, bg_bitmap); | ||
1491 | 1504 | ||
1492 | return size; | 1505 | return size; |
1493 | } | 1506 | } |