summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2_fs.h
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2010-04-13 14:38:06 +0800
committerTao Ma <tao.ma@oracle.com>2010-04-13 14:38:06 +0800
commit8571882c21e5073b2f96147ec4ff9b7042339e1b (patch)
tree1f7925e293e656e5c1c6cd2c2876ea977a7277e5 /fs/ocfs2/ocfs2_fs.h
parent4711954eaa8d30f653fda238cecf919f1ae40d6f (diff)
downloadlinux-8571882c21e5073b2f96147ec4ff9b7042339e1b.tar.gz
linux-8571882c21e5073b2f96147ec4ff9b7042339e1b.tar.bz2
linux-8571882c21e5073b2f96147ec4ff9b7042339e1b.zip
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.h37
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)
}
static inline int ocfs2_group_bitmap_size(struct super_block *sb,
- int suballocator)
+ int suballocator,
+ u32 feature_incompat)
{
- int size;
+ int size = sb->s_blocksize -
+ offsetof(struct ocfs2_group_desc, bg_bitmap);
- if (suballocator)
+ /*
+ * The cluster allocator uses the entire block. Suballocators have
+ * never used more than OCFS2_MAX_BG_BITMAP_SIZE. Unfortunately, older
+ * code expects bg_size set to the maximum. Thus we must keep
+ * bg_size as-is unless discontig_bg is enabled.
+ */
+ if (suballocator &&
+ (feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG))
size = OCFS2_MAX_BG_BITMAP_SIZE;
- else
- size = sb->s_blocksize -
- offsetof(struct ocfs2_group_desc, bg_bitmap);
return size;
}
@@ -1479,15 +1485,22 @@ static inline int ocfs2_local_alloc_size(int blocksize)
return size;
}
-static inline int ocfs2_group_bitmap_size(int blocksize, int suballocator)
+static inline int ocfs2_group_bitmap_size(int blocksize,
+ int suballocator,
+ uint32_t feature_incompat)
{
- int size;
+ int size = sb->s_blocksize -
+ offsetof(struct ocfs2_group_desc, bg_bitmap);
- if (suballocator)
+ /*
+ * The cluster allocator uses the entire block. Suballocators have
+ * never used more than OCFS2_MAX_BG_BITMAP_SIZE. Unfortunately, older
+ * code expects bg_size set to the maximum. Thus we must keep
+ * bg_size as-is unless discontig_bg is enabled.
+ */
+ if (suballocator &&
+ (feature_incompat & OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG))
size = OCFS2_MAX_BG_BITMAP_SIZE;
- else
- size = blocksize -
- offsetof(struct ocfs2_group_desc, bg_bitmap);
return size;
}