diff options
Diffstat (limited to 'fs/ext4/ext4.h')
| -rw-r--r-- | fs/ext4/ext4.h | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 8158083f7ac0..303e41cf7b14 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | #include "ext4_i.h" | 22 | #include "ext4_i.h" |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * The second extended filesystem constants/structures | 25 | * The fourth extended filesystem constants/structures |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| @@ -45,7 +45,7 @@ | |||
| 45 | #define ext4_debug(f, a...) \ | 45 | #define ext4_debug(f, a...) \ |
| 46 | do { \ | 46 | do { \ |
| 47 | printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \ | 47 | printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:", \ |
| 48 | __FILE__, __LINE__, __FUNCTION__); \ | 48 | __FILE__, __LINE__, __func__); \ |
| 49 | printk (KERN_DEBUG f, ## a); \ | 49 | printk (KERN_DEBUG f, ## a); \ |
| 50 | } while (0) | 50 | } while (0) |
| 51 | #else | 51 | #else |
| @@ -74,6 +74,9 @@ | |||
| 74 | #define EXT4_MB_HINT_GOAL_ONLY 256 | 74 | #define EXT4_MB_HINT_GOAL_ONLY 256 |
| 75 | /* goal is meaningful */ | 75 | /* goal is meaningful */ |
| 76 | #define EXT4_MB_HINT_TRY_GOAL 512 | 76 | #define EXT4_MB_HINT_TRY_GOAL 512 |
| 77 | /* blocks already pre-reserved by delayed allocation */ | ||
| 78 | #define EXT4_MB_DELALLOC_RESERVED 1024 | ||
| 79 | |||
| 77 | 80 | ||
| 78 | struct ext4_allocation_request { | 81 | struct ext4_allocation_request { |
| 79 | /* target inode for block we're allocating */ | 82 | /* target inode for block we're allocating */ |
| @@ -170,6 +173,15 @@ struct ext4_group_desc | |||
| 170 | __u32 bg_reserved2[3]; | 173 | __u32 bg_reserved2[3]; |
| 171 | }; | 174 | }; |
| 172 | 175 | ||
| 176 | /* | ||
| 177 | * Structure of a flex block group info | ||
| 178 | */ | ||
| 179 | |||
| 180 | struct flex_groups { | ||
| 181 | __u32 free_inodes; | ||
| 182 | __u32 free_blocks; | ||
| 183 | }; | ||
| 184 | |||
| 173 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ | 185 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ |
| 174 | #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */ | 186 | #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */ |
| 175 | #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ | 187 | #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ |
| @@ -527,6 +539,7 @@ do { \ | |||
| 527 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 539 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
| 528 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | 540 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ |
| 529 | #define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */ | 541 | #define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */ |
| 542 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ | ||
| 530 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ | 543 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ |
| 531 | #ifndef _LINUX_EXT2_FS_H | 544 | #ifndef _LINUX_EXT2_FS_H |
| 532 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt | 545 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt |
| @@ -647,7 +660,10 @@ struct ext4_super_block { | |||
| 647 | __le16 s_mmp_interval; /* # seconds to wait in MMP checking */ | 660 | __le16 s_mmp_interval; /* # seconds to wait in MMP checking */ |
| 648 | __le64 s_mmp_block; /* Block for multi-mount protection */ | 661 | __le64 s_mmp_block; /* Block for multi-mount protection */ |
| 649 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | 662 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ |
| 650 | __u32 s_reserved[163]; /* Padding to the end of the block */ | 663 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ |
| 664 | __u8 s_reserved_char_pad2; | ||
| 665 | __le16 s_reserved_pad; | ||
| 666 | __u32 s_reserved[162]; /* Padding to the end of the block */ | ||
| 651 | }; | 667 | }; |
| 652 | 668 | ||
| 653 | #ifdef __KERNEL__ | 669 | #ifdef __KERNEL__ |
| @@ -958,12 +974,17 @@ extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, | |||
| 958 | extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group); | 974 | extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group); |
| 959 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, | 975 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, |
| 960 | ext4_group_t group); | 976 | ext4_group_t group); |
| 961 | extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, | 977 | extern ext4_fsblk_t ext4_new_meta_block(handle_t *handle, struct inode *inode, |
| 962 | ext4_fsblk_t goal, int *errp); | 978 | ext4_fsblk_t goal, int *errp); |
| 963 | extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, | 979 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, |
| 964 | ext4_fsblk_t goal, unsigned long *count, int *errp); | 980 | ext4_fsblk_t goal, unsigned long *count, int *errp); |
| 965 | extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode, | 981 | extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, |
| 982 | ext4_lblk_t iblock, ext4_fsblk_t goal, | ||
| 983 | unsigned long *count, int *errp); | ||
| 984 | extern ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, | ||
| 966 | ext4_fsblk_t goal, unsigned long *count, int *errp); | 985 | ext4_fsblk_t goal, unsigned long *count, int *errp); |
| 986 | extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, | ||
| 987 | ext4_fsblk_t nblocks); | ||
| 967 | extern void ext4_free_blocks (handle_t *handle, struct inode *inode, | 988 | extern void ext4_free_blocks (handle_t *handle, struct inode *inode, |
| 968 | ext4_fsblk_t block, unsigned long count, int metadata); | 989 | ext4_fsblk_t block, unsigned long count, int metadata); |
| 969 | extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, | 990 | extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, |
| @@ -1016,9 +1037,14 @@ extern int __init init_ext4_mballoc(void); | |||
| 1016 | extern void exit_ext4_mballoc(void); | 1037 | extern void exit_ext4_mballoc(void); |
| 1017 | extern void ext4_mb_free_blocks(handle_t *, struct inode *, | 1038 | extern void ext4_mb_free_blocks(handle_t *, struct inode *, |
| 1018 | unsigned long, unsigned long, int, unsigned long *); | 1039 | unsigned long, unsigned long, int, unsigned long *); |
| 1040 | extern int ext4_mb_add_more_groupinfo(struct super_block *sb, | ||
| 1041 | ext4_group_t i, struct ext4_group_desc *desc); | ||
| 1042 | extern void ext4_mb_update_group_info(struct ext4_group_info *grp, | ||
| 1043 | ext4_grpblk_t add); | ||
| 1019 | 1044 | ||
| 1020 | 1045 | ||
| 1021 | /* inode.c */ | 1046 | /* inode.c */ |
| 1047 | void ext4_da_release_space(struct inode *inode, int used, int to_free); | ||
| 1022 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, | 1048 | int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, |
| 1023 | struct buffer_head *bh, ext4_fsblk_t blocknr); | 1049 | struct buffer_head *bh, ext4_fsblk_t blocknr); |
| 1024 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, | 1050 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, |
| @@ -1033,19 +1059,23 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, | |||
| 1033 | extern struct inode *ext4_iget(struct super_block *, unsigned long); | 1059 | extern struct inode *ext4_iget(struct super_block *, unsigned long); |
| 1034 | extern int ext4_write_inode (struct inode *, int); | 1060 | extern int ext4_write_inode (struct inode *, int); |
| 1035 | extern int ext4_setattr (struct dentry *, struct iattr *); | 1061 | extern int ext4_setattr (struct dentry *, struct iattr *); |
| 1062 | extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, | ||
| 1063 | struct kstat *stat); | ||
| 1036 | extern void ext4_delete_inode (struct inode *); | 1064 | extern void ext4_delete_inode (struct inode *); |
| 1037 | extern int ext4_sync_inode (handle_t *, struct inode *); | 1065 | extern int ext4_sync_inode (handle_t *, struct inode *); |
| 1038 | extern void ext4_discard_reservation (struct inode *); | 1066 | extern void ext4_discard_reservation (struct inode *); |
| 1039 | extern void ext4_dirty_inode(struct inode *); | 1067 | extern void ext4_dirty_inode(struct inode *); |
| 1040 | extern int ext4_change_inode_journal_flag(struct inode *, int); | 1068 | extern int ext4_change_inode_journal_flag(struct inode *, int); |
| 1041 | extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); | 1069 | extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); |
| 1070 | extern int ext4_can_truncate(struct inode *inode); | ||
| 1042 | extern void ext4_truncate (struct inode *); | 1071 | extern void ext4_truncate (struct inode *); |
| 1043 | extern void ext4_set_inode_flags(struct inode *); | 1072 | extern void ext4_set_inode_flags(struct inode *); |
| 1044 | extern void ext4_get_inode_flags(struct ext4_inode_info *); | 1073 | extern void ext4_get_inode_flags(struct ext4_inode_info *); |
| 1045 | extern void ext4_set_aops(struct inode *inode); | 1074 | extern void ext4_set_aops(struct inode *inode); |
| 1046 | extern int ext4_writepage_trans_blocks(struct inode *); | 1075 | extern int ext4_writepage_trans_blocks(struct inode *); |
| 1047 | extern int ext4_block_truncate_page(handle_t *handle, struct page *page, | 1076 | extern int ext4_block_truncate_page(handle_t *handle, |
| 1048 | struct address_space *mapping, loff_t from); | 1077 | struct address_space *mapping, loff_t from); |
| 1078 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page); | ||
| 1049 | 1079 | ||
| 1050 | /* ioctl.c */ | 1080 | /* ioctl.c */ |
| 1051 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); | 1081 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); |
| @@ -1159,10 +1189,21 @@ struct ext4_group_info *ext4_get_group_info(struct super_block *sb, | |||
| 1159 | } | 1189 | } |
| 1160 | 1190 | ||
| 1161 | 1191 | ||
| 1192 | static inline ext4_group_t ext4_flex_group(struct ext4_sb_info *sbi, | ||
| 1193 | ext4_group_t block_group) | ||
| 1194 | { | ||
| 1195 | return block_group >> sbi->s_log_groups_per_flex; | ||
| 1196 | } | ||
| 1197 | |||
| 1198 | static inline unsigned int ext4_flex_bg_size(struct ext4_sb_info *sbi) | ||
| 1199 | { | ||
| 1200 | return 1 << sbi->s_log_groups_per_flex; | ||
| 1201 | } | ||
| 1202 | |||
| 1162 | #define ext4_std_error(sb, errno) \ | 1203 | #define ext4_std_error(sb, errno) \ |
| 1163 | do { \ | 1204 | do { \ |
| 1164 | if ((errno)) \ | 1205 | if ((errno)) \ |
| 1165 | __ext4_std_error((sb), __FUNCTION__, (errno)); \ | 1206 | __ext4_std_error((sb), __func__, (errno)); \ |
| 1166 | } while (0) | 1207 | } while (0) |
| 1167 | 1208 | ||
| 1168 | /* | 1209 | /* |
| @@ -1191,7 +1232,7 @@ extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
| 1191 | ext4_lblk_t iblock, | 1232 | ext4_lblk_t iblock, |
| 1192 | unsigned long max_blocks, struct buffer_head *bh_result, | 1233 | unsigned long max_blocks, struct buffer_head *bh_result, |
| 1193 | int create, int extend_disksize); | 1234 | int create, int extend_disksize); |
| 1194 | extern void ext4_ext_truncate(struct inode *, struct page *); | 1235 | extern void ext4_ext_truncate(struct inode *); |
| 1195 | extern void ext4_ext_init(struct super_block *); | 1236 | extern void ext4_ext_init(struct super_block *); |
| 1196 | extern void ext4_ext_release(struct super_block *); | 1237 | extern void ext4_ext_release(struct super_block *); |
| 1197 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1238 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
| @@ -1199,7 +1240,7 @@ extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | |||
| 1199 | extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, | 1240 | extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, |
| 1200 | sector_t block, unsigned long max_blocks, | 1241 | sector_t block, unsigned long max_blocks, |
| 1201 | struct buffer_head *bh, int create, | 1242 | struct buffer_head *bh, int create, |
| 1202 | int extend_disksize); | 1243 | int extend_disksize, int flag); |
| 1203 | #endif /* __KERNEL__ */ | 1244 | #endif /* __KERNEL__ */ |
| 1204 | 1245 | ||
| 1205 | #endif /* _EXT4_H */ | 1246 | #endif /* _EXT4_H */ |
