diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 20:14:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 20:14:59 -0500 |
commit | 2150edc6c5cf00f7adb54538b9ea2a3e9cedca3f (patch) | |
tree | f72a0d85e66f500b4cead348a231e3d3b9f357bc /fs/ext4/ext4.h | |
parent | cd764695b67386a81964f68e9c66efd9f13f4d29 (diff) | |
parent | 4b905671d2ea09fd48fed72c581df17e40823f39 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (57 commits)
jbd2: Fix oops in jbd2_journal_init_inode() on corrupted fs
ext4: Remove "extents" mount option
block: Add Kconfig help which notes that ext4 needs CONFIG_LBD
ext4: Make printk's consistently prefixed with "EXT4-fs: "
ext4: Add sanity checks for the superblock before mounting the filesystem
ext4: Add mount option to set kjournald's I/O priority
jbd2: Submit writes to the journal using WRITE_SYNC
jbd2: Add pid and journal device name to the "kjournald2 starting" message
ext4: Add markers for better debuggability
ext4: Remove code to create the journal inode
ext4: provide function to release metadata pages under memory pressure
ext3: provide function to release metadata pages under memory pressure
add releasepage hooks to block devices which can be used by file systems
ext4: Fix s_dirty_blocks_counter if block allocation failed with nodelalloc
ext4: Init the complete page while building buddy cache
ext4: Don't allow new groups to be added during block allocation
ext4: mark the blocks/inode bitmap beyond end of group as used
ext4: Use new buffer_head flag to check uninit group bitmaps initialization
ext4: Fix the race between read_inode_bitmap() and ext4_new_inode()
ext4: code cleanup
...
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 152 |
1 files changed, 119 insertions, 33 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 6c46c648430d..c668e4377d76 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
21 | #include <linux/magic.h> | 21 | #include <linux/magic.h> |
22 | #include <linux/jbd2.h> | ||
22 | #include "ext4_i.h" | 23 | #include "ext4_i.h" |
23 | 24 | ||
24 | /* | 25 | /* |
@@ -94,9 +95,9 @@ struct ext4_allocation_request { | |||
94 | /* phys. block for ^^^ */ | 95 | /* phys. block for ^^^ */ |
95 | ext4_fsblk_t pright; | 96 | ext4_fsblk_t pright; |
96 | /* how many blocks we want to allocate */ | 97 | /* how many blocks we want to allocate */ |
97 | unsigned long len; | 98 | unsigned int len; |
98 | /* flags. see above EXT4_MB_HINT_* */ | 99 | /* flags. see above EXT4_MB_HINT_* */ |
99 | unsigned long flags; | 100 | unsigned int flags; |
100 | }; | 101 | }; |
101 | 102 | ||
102 | /* | 103 | /* |
@@ -156,12 +157,12 @@ struct ext4_group_desc | |||
156 | __le32 bg_block_bitmap_lo; /* Blocks bitmap block */ | 157 | __le32 bg_block_bitmap_lo; /* Blocks bitmap block */ |
157 | __le32 bg_inode_bitmap_lo; /* Inodes bitmap block */ | 158 | __le32 bg_inode_bitmap_lo; /* Inodes bitmap block */ |
158 | __le32 bg_inode_table_lo; /* Inodes table block */ | 159 | __le32 bg_inode_table_lo; /* Inodes table block */ |
159 | __le16 bg_free_blocks_count; /* Free blocks count */ | 160 | __le16 bg_free_blocks_count_lo;/* Free blocks count */ |
160 | __le16 bg_free_inodes_count; /* Free inodes count */ | 161 | __le16 bg_free_inodes_count_lo;/* Free inodes count */ |
161 | __le16 bg_used_dirs_count; /* Directories count */ | 162 | __le16 bg_used_dirs_count_lo; /* Directories count */ |
162 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ | 163 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ |
163 | __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */ | 164 | __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */ |
164 | __le16 bg_itable_unused; /* Unused inodes count */ | 165 | __le16 bg_itable_unused_lo; /* Unused inodes count */ |
165 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ | 166 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ |
166 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ | 167 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ |
167 | __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ | 168 | __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ |
@@ -169,7 +170,7 @@ struct ext4_group_desc | |||
169 | __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */ | 170 | __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */ |
170 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ | 171 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ |
171 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ | 172 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ |
172 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ | 173 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ |
173 | __u32 bg_reserved2[3]; | 174 | __u32 bg_reserved2[3]; |
174 | }; | 175 | }; |
175 | 176 | ||
@@ -328,6 +329,7 @@ struct ext4_mount_options { | |||
328 | uid_t s_resuid; | 329 | uid_t s_resuid; |
329 | gid_t s_resgid; | 330 | gid_t s_resgid; |
330 | unsigned long s_commit_interval; | 331 | unsigned long s_commit_interval; |
332 | u32 s_min_batch_time, s_max_batch_time; | ||
331 | #ifdef CONFIG_QUOTA | 333 | #ifdef CONFIG_QUOTA |
332 | int s_jquota_fmt; | 334 | int s_jquota_fmt; |
333 | char *s_qf_names[MAXQUOTAS]; | 335 | char *s_qf_names[MAXQUOTAS]; |
@@ -534,7 +536,6 @@ do { \ | |||
534 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ | 536 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ |
535 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | 537 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ |
536 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | 538 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ |
537 | #define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ | ||
538 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | 539 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ |
539 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 540 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
540 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | 541 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ |
@@ -726,11 +727,11 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
726 | */ | 727 | */ |
727 | 728 | ||
728 | #define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ | 729 | #define EXT4_HAS_COMPAT_FEATURE(sb,mask) \ |
729 | (EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) | 730 | ((EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) != 0) |
730 | #define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ | 731 | #define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \ |
731 | (EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) | 732 | ((EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) != 0) |
732 | #define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ | 733 | #define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \ |
733 | (EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) | 734 | ((EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) != 0) |
734 | #define EXT4_SET_COMPAT_FEATURE(sb,mask) \ | 735 | #define EXT4_SET_COMPAT_FEATURE(sb,mask) \ |
735 | EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) | 736 | EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) |
736 | #define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ | 737 | #define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \ |
@@ -806,6 +807,12 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
806 | #define EXT4_DEFM_JMODE_WBACK 0x0060 | 807 | #define EXT4_DEFM_JMODE_WBACK 0x0060 |
807 | 808 | ||
808 | /* | 809 | /* |
810 | * Default journal batch times | ||
811 | */ | ||
812 | #define EXT4_DEF_MIN_BATCH_TIME 0 | ||
813 | #define EXT4_DEF_MAX_BATCH_TIME 15000 /* 15ms */ | ||
814 | |||
815 | /* | ||
809 | * Structure of a directory entry | 816 | * Structure of a directory entry |
810 | */ | 817 | */ |
811 | #define EXT4_NAME_LEN 255 | 818 | #define EXT4_NAME_LEN 255 |
@@ -891,6 +898,9 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len) | |||
891 | #define DX_HASH_LEGACY 0 | 898 | #define DX_HASH_LEGACY 0 |
892 | #define DX_HASH_HALF_MD4 1 | 899 | #define DX_HASH_HALF_MD4 1 |
893 | #define DX_HASH_TEA 2 | 900 | #define DX_HASH_TEA 2 |
901 | #define DX_HASH_LEGACY_UNSIGNED 3 | ||
902 | #define DX_HASH_HALF_MD4_UNSIGNED 4 | ||
903 | #define DX_HASH_TEA_UNSIGNED 5 | ||
894 | 904 | ||
895 | #ifdef __KERNEL__ | 905 | #ifdef __KERNEL__ |
896 | 906 | ||
@@ -955,7 +965,7 @@ ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no) | |||
955 | #define ERR_BAD_DX_DIR -75000 | 965 | #define ERR_BAD_DX_DIR -75000 |
956 | 966 | ||
957 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | 967 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, |
958 | unsigned long *blockgrpp, ext4_grpblk_t *offsetp); | 968 | ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp); |
959 | 969 | ||
960 | extern struct proc_dir_entry *ext4_proc_root; | 970 | extern struct proc_dir_entry *ext4_proc_root; |
961 | 971 | ||
@@ -987,6 +997,9 @@ do { \ | |||
987 | # define ATTRIB_NORET __attribute__((noreturn)) | 997 | # define ATTRIB_NORET __attribute__((noreturn)) |
988 | # define NORET_AND noreturn, | 998 | # define NORET_AND noreturn, |
989 | 999 | ||
1000 | /* bitmap.c */ | ||
1001 | extern unsigned int ext4_count_free(struct buffer_head *, unsigned); | ||
1002 | |||
990 | /* balloc.c */ | 1003 | /* balloc.c */ |
991 | extern unsigned int ext4_block_group(struct super_block *sb, | 1004 | extern unsigned int ext4_block_group(struct super_block *sb, |
992 | ext4_fsblk_t blocknr); | 1005 | ext4_fsblk_t blocknr); |
@@ -995,20 +1008,14 @@ extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, | |||
995 | extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group); | 1008 | extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group); |
996 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, | 1009 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, |
997 | ext4_group_t group); | 1010 | ext4_group_t group); |
998 | extern ext4_fsblk_t ext4_new_meta_block(handle_t *handle, struct inode *inode, | ||
999 | ext4_fsblk_t goal, int *errp); | ||
1000 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, | 1011 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, |
1001 | ext4_fsblk_t goal, unsigned long *count, int *errp); | 1012 | ext4_fsblk_t goal, unsigned long *count, int *errp); |
1002 | extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | ||
1003 | ext4_lblk_t iblock, ext4_fsblk_t goal, | ||
1004 | unsigned long *count, int *errp); | ||
1005 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); | 1013 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); |
1006 | extern int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); | 1014 | extern int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); |
1007 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, | 1015 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
1008 | ext4_fsblk_t block, unsigned long count, int metadata); | 1016 | ext4_fsblk_t block, unsigned long count, int metadata); |
1009 | extern void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb, | 1017 | extern void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, |
1010 | ext4_fsblk_t block, unsigned long count, | 1018 | ext4_fsblk_t block, unsigned long count); |
1011 | unsigned long *pdquot_freed_blocks); | ||
1012 | extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *); | 1019 | extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *); |
1013 | extern void ext4_check_blocks_bitmap(struct super_block *); | 1020 | extern void ext4_check_blocks_bitmap(struct super_block *); |
1014 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | 1021 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, |
@@ -1019,7 +1026,7 @@ extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); | |||
1019 | /* dir.c */ | 1026 | /* dir.c */ |
1020 | extern int ext4_check_dir_entry(const char *, struct inode *, | 1027 | extern int ext4_check_dir_entry(const char *, struct inode *, |
1021 | struct ext4_dir_entry_2 *, | 1028 | struct ext4_dir_entry_2 *, |
1022 | struct buffer_head *, unsigned long); | 1029 | struct buffer_head *, unsigned int); |
1023 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, | 1030 | extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, |
1024 | __u32 minor_hash, | 1031 | __u32 minor_hash, |
1025 | struct ext4_dir_entry_2 *dirent); | 1032 | struct ext4_dir_entry_2 *dirent); |
@@ -1039,7 +1046,6 @@ extern struct inode * ext4_orphan_get(struct super_block *, unsigned long); | |||
1039 | extern unsigned long ext4_count_free_inodes(struct super_block *); | 1046 | extern unsigned long ext4_count_free_inodes(struct super_block *); |
1040 | extern unsigned long ext4_count_dirs(struct super_block *); | 1047 | extern unsigned long ext4_count_dirs(struct super_block *); |
1041 | extern void ext4_check_inodes_bitmap(struct super_block *); | 1048 | extern void ext4_check_inodes_bitmap(struct super_block *); |
1042 | extern unsigned long ext4_count_free(struct buffer_head *, unsigned); | ||
1043 | 1049 | ||
1044 | /* mballoc.c */ | 1050 | /* mballoc.c */ |
1045 | extern long ext4_mb_stats; | 1051 | extern long ext4_mb_stats; |
@@ -1054,12 +1060,13 @@ extern int __init init_ext4_mballoc(void); | |||
1054 | extern void exit_ext4_mballoc(void); | 1060 | extern void exit_ext4_mballoc(void); |
1055 | extern void ext4_mb_free_blocks(handle_t *, struct inode *, | 1061 | extern void ext4_mb_free_blocks(handle_t *, struct inode *, |
1056 | unsigned long, unsigned long, int, unsigned long *); | 1062 | unsigned long, unsigned long, int, unsigned long *); |
1057 | extern int ext4_mb_add_more_groupinfo(struct super_block *sb, | 1063 | extern int ext4_mb_add_groupinfo(struct super_block *sb, |
1058 | ext4_group_t i, struct ext4_group_desc *desc); | 1064 | ext4_group_t i, struct ext4_group_desc *desc); |
1059 | extern void ext4_mb_update_group_info(struct ext4_group_info *grp, | 1065 | extern void ext4_mb_update_group_info(struct ext4_group_info *grp, |
1060 | ext4_grpblk_t add); | 1066 | ext4_grpblk_t add); |
1061 | 1067 | extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t); | |
1062 | 1068 | extern void ext4_mb_put_buddy_cache_lock(struct super_block *, | |
1069 | ext4_group_t, int); | ||
1063 | /* inode.c */ | 1070 | /* inode.c */ |
1064 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, | 1071 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, |
1065 | struct buffer_head *bh, ext4_fsblk_t blocknr); | 1072 | struct buffer_head *bh, ext4_fsblk_t blocknr); |
@@ -1069,10 +1076,6 @@ struct buffer_head *ext4_bread(handle_t *, struct inode *, | |||
1069 | ext4_lblk_t, int, int *); | 1076 | ext4_lblk_t, int, int *); |
1070 | int ext4_get_block(struct inode *inode, sector_t iblock, | 1077 | int ext4_get_block(struct inode *inode, sector_t iblock, |
1071 | struct buffer_head *bh_result, int create); | 1078 | struct buffer_head *bh_result, int create); |
1072 | int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, | ||
1073 | ext4_lblk_t iblock, unsigned long maxblocks, | ||
1074 | struct buffer_head *bh_result, | ||
1075 | int create, int extend_disksize); | ||
1076 | 1079 | ||
1077 | extern struct inode *ext4_iget(struct super_block *, unsigned long); | 1080 | extern struct inode *ext4_iget(struct super_block *, unsigned long); |
1078 | extern int ext4_write_inode(struct inode *, int); | 1081 | extern int ext4_write_inode(struct inode *, int); |
@@ -1123,6 +1126,9 @@ extern void ext4_abort(struct super_block *, const char *, const char *, ...) | |||
1123 | __attribute__ ((format (printf, 3, 4))); | 1126 | __attribute__ ((format (printf, 3, 4))); |
1124 | extern void ext4_warning(struct super_block *, const char *, const char *, ...) | 1127 | extern void ext4_warning(struct super_block *, const char *, const char *, ...) |
1125 | __attribute__ ((format (printf, 3, 4))); | 1128 | __attribute__ ((format (printf, 3, 4))); |
1129 | extern void ext4_grp_locked_error(struct super_block *, ext4_group_t, | ||
1130 | const char *, const char *, ...) | ||
1131 | __attribute__ ((format (printf, 4, 5))); | ||
1126 | extern void ext4_update_dynamic_rev(struct super_block *sb); | 1132 | extern void ext4_update_dynamic_rev(struct super_block *sb); |
1127 | extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb, | 1133 | extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb, |
1128 | __u32 compat); | 1134 | __u32 compat); |
@@ -1136,12 +1142,28 @@ extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, | |||
1136 | struct ext4_group_desc *bg); | 1142 | struct ext4_group_desc *bg); |
1137 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, | 1143 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, |
1138 | struct ext4_group_desc *bg); | 1144 | struct ext4_group_desc *bg); |
1145 | extern __u32 ext4_free_blks_count(struct super_block *sb, | ||
1146 | struct ext4_group_desc *bg); | ||
1147 | extern __u32 ext4_free_inodes_count(struct super_block *sb, | ||
1148 | struct ext4_group_desc *bg); | ||
1149 | extern __u32 ext4_used_dirs_count(struct super_block *sb, | ||
1150 | struct ext4_group_desc *bg); | ||
1151 | extern __u32 ext4_itable_unused_count(struct super_block *sb, | ||
1152 | struct ext4_group_desc *bg); | ||
1139 | extern void ext4_block_bitmap_set(struct super_block *sb, | 1153 | extern void ext4_block_bitmap_set(struct super_block *sb, |
1140 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1154 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
1141 | extern void ext4_inode_bitmap_set(struct super_block *sb, | 1155 | extern void ext4_inode_bitmap_set(struct super_block *sb, |
1142 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1156 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
1143 | extern void ext4_inode_table_set(struct super_block *sb, | 1157 | extern void ext4_inode_table_set(struct super_block *sb, |
1144 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1158 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
1159 | extern void ext4_free_blks_set(struct super_block *sb, | ||
1160 | struct ext4_group_desc *bg, __u32 count); | ||
1161 | extern void ext4_free_inodes_set(struct super_block *sb, | ||
1162 | struct ext4_group_desc *bg, __u32 count); | ||
1163 | extern void ext4_used_dirs_set(struct super_block *sb, | ||
1164 | struct ext4_group_desc *bg, __u32 count); | ||
1165 | extern void ext4_itable_unused_set(struct super_block *sb, | ||
1166 | struct ext4_group_desc *bg, __u32 count); | ||
1145 | 1167 | ||
1146 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) | 1168 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) |
1147 | { | 1169 | { |
@@ -1246,6 +1268,50 @@ static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) | |||
1246 | return ; | 1268 | return ; |
1247 | } | 1269 | } |
1248 | 1270 | ||
1271 | struct ext4_group_info { | ||
1272 | unsigned long bb_state; | ||
1273 | struct rb_root bb_free_root; | ||
1274 | unsigned short bb_first_free; | ||
1275 | unsigned short bb_free; | ||
1276 | unsigned short bb_fragments; | ||
1277 | struct list_head bb_prealloc_list; | ||
1278 | #ifdef DOUBLE_CHECK | ||
1279 | void *bb_bitmap; | ||
1280 | #endif | ||
1281 | struct rw_semaphore alloc_sem; | ||
1282 | unsigned short bb_counters[]; | ||
1283 | }; | ||
1284 | |||
1285 | #define EXT4_GROUP_INFO_NEED_INIT_BIT 0 | ||
1286 | #define EXT4_GROUP_INFO_LOCKED_BIT 1 | ||
1287 | |||
1288 | #define EXT4_MB_GRP_NEED_INIT(grp) \ | ||
1289 | (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state))) | ||
1290 | |||
1291 | static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group) | ||
1292 | { | ||
1293 | struct ext4_group_info *grinfo = ext4_get_group_info(sb, group); | ||
1294 | |||
1295 | bit_spin_lock(EXT4_GROUP_INFO_LOCKED_BIT, &(grinfo->bb_state)); | ||
1296 | } | ||
1297 | |||
1298 | static inline void ext4_unlock_group(struct super_block *sb, | ||
1299 | ext4_group_t group) | ||
1300 | { | ||
1301 | struct ext4_group_info *grinfo = ext4_get_group_info(sb, group); | ||
1302 | |||
1303 | bit_spin_unlock(EXT4_GROUP_INFO_LOCKED_BIT, &(grinfo->bb_state)); | ||
1304 | } | ||
1305 | |||
1306 | static inline int ext4_is_group_locked(struct super_block *sb, | ||
1307 | ext4_group_t group) | ||
1308 | { | ||
1309 | struct ext4_group_info *grinfo = ext4_get_group_info(sb, group); | ||
1310 | |||
1311 | return bit_spin_is_locked(EXT4_GROUP_INFO_LOCKED_BIT, | ||
1312 | &(grinfo->bb_state)); | ||
1313 | } | ||
1314 | |||
1249 | /* | 1315 | /* |
1250 | * Inodes and files operations | 1316 | * Inodes and files operations |
1251 | */ | 1317 | */ |
@@ -1271,18 +1337,38 @@ extern int ext4_ext_writepage_trans_blocks(struct inode *, int); | |||
1271 | extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, | 1337 | extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, |
1272 | int chunk); | 1338 | int chunk); |
1273 | extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | 1339 | extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, |
1274 | ext4_lblk_t iblock, | 1340 | ext4_lblk_t iblock, unsigned int max_blocks, |
1275 | unsigned long max_blocks, struct buffer_head *bh_result, | 1341 | struct buffer_head *bh_result, |
1276 | int create, int extend_disksize); | 1342 | int create, int extend_disksize); |
1277 | extern void ext4_ext_truncate(struct inode *); | 1343 | extern void ext4_ext_truncate(struct inode *); |
1278 | extern void ext4_ext_init(struct super_block *); | 1344 | extern void ext4_ext_init(struct super_block *); |
1279 | extern void ext4_ext_release(struct super_block *); | 1345 | extern void ext4_ext_release(struct super_block *); |
1280 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1346 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
1281 | loff_t len); | 1347 | loff_t len); |
1282 | extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, | 1348 | extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, |
1283 | sector_t block, unsigned long max_blocks, | 1349 | sector_t block, unsigned int max_blocks, |
1284 | struct buffer_head *bh, int create, | 1350 | struct buffer_head *bh, int create, |
1285 | int extend_disksize, int flag); | 1351 | int extend_disksize, int flag); |
1352 | extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
1353 | __u64 start, __u64 len); | ||
1354 | |||
1355 | /* | ||
1356 | * Add new method to test wether block and inode bitmaps are properly | ||
1357 | * initialized. With uninit_bg reading the block from disk is not enough | ||
1358 | * to mark the bitmap uptodate. We need to also zero-out the bitmap | ||
1359 | */ | ||
1360 | #define BH_BITMAP_UPTODATE BH_JBDPrivateStart | ||
1361 | |||
1362 | static inline int bitmap_uptodate(struct buffer_head *bh) | ||
1363 | { | ||
1364 | return (buffer_uptodate(bh) && | ||
1365 | test_bit(BH_BITMAP_UPTODATE, &(bh)->b_state)); | ||
1366 | } | ||
1367 | static inline void set_bitmap_uptodate(struct buffer_head *bh) | ||
1368 | { | ||
1369 | set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state); | ||
1370 | } | ||
1371 | |||
1286 | #endif /* __KERNEL__ */ | 1372 | #endif /* __KERNEL__ */ |
1287 | 1373 | ||
1288 | #endif /* _EXT4_H */ | 1374 | #endif /* _EXT4_H */ |