aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLaurent Vivier <Laurent.Vivier@bull.net>2006-10-11 04:21:10 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:17 -0400
commitbd81d8eec043094d3ff729a8ff6d5b3a06d3c4b1 (patch)
tree6813a81b8d8453536839d8bcdc8ed924fdab3f44 /include
parenta1ddeb7eaecea6a924e3a79aa386797020cb436f (diff)
[PATCH] ext4: 64bit metadata
In-kernel super block changes to support >32 bit free blocks numbers. Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Alexandre Ratchov <alexandre.ratchov@bull.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ext4_fs.h86
1 files changed, 73 insertions, 13 deletions
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 63ed89f5b27b..8e5009ee4ad8 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -128,10 +128,17 @@ struct ext4_group_desc
128 __le16 bg_free_blocks_count; /* Free blocks count */ 128 __le16 bg_free_blocks_count; /* Free blocks count */
129 __le16 bg_free_inodes_count; /* Free inodes count */ 129 __le16 bg_free_inodes_count; /* Free inodes count */
130 __le16 bg_used_dirs_count; /* Directories count */ 130 __le16 bg_used_dirs_count; /* Directories count */
131 __u16 bg_pad; 131 __u16 bg_flags;
132 __le32 bg_reserved[3]; 132 __le16 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
133 __le16 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
134 __le16 bg_inode_table_hi; /* Inodes table block MSB */
135 __u16 bg_reserved[3];
133}; 136};
134 137
138#ifdef __KERNEL__
139#include <linux/ext4_fs_i.h>
140#include <linux/ext4_fs_sb.h>
141#endif
135/* 142/*
136 * Macro-instructions used to manage group descriptors 143 * Macro-instructions used to manage group descriptors
137 */ 144 */
@@ -194,9 +201,9 @@ struct ext4_group_desc
194/* Used to pass group descriptor data when online resize is done */ 201/* Used to pass group descriptor data when online resize is done */
195struct ext4_new_group_input { 202struct ext4_new_group_input {
196 __u32 group; /* Group number for this data */ 203 __u32 group; /* Group number for this data */
197 __u32 block_bitmap; /* Absolute block number of block bitmap */ 204 __u64 block_bitmap; /* Absolute block number of block bitmap */
198 __u32 inode_bitmap; /* Absolute block number of inode bitmap */ 205 __u64 inode_bitmap; /* Absolute block number of inode bitmap */
199 __u32 inode_table; /* Absolute block number of inode table start */ 206 __u64 inode_table; /* Absolute block number of inode table start */
200 __u32 blocks_count; /* Total number of blocks in this group */ 207 __u32 blocks_count; /* Total number of blocks in this group */
201 __u16 reserved_blocks; /* Number of reserved blocks in this group */ 208 __u16 reserved_blocks; /* Number of reserved blocks in this group */
202 __u16 unused; 209 __u16 unused;
@@ -205,9 +212,9 @@ struct ext4_new_group_input {
205/* The struct ext4_new_group_input in kernel space, with free_blocks_count */ 212/* The struct ext4_new_group_input in kernel space, with free_blocks_count */
206struct ext4_new_group_data { 213struct ext4_new_group_data {
207 __u32 group; 214 __u32 group;
208 __u32 block_bitmap; 215 __u64 block_bitmap;
209 __u32 inode_bitmap; 216 __u64 inode_bitmap;
210 __u32 inode_table; 217 __u64 inode_table;
211 __u32 blocks_count; 218 __u32 blocks_count;
212 __u16 reserved_blocks; 219 __u16 reserved_blocks;
213 __u16 unused; 220 __u16 unused;
@@ -494,14 +501,18 @@ struct ext4_super_block {
494 __u8 s_def_hash_version; /* Default hash version to use */ 501 __u8 s_def_hash_version; /* Default hash version to use */
495 __u8 s_reserved_char_pad; 502 __u8 s_reserved_char_pad;
496 __u16 s_reserved_word_pad; 503 __u16 s_reserved_word_pad;
497 __le32 s_default_mount_opts; 504/*100*/ __le32 s_default_mount_opts;
498 __le32 s_first_meta_bg; /* First metablock block group */ 505 __le32 s_first_meta_bg; /* First metablock block group */
499 __u32 s_reserved[190]; /* Padding to the end of the block */ 506 __le32 s_mkfs_time; /* When the filesystem was created */
507 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
508 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
509/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
510 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
511 __le32 s_free_blocks_count_hi; /* Free blocks count */
512 __u32 s_reserved[169]; /* Padding to the end of the block */
500}; 513};
501 514
502#ifdef __KERNEL__ 515#ifdef __KERNEL__
503#include <linux/ext4_fs_i.h>
504#include <linux/ext4_fs_sb.h>
505static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb) 516static inline struct ext4_sb_info * EXT4_SB(struct super_block *sb)
506{ 517{
507 return sb->s_fs_info; 518 return sb->s_fs_info;
@@ -588,12 +599,14 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
588#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ 599#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
589#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 600#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
590#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ 601#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
602#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
591 603
592#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 604#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
593#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ 605#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
594 EXT4_FEATURE_INCOMPAT_RECOVER| \ 606 EXT4_FEATURE_INCOMPAT_RECOVER| \
595 EXT4_FEATURE_INCOMPAT_META_BG| \ 607 EXT4_FEATURE_INCOMPAT_META_BG| \
596 EXT4_FEATURE_INCOMPAT_EXTENTS) 608 EXT4_FEATURE_INCOMPAT_EXTENTS| \
609 EXT4_FEATURE_INCOMPAT_64BIT)
597#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 610#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
598 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ 611 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
599 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 612 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
@@ -888,6 +901,53 @@ extern void ext4_abort (struct super_block *, const char *, const char *, ...)
888extern void ext4_warning (struct super_block *, const char *, const char *, ...) 901extern void ext4_warning (struct super_block *, const char *, const char *, ...)
889 __attribute__ ((format (printf, 3, 4))); 902 __attribute__ ((format (printf, 3, 4)));
890extern void ext4_update_dynamic_rev (struct super_block *sb); 903extern void ext4_update_dynamic_rev (struct super_block *sb);
904extern ext4_fsblk_t ext4_block_bitmap(struct ext4_group_desc *bg);
905extern ext4_fsblk_t ext4_inode_bitmap(struct ext4_group_desc *bg);
906extern ext4_fsblk_t ext4_inode_table(struct ext4_group_desc *bg);
907extern void ext4_block_bitmap_set(struct ext4_group_desc *bg, ext4_fsblk_t blk);
908extern void ext4_inode_bitmap_set(struct ext4_group_desc *bg, ext4_fsblk_t blk);
909extern void ext4_inode_table_set(struct ext4_group_desc *bg, ext4_fsblk_t blk);
910
911static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
912{
913 return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
914 le32_to_cpu(es->s_blocks_count);
915}
916
917static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es)
918{
919 return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) |
920 le32_to_cpu(es->s_r_blocks_count);
921}
922
923static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es)
924{
925 return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) |
926 le32_to_cpu(es->s_free_blocks_count);
927}
928
929static inline void ext4_blocks_count_set(struct ext4_super_block *es,
930 ext4_fsblk_t blk)
931{
932 es->s_blocks_count = cpu_to_le32((u32)blk);
933 es->s_blocks_count_hi = cpu_to_le32(blk >> 32);
934}
935
936static inline void ext4_free_blocks_count_set(struct ext4_super_block *es,
937 ext4_fsblk_t blk)
938{
939 es->s_free_blocks_count = cpu_to_le32((u32)blk);
940 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32);
941}
942
943static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
944 ext4_fsblk_t blk)
945{
946 es->s_r_blocks_count = cpu_to_le32((u32)blk);
947 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
948}
949
950
891 951
892#define ext4_std_error(sb, errno) \ 952#define ext4_std_error(sb, errno) \
893do { \ 953do { \