diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 93 |
1 files changed, 44 insertions, 49 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 6083bb38057b..d0f15ef56de1 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -33,14 +33,6 @@ | |||
33 | #undef EXT4FS_DEBUG | 33 | #undef EXT4FS_DEBUG |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Define EXT4_RESERVATION to reserve data blocks for expanding files | ||
37 | */ | ||
38 | #define EXT4_DEFAULT_RESERVE_BLOCKS 8 | ||
39 | /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ | ||
40 | #define EXT4_MAX_RESERVE_BLOCKS 1027 | ||
41 | #define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0 | ||
42 | |||
43 | /* | ||
44 | * Debug code | 36 | * Debug code |
45 | */ | 37 | */ |
46 | #ifdef EXT4FS_DEBUG | 38 | #ifdef EXT4FS_DEBUG |
@@ -54,8 +46,6 @@ | |||
54 | #define ext4_debug(f, a...) do {} while (0) | 46 | #define ext4_debug(f, a...) do {} while (0) |
55 | #endif | 47 | #endif |
56 | 48 | ||
57 | #define EXT4_MULTIBLOCK_ALLOCATOR 1 | ||
58 | |||
59 | /* prefer goal again. length */ | 49 | /* prefer goal again. length */ |
60 | #define EXT4_MB_HINT_MERGE 1 | 50 | #define EXT4_MB_HINT_MERGE 1 |
61 | /* blocks already reserved */ | 51 | /* blocks already reserved */ |
@@ -180,8 +170,9 @@ struct ext4_group_desc | |||
180 | */ | 170 | */ |
181 | 171 | ||
182 | struct flex_groups { | 172 | struct flex_groups { |
183 | __u32 free_inodes; | 173 | atomic_t free_inodes; |
184 | __u32 free_blocks; | 174 | atomic_t free_blocks; |
175 | atomic_t used_dirs; | ||
185 | }; | 176 | }; |
186 | 177 | ||
187 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ | 178 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ |
@@ -249,6 +240,30 @@ struct flex_groups { | |||
249 | #define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ | 240 | #define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ |
250 | #define EXT4_FL_USER_MODIFIABLE 0x000B80FF /* User modifiable flags */ | 241 | #define EXT4_FL_USER_MODIFIABLE 0x000B80FF /* User modifiable flags */ |
251 | 242 | ||
243 | /* Flags that should be inherited by new inodes from their parent. */ | ||
244 | #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ | ||
245 | EXT4_SYNC_FL | EXT4_IMMUTABLE_FL | EXT4_APPEND_FL |\ | ||
246 | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ | ||
247 | EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ | ||
248 | EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL) | ||
249 | |||
250 | /* Flags that are appropriate for regular files (all but dir-specific ones). */ | ||
251 | #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL)) | ||
252 | |||
253 | /* Flags that are appropriate for non-directories/regular files. */ | ||
254 | #define EXT4_OTHER_FLMASK (EXT4_NODUMP_FL | EXT4_NOATIME_FL) | ||
255 | |||
256 | /* Mask out flags that are inappropriate for the given type of inode. */ | ||
257 | static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags) | ||
258 | { | ||
259 | if (S_ISDIR(mode)) | ||
260 | return flags; | ||
261 | else if (S_ISREG(mode)) | ||
262 | return flags & EXT4_REG_FLMASK; | ||
263 | else | ||
264 | return flags & EXT4_OTHER_FLMASK; | ||
265 | } | ||
266 | |||
252 | /* | 267 | /* |
253 | * Inode dynamic state flags | 268 | * Inode dynamic state flags |
254 | */ | 269 | */ |
@@ -256,6 +271,7 @@ struct flex_groups { | |||
256 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ | 271 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ |
257 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | 272 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ |
258 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ | 273 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ |
274 | #define EXT4_STATE_DA_ALLOC_CLOSE 0x00000010 /* Alloc DA blks on close */ | ||
259 | 275 | ||
260 | /* Used to pass group descriptor data when online resize is done */ | 276 | /* Used to pass group descriptor data when online resize is done */ |
261 | struct ext4_new_group_input { | 277 | struct ext4_new_group_input { |
@@ -303,7 +319,9 @@ struct ext4_new_group_data { | |||
303 | #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) | 319 | #define EXT4_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) |
304 | #define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input) | 320 | #define EXT4_IOC_GROUP_ADD _IOW('f', 8, struct ext4_new_group_input) |
305 | #define EXT4_IOC_MIGRATE _IO('f', 9) | 321 | #define EXT4_IOC_MIGRATE _IO('f', 9) |
322 | /* note ioctl 10 reserved for an early version of the FIEMAP ioctl */ | ||
306 | /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */ | 323 | /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */ |
324 | #define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12) | ||
307 | 325 | ||
308 | /* | 326 | /* |
309 | * ioctl commands in 32 bit emulation | 327 | * ioctl commands in 32 bit emulation |
@@ -531,7 +549,7 @@ do { \ | |||
531 | #define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */ | 549 | #define EXT4_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */ |
532 | #define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */ | 550 | #define EXT4_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */ |
533 | #define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ | 551 | #define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ |
534 | #define EXT4_MOUNT_RESERVATION 0x10000 /* Preallocation */ | 552 | #define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */ |
535 | #define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */ | 553 | #define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */ |
536 | #define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */ | 554 | #define EXT4_MOUNT_NOBH 0x40000 /* No bufferheads */ |
537 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ | 555 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ |
@@ -666,7 +684,8 @@ struct ext4_super_block { | |||
666 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ | 684 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ |
667 | __u8 s_reserved_char_pad2; | 685 | __u8 s_reserved_char_pad2; |
668 | __le16 s_reserved_pad; | 686 | __le16 s_reserved_pad; |
669 | __u32 s_reserved[162]; /* Padding to the end of the block */ | 687 | __le64 s_kbytes_written; /* nr of lifetime kilobytes written */ |
688 | __u32 s_reserved[160]; /* Padding to the end of the block */ | ||
670 | }; | 689 | }; |
671 | 690 | ||
672 | #ifdef __KERNEL__ | 691 | #ifdef __KERNEL__ |
@@ -814,6 +833,12 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
814 | #define EXT4_DEF_MAX_BATCH_TIME 15000 /* 15ms */ | 833 | #define EXT4_DEF_MAX_BATCH_TIME 15000 /* 15ms */ |
815 | 834 | ||
816 | /* | 835 | /* |
836 | * Minimum number of groups in a flexgroup before we separate out | ||
837 | * directories into the first block group of a flexgroup | ||
838 | */ | ||
839 | #define EXT4_FLEX_SIZE_DIR_ALLOC_SCHEME 4 | ||
840 | |||
841 | /* | ||
817 | * Structure of a directory entry | 842 | * Structure of a directory entry |
818 | */ | 843 | */ |
819 | #define EXT4_NAME_LEN 255 | 844 | #define EXT4_NAME_LEN 255 |
@@ -865,24 +890,6 @@ struct ext4_dir_entry_2 { | |||
865 | ~EXT4_DIR_ROUND) | 890 | ~EXT4_DIR_ROUND) |
866 | #define EXT4_MAX_REC_LEN ((1<<16)-1) | 891 | #define EXT4_MAX_REC_LEN ((1<<16)-1) |
867 | 892 | ||
868 | static inline unsigned ext4_rec_len_from_disk(__le16 dlen) | ||
869 | { | ||
870 | unsigned len = le16_to_cpu(dlen); | ||
871 | |||
872 | if (len == EXT4_MAX_REC_LEN || len == 0) | ||
873 | return 1 << 16; | ||
874 | return len; | ||
875 | } | ||
876 | |||
877 | static inline __le16 ext4_rec_len_to_disk(unsigned len) | ||
878 | { | ||
879 | if (len == (1 << 16)) | ||
880 | return cpu_to_le16(EXT4_MAX_REC_LEN); | ||
881 | else if (len > (1 << 16)) | ||
882 | BUG(); | ||
883 | return cpu_to_le16(len); | ||
884 | } | ||
885 | |||
886 | /* | 893 | /* |
887 | * Hash Tree Directory indexing | 894 | * Hash Tree Directory indexing |
888 | * (c) Daniel Phillips, 2001 | 895 | * (c) Daniel Phillips, 2001 |
@@ -970,22 +977,6 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | |||
970 | 977 | ||
971 | extern struct proc_dir_entry *ext4_proc_root; | 978 | extern struct proc_dir_entry *ext4_proc_root; |
972 | 979 | ||
973 | #ifdef CONFIG_PROC_FS | ||
974 | extern const struct file_operations ext4_ui_proc_fops; | ||
975 | |||
976 | #define EXT4_PROC_HANDLER(name, var) \ | ||
977 | do { \ | ||
978 | proc = proc_create_data(name, mode, sbi->s_proc, \ | ||
979 | &ext4_ui_proc_fops, &sbi->s_##var); \ | ||
980 | if (proc == NULL) { \ | ||
981 | printk(KERN_ERR "EXT4-fs: can't create %s\n", name); \ | ||
982 | goto err_out; \ | ||
983 | } \ | ||
984 | } while (0) | ||
985 | #else | ||
986 | #define EXT4_PROC_HANDLER(name, var) | ||
987 | #endif | ||
988 | |||
989 | /* | 980 | /* |
990 | * Function prototypes | 981 | * Function prototypes |
991 | */ | 982 | */ |
@@ -1092,13 +1083,14 @@ extern int ext4_can_truncate(struct inode *inode); | |||
1092 | extern void ext4_truncate(struct inode *); | 1083 | extern void ext4_truncate(struct inode *); |
1093 | extern void ext4_set_inode_flags(struct inode *); | 1084 | extern void ext4_set_inode_flags(struct inode *); |
1094 | extern void ext4_get_inode_flags(struct ext4_inode_info *); | 1085 | extern void ext4_get_inode_flags(struct ext4_inode_info *); |
1086 | extern int ext4_alloc_da_blocks(struct inode *inode); | ||
1095 | extern void ext4_set_aops(struct inode *inode); | 1087 | extern void ext4_set_aops(struct inode *inode); |
1096 | extern int ext4_writepage_trans_blocks(struct inode *); | 1088 | extern int ext4_writepage_trans_blocks(struct inode *); |
1097 | extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks); | 1089 | extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks); |
1098 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); | 1090 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); |
1099 | extern int ext4_block_truncate_page(handle_t *handle, | 1091 | extern int ext4_block_truncate_page(handle_t *handle, |
1100 | struct address_space *mapping, loff_t from); | 1092 | struct address_space *mapping, loff_t from); |
1101 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page); | 1093 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
1102 | extern qsize_t ext4_get_reserved_space(struct inode *inode); | 1094 | extern qsize_t ext4_get_reserved_space(struct inode *inode); |
1103 | 1095 | ||
1104 | /* ioctl.c */ | 1096 | /* ioctl.c */ |
@@ -1107,7 +1099,10 @@ extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); | |||
1107 | 1099 | ||
1108 | /* migrate.c */ | 1100 | /* migrate.c */ |
1109 | extern int ext4_ext_migrate(struct inode *); | 1101 | extern int ext4_ext_migrate(struct inode *); |
1102 | |||
1110 | /* namei.c */ | 1103 | /* namei.c */ |
1104 | extern unsigned int ext4_rec_len_from_disk(__le16 dlen, unsigned blocksize); | ||
1105 | extern __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize); | ||
1111 | extern int ext4_orphan_add(handle_t *, struct inode *); | 1106 | extern int ext4_orphan_add(handle_t *, struct inode *); |
1112 | extern int ext4_orphan_del(handle_t *, struct inode *); | 1107 | extern int ext4_orphan_del(handle_t *, struct inode *); |
1113 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | 1108 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, |