diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 13:57:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 13:57:49 -0400 |
commit | 395d73413c5656c6d7706ae91dcb441f9b7e3074 (patch) | |
tree | 7fadabe996f70d7918583fa2312d4fad19397fcb /fs/ext4/ext4.h | |
parent | c226fd659fa7b6a7b038df5ae6856a68514bacde (diff) | |
parent | 06705bff9114531a997a7d0c2520bea0f2927410 (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: (33 commits)
ext4: Regularize mount options
ext4: fix locking typo in mballoc which could cause soft lockup hangs
ext4: fix typo which causes a memory leak on error path
jbd2: Update locking coments
ext4: Rename pa_linear to pa_type
ext4: add checks of block references for non-extent inodes
ext4: Check for an valid i_mode when reading the inode from disk
ext4: Use WRITE_SYNC for commits which are caused by fsync()
ext4: Add auto_da_alloc mount option
ext4: Use struct flex_groups to calculate get_orlov_stats()
ext4: Use atomic_t's in struct flex_groups
ext4: remove /proc tuning knobs
ext4: Add sysfs support
ext4: Track lifetime disk writes
ext4: Fix discard of inode prealloc space with delayed allocation.
ext4: Automatically allocate delay allocated blocks on rename
ext4: Automatically allocate delay allocated blocks on close
ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl
ext4: Simplify delalloc code by removing mpage_da_writepages()
ext4: Save stack space by removing fake buffer heads
...
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 91 |
1 files changed, 43 insertions, 48 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 990c94000924..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,6 +1083,7 @@ 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); |
@@ -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, |