diff options
author | Joel Becker <joel.becker@oracle.com> | 2010-04-13 02:26:12 -0400 |
---|---|---|
committer | Tao Ma <tao.ma@oracle.com> | 2010-04-13 02:26:12 -0400 |
commit | 4cbe4249d6586d5d88ef271e07302407a14c8443 (patch) | |
tree | 907eb8e61e3cf8ababfe1890f2c52ee82eb0e227 /fs/ocfs2/ocfs2_fs.h | |
parent | 0467ae954d1843de65e7cf8f706f88fe65cd8418 (diff) |
ocfs2: Define data structures for discontiguous block groups.
Defines the OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG feature bit and modifies
struct ocfs2_group_desc for the feature.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
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 | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index d61a1521b10e..448aa8d11a97 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -165,6 +165,9 @@ | |||
165 | /* Refcount tree support */ | 165 | /* Refcount tree support */ |
166 | #define OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE 0x1000 | 166 | #define OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE 0x1000 |
167 | 167 | ||
168 | /* Discontigous block groups */ | ||
169 | #define OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG 0x2000 | ||
170 | |||
168 | /* | 171 | /* |
169 | * backup superblock flag is used to indicate that this volume | 172 | * backup superblock flag is used to indicate that this volume |
170 | * has backup superblocks. | 173 | * has backup superblocks. |
@@ -832,6 +835,13 @@ struct ocfs2_dx_leaf { | |||
832 | }; | 835 | }; |
833 | 836 | ||
834 | /* | 837 | /* |
838 | * Largest bitmap for a block (suballocator) group in bytes. This limit | ||
839 | * does not affect cluster groups (global allocator). Cluster group | ||
840 | * bitmaps run to the end of the block. | ||
841 | */ | ||
842 | #define OCFS2_MAX_BG_BITMAP_SIZE 256 | ||
843 | |||
844 | /* | ||
835 | * On disk allocator group structure for OCFS2 | 845 | * On disk allocator group structure for OCFS2 |
836 | */ | 846 | */ |
837 | struct ocfs2_group_desc | 847 | struct ocfs2_group_desc |
@@ -852,7 +862,29 @@ struct ocfs2_group_desc | |||
852 | __le64 bg_blkno; /* Offset on disk, in blocks */ | 862 | __le64 bg_blkno; /* Offset on disk, in blocks */ |
853 | /*30*/ struct ocfs2_block_check bg_check; /* Error checking */ | 863 | /*30*/ struct ocfs2_block_check bg_check; /* Error checking */ |
854 | __le64 bg_reserved2; | 864 | __le64 bg_reserved2; |
855 | /*40*/ __u8 bg_bitmap[0]; | 865 | /*40*/ union { |
866 | __u8 bg_bitmap[0]; | ||
867 | struct { | ||
868 | /* | ||
869 | * Block groups may be discontiguous when | ||
870 | * OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG is set. | ||
871 | * The extents of a discontigous block group are | ||
872 | * stored in bg_list. It is a flat list. | ||
873 | * l_tree_depth must always be zero. A | ||
874 | * discontiguous group is signified by a non-zero | ||
875 | * bg_list->l_next_free_rec. Only block groups | ||
876 | * can be discontiguous; Cluster groups cannot. | ||
877 | * We've never made a block group with more than | ||
878 | * 2048 blocks (256 bytes of bg_bitmap). This | ||
879 | * codifies that limit so that we can fit bg_list. | ||
880 | * bg_size of a discontiguous block group will | ||
881 | * be 256 to match bg_bitmap_filler. | ||
882 | */ | ||
883 | __u8 bg_bitmap_filler[OCFS2_MAX_BG_BITMAP_SIZE]; | ||
884 | /*140*/ struct ocfs2_extent_list bg_list; | ||
885 | }; | ||
886 | }; | ||
887 | /* Actual on-disk size is one block */ | ||
856 | }; | 888 | }; |
857 | 889 | ||
858 | struct ocfs2_refcount_rec { | 890 | struct ocfs2_refcount_rec { |
@@ -1276,12 +1308,16 @@ static inline u16 ocfs2_local_alloc_size(struct super_block *sb) | |||
1276 | return size; | 1308 | return size; |
1277 | } | 1309 | } |
1278 | 1310 | ||
1279 | static inline int ocfs2_group_bitmap_size(struct super_block *sb) | 1311 | static inline int ocfs2_group_bitmap_size(struct super_block *sb, |
1312 | int suballocator) | ||
1280 | { | 1313 | { |
1281 | int size; | 1314 | int size; |
1282 | 1315 | ||
1283 | size = sb->s_blocksize - | 1316 | if (suballocator) |
1284 | offsetof(struct ocfs2_group_desc, bg_bitmap); | 1317 | size = OCFS2_MAX_BG_BITMAP_SIZE; |
1318 | else | ||
1319 | size = sb->s_blocksize - | ||
1320 | offsetof(struct ocfs2_group_desc, bg_bitmap); | ||
1285 | 1321 | ||
1286 | return size; | 1322 | return size; |
1287 | } | 1323 | } |
@@ -1404,12 +1440,15 @@ static inline int ocfs2_local_alloc_size(int blocksize) | |||
1404 | return size; | 1440 | return size; |
1405 | } | 1441 | } |
1406 | 1442 | ||
1407 | static inline int ocfs2_group_bitmap_size(int blocksize) | 1443 | static inline int ocfs2_group_bitmap_size(int blocksize, int suballocator) |
1408 | { | 1444 | { |
1409 | int size; | 1445 | int size; |
1410 | 1446 | ||
1411 | size = blocksize - | 1447 | if (suballocator) |
1412 | offsetof(struct ocfs2_group_desc, bg_bitmap); | 1448 | size = OCFS2_MAX_BG_BITMAP_SIZE; |
1449 | else | ||
1450 | size = blocksize - | ||
1451 | offsetof(struct ocfs2_group_desc, bg_bitmap); | ||
1413 | 1452 | ||
1414 | return size; | 1453 | return size; |
1415 | } | 1454 | } |