aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h347
1 files changed, 273 insertions, 74 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 889ec9d5e6ad..1921392cd708 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -62,8 +62,8 @@
62#define EXT4_ERROR_INODE_BLOCK(inode, block, fmt, a...) \ 62#define EXT4_ERROR_INODE_BLOCK(inode, block, fmt, a...) \
63 ext4_error_inode((inode), __func__, __LINE__, (block), (fmt), ## a) 63 ext4_error_inode((inode), __func__, __LINE__, (block), (fmt), ## a)
64 64
65#define EXT4_ERROR_FILE(file, fmt, a...) \ 65#define EXT4_ERROR_FILE(file, block, fmt, a...) \
66 ext4_error_file(__func__, __LINE__, (file), (fmt), ## a) 66 ext4_error_file((file), __func__, __LINE__, (block), (fmt), ## a)
67 67
68/* data type for block offset of block group */ 68/* data type for block offset of block group */
69typedef int ext4_grpblk_t; 69typedef int ext4_grpblk_t;
@@ -108,7 +108,8 @@ typedef unsigned int ext4_group_t;
108#define EXT4_MB_DELALLOC_RESERVED 0x0400 108#define EXT4_MB_DELALLOC_RESERVED 0x0400
109/* We are doing stream allocation */ 109/* We are doing stream allocation */
110#define EXT4_MB_STREAM_ALLOC 0x0800 110#define EXT4_MB_STREAM_ALLOC 0x0800
111 111/* Use reserved root blocks if needed */
112#define EXT4_MB_USE_ROOT_BLOCKS 0x1000
112 113
113struct ext4_allocation_request { 114struct ext4_allocation_request {
114 /* target inode for block we're allocating */ 115 /* target inode for block we're allocating */
@@ -168,7 +169,20 @@ struct mpage_da_data {
168 int pages_written; 169 int pages_written;
169 int retval; 170 int retval;
170}; 171};
171#define EXT4_IO_UNWRITTEN 0x1 172
173/*
174 * Flags for ext4_io_end->flags
175 */
176#define EXT4_IO_END_UNWRITTEN 0x0001
177#define EXT4_IO_END_ERROR 0x0002
178
179struct ext4_io_page {
180 struct page *p_page;
181 atomic_t p_count;
182};
183
184#define MAX_IO_PAGES 128
185
172typedef struct ext4_io_end { 186typedef struct ext4_io_end {
173 struct list_head list; /* per-file finished IO list */ 187 struct list_head list; /* per-file finished IO list */
174 struct inode *inode; /* file being written to */ 188 struct inode *inode; /* file being written to */
@@ -179,13 +193,25 @@ typedef struct ext4_io_end {
179 struct work_struct work; /* data work queue */ 193 struct work_struct work; /* data work queue */
180 struct kiocb *iocb; /* iocb struct for AIO */ 194 struct kiocb *iocb; /* iocb struct for AIO */
181 int result; /* error value for AIO */ 195 int result; /* error value for AIO */
196 int num_io_pages;
197 struct ext4_io_page *pages[MAX_IO_PAGES];
182} ext4_io_end_t; 198} ext4_io_end_t;
183 199
200struct ext4_io_submit {
201 int io_op;
202 struct bio *io_bio;
203 ext4_io_end_t *io_end;
204 struct ext4_io_page *io_page;
205 sector_t io_next_block;
206};
207
184/* 208/*
185 * Special inodes numbers 209 * Special inodes numbers
186 */ 210 */
187#define EXT4_BAD_INO 1 /* Bad blocks inode */ 211#define EXT4_BAD_INO 1 /* Bad blocks inode */
188#define EXT4_ROOT_INO 2 /* Root inode */ 212#define EXT4_ROOT_INO 2 /* Root inode */
213#define EXT4_USR_QUOTA_INO 3 /* User quota inode */
214#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */
189#define EXT4_BOOT_LOADER_INO 5 /* Boot loader inode */ 215#define EXT4_BOOT_LOADER_INO 5 /* Boot loader inode */
190#define EXT4_UNDEL_DIR_INO 6 /* Undelete directory inode */ 216#define EXT4_UNDEL_DIR_INO 6 /* Undelete directory inode */
191#define EXT4_RESIZE_INO 7 /* Reserved group descriptors inode */ 217#define EXT4_RESIZE_INO 7 /* Reserved group descriptors inode */
@@ -205,6 +231,7 @@ typedef struct ext4_io_end {
205#define EXT4_MIN_BLOCK_SIZE 1024 231#define EXT4_MIN_BLOCK_SIZE 1024
206#define EXT4_MAX_BLOCK_SIZE 65536 232#define EXT4_MAX_BLOCK_SIZE 65536
207#define EXT4_MIN_BLOCK_LOG_SIZE 10 233#define EXT4_MIN_BLOCK_LOG_SIZE 10
234#define EXT4_MAX_BLOCK_LOG_SIZE 16
208#ifdef __KERNEL__ 235#ifdef __KERNEL__
209# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) 236# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
210#else 237#else
@@ -488,6 +515,10 @@ struct ext4_new_group_data {
488 /* Convert extent to initialized after IO complete */ 515 /* Convert extent to initialized after IO complete */
489#define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ 516#define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\
490 EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) 517 EXT4_GET_BLOCKS_CREATE_UNINIT_EXT)
518 /* Punch out blocks of an extent */
519#define EXT4_GET_BLOCKS_PUNCH_OUT_EXT 0x0020
520 /* Don't normalize allocation size (used for fallocate) */
521#define EXT4_GET_BLOCKS_NO_NORMALIZE 0x0040
491 522
492/* 523/*
493 * Flags used by ext4_free_blocks 524 * Flags used by ext4_free_blocks
@@ -537,23 +568,7 @@ struct ext4_new_group_data {
537#define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION 568#define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
538#endif 569#endif
539 570
540 571/* Max physical block we can address w/o extents */
541/*
542 * Mount options
543 */
544struct ext4_mount_options {
545 unsigned long s_mount_opt;
546 uid_t s_resuid;
547 gid_t s_resgid;
548 unsigned long s_commit_interval;
549 u32 s_min_batch_time, s_max_batch_time;
550#ifdef CONFIG_QUOTA
551 int s_jquota_fmt;
552 char *s_qf_names[MAXQUOTAS];
553#endif
554};
555
556/* Max physical block we can addres w/o extents */
557#define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF 572#define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF
558 573
559/* 574/*
@@ -685,6 +700,8 @@ do { \
685 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \ 700 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
686 ext4_decode_extra_time(&(inode)->xtime, \ 701 ext4_decode_extra_time(&(inode)->xtime, \
687 raw_inode->xtime ## _extra); \ 702 raw_inode->xtime ## _extra); \
703 else \
704 (inode)->xtime.tv_nsec = 0; \
688} while (0) 705} while (0)
689 706
690#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \ 707#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
@@ -695,6 +712,8 @@ do { \
695 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \ 712 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
696 ext4_decode_extra_time(&(einode)->xtime, \ 713 ext4_decode_extra_time(&(einode)->xtime, \
697 raw_inode->xtime ## _extra); \ 714 raw_inode->xtime ## _extra); \
715 else \
716 (einode)->xtime.tv_nsec = 0; \
698} while (0) 717} while (0)
699 718
700#define i_disk_version osd1.linux1.l_i_version 719#define i_disk_version osd1.linux1.l_i_version
@@ -726,12 +745,13 @@ do { \
726 745
727/* 746/*
728 * storage for cached extent 747 * storage for cached extent
748 * If ec_len == 0, then the cache is invalid.
749 * If ec_start == 0, then the cache represents a gap (null mapping)
729 */ 750 */
730struct ext4_ext_cache { 751struct ext4_ext_cache {
731 ext4_fsblk_t ec_start; 752 ext4_fsblk_t ec_start;
732 ext4_lblk_t ec_block; 753 ext4_lblk_t ec_block;
733 __u32 ec_len; /* must be 32bit to return holes */ 754 __u32 ec_len; /* must be 32bit to return holes */
734 __u32 ec_type;
735}; 755};
736 756
737/* 757/*
@@ -750,10 +770,12 @@ struct ext4_inode_info {
750 * near to their parent directory's inode. 770 * near to their parent directory's inode.
751 */ 771 */
752 ext4_group_t i_block_group; 772 ext4_group_t i_block_group;
773 ext4_lblk_t i_dir_start_lookup;
774#if (BITS_PER_LONG < 64)
753 unsigned long i_state_flags; /* Dynamic state flags */ 775 unsigned long i_state_flags; /* Dynamic state flags */
776#endif
754 unsigned long i_flags; 777 unsigned long i_flags;
755 778
756 ext4_lblk_t i_dir_start_lookup;
757#ifdef CONFIG_EXT4_FS_XATTR 779#ifdef CONFIG_EXT4_FS_XATTR
758 /* 780 /*
759 * Extended attributes can be read independently of the main file 781 * Extended attributes can be read independently of the main file
@@ -796,7 +818,7 @@ struct ext4_inode_info {
796 */ 818 */
797 struct rw_semaphore i_data_sem; 819 struct rw_semaphore i_data_sem;
798 struct inode vfs_inode; 820 struct inode vfs_inode;
799 struct jbd2_inode jinode; 821 struct jbd2_inode *jinode;
800 822
801 struct ext4_ext_cache i_cached_extent; 823 struct ext4_ext_cache i_cached_extent;
802 /* 824 /*
@@ -816,14 +838,12 @@ struct ext4_inode_info {
816 unsigned int i_reserved_data_blocks; 838 unsigned int i_reserved_data_blocks;
817 unsigned int i_reserved_meta_blocks; 839 unsigned int i_reserved_meta_blocks;
818 unsigned int i_allocated_meta_blocks; 840 unsigned int i_allocated_meta_blocks;
819 unsigned short i_delalloc_reserved_flag; 841 ext4_lblk_t i_da_metadata_calc_last_lblock;
820 sector_t i_da_metadata_calc_last_lblock;
821 int i_da_metadata_calc_len; 842 int i_da_metadata_calc_len;
822 843
823 /* on-disk additional length */ 844 /* on-disk additional length */
824 __u16 i_extra_isize; 845 __u16 i_extra_isize;
825 846
826 spinlock_t i_block_reservation_lock;
827#ifdef CONFIG_QUOTA 847#ifdef CONFIG_QUOTA
828 /* quota space reservation, managed internally by quota code */ 848 /* quota space reservation, managed internally by quota code */
829 qsize_t i_reserved_quota; 849 qsize_t i_reserved_quota;
@@ -832,8 +852,12 @@ struct ext4_inode_info {
832 /* completed IOs that might need unwritten extents handling */ 852 /* completed IOs that might need unwritten extents handling */
833 struct list_head i_completed_io_list; 853 struct list_head i_completed_io_list;
834 spinlock_t i_completed_io_lock; 854 spinlock_t i_completed_io_lock;
855 atomic_t i_ioend_count; /* Number of outstanding io_end structs */
835 /* current io_end structure for async DIO write*/ 856 /* current io_end structure for async DIO write*/
836 ext4_io_end_t *cur_aio_dio; 857 ext4_io_end_t *cur_aio_dio;
858 atomic_t i_aiodio_unwritten; /* Nr. of inflight conversions pending */
859
860 spinlock_t i_block_reservation_lock;
837 861
838 /* 862 /*
839 * Transactions that contain inode's metadata needed to complete 863 * Transactions that contain inode's metadata needed to complete
@@ -885,24 +909,35 @@ struct ext4_inode_info {
885#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ 909#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
886#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ 910#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
887#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ 911#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
912#define EXT4_MOUNT_MBLK_IO_SUBMIT 0x4000000 /* multi-block io submits */
888#define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ 913#define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
889#define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ 914#define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
890#define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ 915#define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
891#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ 916#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */
917#define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */
892 918
893#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt 919#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
894#define set_opt(o, opt) o |= EXT4_MOUNT_##opt 920 ~EXT4_MOUNT_##opt
921#define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \
922 EXT4_MOUNT_##opt
895#define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \ 923#define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \
896 EXT4_MOUNT_##opt) 924 EXT4_MOUNT_##opt)
897 925
898#define ext4_set_bit ext2_set_bit 926#define clear_opt2(sb, opt) EXT4_SB(sb)->s_mount_opt2 &= \
927 ~EXT4_MOUNT2_##opt
928#define set_opt2(sb, opt) EXT4_SB(sb)->s_mount_opt2 |= \
929 EXT4_MOUNT2_##opt
930#define test_opt2(sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \
931 EXT4_MOUNT2_##opt)
932
933#define ext4_set_bit __test_and_set_bit_le
899#define ext4_set_bit_atomic ext2_set_bit_atomic 934#define ext4_set_bit_atomic ext2_set_bit_atomic
900#define ext4_clear_bit ext2_clear_bit 935#define ext4_clear_bit __test_and_clear_bit_le
901#define ext4_clear_bit_atomic ext2_clear_bit_atomic 936#define ext4_clear_bit_atomic ext2_clear_bit_atomic
902#define ext4_test_bit ext2_test_bit 937#define ext4_test_bit test_bit_le
903#define ext4_find_first_zero_bit ext2_find_first_zero_bit 938#define ext4_find_first_zero_bit find_first_zero_bit_le
904#define ext4_find_next_zero_bit ext2_find_next_zero_bit 939#define ext4_find_next_zero_bit find_next_zero_bit_le
905#define ext4_find_next_bit ext2_find_next_bit 940#define ext4_find_next_bit find_next_bit_le
906 941
907/* 942/*
908 * Maximal mount counts between two filesystem checks 943 * Maximal mount counts between two filesystem checks
@@ -1000,7 +1035,7 @@ struct ext4_super_block {
1000 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */ 1035 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
1001 __le32 s_flags; /* Miscellaneous flags */ 1036 __le32 s_flags; /* Miscellaneous flags */
1002 __le16 s_raid_stride; /* RAID stride */ 1037 __le16 s_raid_stride; /* RAID stride */
1003 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */ 1038 __le16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
1004 __le64 s_mmp_block; /* Block for multi-mount protection */ 1039 __le64 s_mmp_block; /* Block for multi-mount protection */
1005 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ 1040 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
1006 __u8 s_log_groups_per_flex; /* FLEX_BG group size */ 1041 __u8 s_log_groups_per_flex; /* FLEX_BG group size */
@@ -1060,6 +1095,7 @@ struct ext4_sb_info {
1060 struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ 1095 struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */
1061 struct buffer_head **s_group_desc; 1096 struct buffer_head **s_group_desc;
1062 unsigned int s_mount_opt; 1097 unsigned int s_mount_opt;
1098 unsigned int s_mount_opt2;
1063 unsigned int s_mount_flags; 1099 unsigned int s_mount_flags;
1064 ext4_fsblk_t s_sb_block; 1100 ext4_fsblk_t s_sb_block;
1065 uid_t s_resuid; 1101 uid_t s_resuid;
@@ -1087,7 +1123,6 @@ struct ext4_sb_info {
1087 struct completion s_kobj_unregister; 1123 struct completion s_kobj_unregister;
1088 1124
1089 /* Journaling */ 1125 /* Journaling */
1090 struct inode *s_journal_inode;
1091 struct journal_s *s_journal; 1126 struct journal_s *s_journal;
1092 struct list_head s_orphan; 1127 struct list_head s_orphan;
1093 struct mutex s_orphan_lock; 1128 struct mutex s_orphan_lock;
@@ -1116,14 +1151,14 @@ struct ext4_sb_info {
1116 unsigned long s_ext_blocks; 1151 unsigned long s_ext_blocks;
1117 unsigned long s_ext_extents; 1152 unsigned long s_ext_extents;
1118#endif 1153#endif
1154 /* ext4 extent cache stats */
1155 unsigned long extent_cache_hits;
1156 unsigned long extent_cache_misses;
1119 1157
1120 /* for buddy allocator */ 1158 /* for buddy allocator */
1121 struct ext4_group_info ***s_group_info; 1159 struct ext4_group_info ***s_group_info;
1122 struct inode *s_buddy_cache; 1160 struct inode *s_buddy_cache;
1123 long s_blocks_reserved;
1124 spinlock_t s_reserve_lock;
1125 spinlock_t s_md_lock; 1161 spinlock_t s_md_lock;
1126 tid_t s_last_transaction;
1127 unsigned short *s_mb_offsets; 1162 unsigned short *s_mb_offsets;
1128 unsigned int *s_mb_maxs; 1163 unsigned int *s_mb_maxs;
1129 1164
@@ -1141,7 +1176,6 @@ struct ext4_sb_info {
1141 unsigned long s_mb_last_start; 1176 unsigned long s_mb_last_start;
1142 1177
1143 /* stats for buddy allocator */ 1178 /* stats for buddy allocator */
1144 spinlock_t s_mb_pa_lock;
1145 atomic_t s_bal_reqs; /* number of reqs with len > 1 */ 1179 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
1146 atomic_t s_bal_success; /* we found long enough chunks */ 1180 atomic_t s_bal_success; /* we found long enough chunks */
1147 atomic_t s_bal_allocated; /* in blocks */ 1181 atomic_t s_bal_allocated; /* in blocks */
@@ -1172,6 +1206,14 @@ struct ext4_sb_info {
1172 1206
1173 /* timer for periodic error stats printing */ 1207 /* timer for periodic error stats printing */
1174 struct timer_list s_err_report; 1208 struct timer_list s_err_report;
1209
1210 /* Lazy inode table initialization info */
1211 struct ext4_li_request *s_li_request;
1212 /* Wait multiplier for lazy initialization thread */
1213 unsigned int s_li_wait_mult;
1214
1215 /* Kernel thread for multiple mount protection */
1216 struct task_struct *s_mmp_tsk;
1175}; 1217};
1176 1218
1177static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) 1219static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
@@ -1210,24 +1252,39 @@ enum {
1210 EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ 1252 EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */
1211 EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ 1253 EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/
1212 EXT4_STATE_NEWENTRY, /* File just added to dir */ 1254 EXT4_STATE_NEWENTRY, /* File just added to dir */
1255 EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */
1213}; 1256};
1214 1257
1215#define EXT4_INODE_BIT_FNS(name, field) \ 1258#define EXT4_INODE_BIT_FNS(name, field, offset) \
1216static inline int ext4_test_inode_##name(struct inode *inode, int bit) \ 1259static inline int ext4_test_inode_##name(struct inode *inode, int bit) \
1217{ \ 1260{ \
1218 return test_bit(bit, &EXT4_I(inode)->i_##field); \ 1261 return test_bit(bit + (offset), &EXT4_I(inode)->i_##field); \
1219} \ 1262} \
1220static inline void ext4_set_inode_##name(struct inode *inode, int bit) \ 1263static inline void ext4_set_inode_##name(struct inode *inode, int bit) \
1221{ \ 1264{ \
1222 set_bit(bit, &EXT4_I(inode)->i_##field); \ 1265 set_bit(bit + (offset), &EXT4_I(inode)->i_##field); \
1223} \ 1266} \
1224static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \ 1267static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \
1225{ \ 1268{ \
1226 clear_bit(bit, &EXT4_I(inode)->i_##field); \ 1269 clear_bit(bit + (offset), &EXT4_I(inode)->i_##field); \
1227} 1270}
1228 1271
1229EXT4_INODE_BIT_FNS(flag, flags) 1272EXT4_INODE_BIT_FNS(flag, flags, 0)
1230EXT4_INODE_BIT_FNS(state, state_flags) 1273#if (BITS_PER_LONG < 64)
1274EXT4_INODE_BIT_FNS(state, state_flags, 0)
1275
1276static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
1277{
1278 (ei)->i_state_flags = 0;
1279}
1280#else
1281EXT4_INODE_BIT_FNS(state, flags, 32)
1282
1283static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
1284{
1285 /* We depend on the fact that callers will set i_flags */
1286}
1287#endif
1231#else 1288#else
1232/* Assume that user mode programs are passing in an ext4fs superblock, not 1289/* Assume that user mode programs are passing in an ext4fs superblock, not
1233 * a kernel struct super_block. This will allow us to call the feature-test 1290 * a kernel struct super_block. This will allow us to call the feature-test
@@ -1294,6 +1351,7 @@ EXT4_INODE_BIT_FNS(state, state_flags)
1294#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 1351#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
1295#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 1352#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
1296#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 1353#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
1354#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
1297 1355
1298#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 1356#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
1299#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 1357#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
@@ -1307,13 +1365,29 @@ EXT4_INODE_BIT_FNS(state, state_flags)
1307#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */ 1365#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */
1308#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */ 1366#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */
1309 1367
1368#define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
1369#define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
1370 EXT4_FEATURE_INCOMPAT_META_BG)
1371#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
1372 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
1373 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
1374
1375#define EXT3_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
1376#define EXT3_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
1377 EXT4_FEATURE_INCOMPAT_RECOVER| \
1378 EXT4_FEATURE_INCOMPAT_META_BG)
1379#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
1380 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
1381 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
1382
1310#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 1383#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
1311#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ 1384#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
1312 EXT4_FEATURE_INCOMPAT_RECOVER| \ 1385 EXT4_FEATURE_INCOMPAT_RECOVER| \
1313 EXT4_FEATURE_INCOMPAT_META_BG| \ 1386 EXT4_FEATURE_INCOMPAT_META_BG| \
1314 EXT4_FEATURE_INCOMPAT_EXTENTS| \ 1387 EXT4_FEATURE_INCOMPAT_EXTENTS| \
1315 EXT4_FEATURE_INCOMPAT_64BIT| \ 1388 EXT4_FEATURE_INCOMPAT_64BIT| \
1316 EXT4_FEATURE_INCOMPAT_FLEX_BG) 1389 EXT4_FEATURE_INCOMPAT_FLEX_BG| \
1390 EXT4_FEATURE_INCOMPAT_MMP)
1317#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 1391#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
1318 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ 1392 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
1319 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ 1393 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
@@ -1533,7 +1607,97 @@ ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
1533void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, 1607void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
1534 ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp); 1608 ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp);
1535 1609
1536extern struct proc_dir_entry *ext4_proc_root; 1610/*
1611 * Timeout and state flag for lazy initialization inode thread.
1612 */
1613#define EXT4_DEF_LI_WAIT_MULT 10
1614#define EXT4_DEF_LI_MAX_START_DELAY 5
1615#define EXT4_LAZYINIT_QUIT 0x0001
1616#define EXT4_LAZYINIT_RUNNING 0x0002
1617
1618/*
1619 * Lazy inode table initialization info
1620 */
1621struct ext4_lazy_init {
1622 unsigned long li_state;
1623 struct list_head li_request_list;
1624 struct mutex li_list_mtx;
1625};
1626
1627struct ext4_li_request {
1628 struct super_block *lr_super;
1629 struct ext4_sb_info *lr_sbi;
1630 ext4_group_t lr_next_group;
1631 struct list_head lr_request;
1632 unsigned long lr_next_sched;
1633 unsigned long lr_timeout;
1634};
1635
1636struct ext4_features {
1637 struct kobject f_kobj;
1638 struct completion f_kobj_unregister;
1639};
1640
1641/*
1642 * This structure will be used for multiple mount protection. It will be
1643 * written into the block number saved in the s_mmp_block field in the
1644 * superblock. Programs that check MMP should assume that if
1645 * SEQ_FSCK (or any unknown code above SEQ_MAX) is present then it is NOT safe
1646 * to use the filesystem, regardless of how old the timestamp is.
1647 */
1648#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */
1649#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
1650#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */
1651#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */
1652
1653struct mmp_struct {
1654 __le32 mmp_magic; /* Magic number for MMP */
1655 __le32 mmp_seq; /* Sequence no. updated periodically */
1656
1657 /*
1658 * mmp_time, mmp_nodename & mmp_bdevname are only used for information
1659 * purposes and do not affect the correctness of the algorithm
1660 */
1661 __le64 mmp_time; /* Time last updated */
1662 char mmp_nodename[64]; /* Node which last updated MMP block */
1663 char mmp_bdevname[32]; /* Bdev which last updated MMP block */
1664
1665 /*
1666 * mmp_check_interval is used to verify if the MMP block has been
1667 * updated on the block device. The value is updated based on the
1668 * maximum time to write the MMP block during an update cycle.
1669 */
1670 __le16 mmp_check_interval;
1671
1672 __le16 mmp_pad1;
1673 __le32 mmp_pad2[227];
1674};
1675
1676/* arguments passed to the mmp thread */
1677struct mmpd_data {
1678 struct buffer_head *bh; /* bh from initial read_mmp_block() */
1679 struct super_block *sb; /* super block of the fs */
1680};
1681
1682/*
1683 * Check interval multiplier
1684 * The MMP block is written every update interval and initially checked every
1685 * update interval x the multiplier (the value is then adapted based on the
1686 * write latency). The reason is that writes can be delayed under load and we
1687 * don't want readers to incorrectly assume that the filesystem is no longer
1688 * in use.
1689 */
1690#define EXT4_MMP_CHECK_MULT 2UL
1691
1692/*
1693 * Minimum interval for MMP checking in seconds.
1694 */
1695#define EXT4_MMP_MIN_CHECK_INTERVAL 5UL
1696
1697/*
1698 * Maximum interval for MMP checking in seconds.
1699 */
1700#define EXT4_MMP_MAX_CHECK_INTERVAL 300UL
1537 1701
1538/* 1702/*
1539 * Function prototypes 1703 * Function prototypes
@@ -1559,11 +1723,12 @@ extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
1559extern unsigned long ext4_bg_num_gdb(struct super_block *sb, 1723extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
1560 ext4_group_t group); 1724 ext4_group_t group);
1561extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, 1725extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode,
1562 ext4_fsblk_t goal, unsigned long *count, int *errp); 1726 ext4_fsblk_t goal,
1563extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); 1727 unsigned int flags,
1564extern int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); 1728 unsigned long *count,
1565extern void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, 1729 int *errp);
1566 ext4_fsblk_t block, unsigned long count); 1730extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi,
1731 s64 nblocks, unsigned int flags);
1567extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *); 1732extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *);
1568extern void ext4_check_blocks_bitmap(struct super_block *); 1733extern void ext4_check_blocks_bitmap(struct super_block *);
1569extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 1734extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
@@ -1581,10 +1746,12 @@ extern unsigned ext4_init_block_bitmap(struct super_block *sb,
1581 1746
1582/* dir.c */ 1747/* dir.c */
1583extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *, 1748extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *,
1749 struct file *,
1584 struct ext4_dir_entry_2 *, 1750 struct ext4_dir_entry_2 *,
1585 struct buffer_head *, unsigned int); 1751 struct buffer_head *, unsigned int);
1586#define ext4_check_dir_entry(dir, de, bh, offset) \ 1752#define ext4_check_dir_entry(dir, filp, de, bh, offset) \
1587 __ext4_check_dir_entry(__func__, __LINE__, (dir), (de), (bh), (offset)) 1753 unlikely(__ext4_check_dir_entry(__func__, __LINE__, (dir), (filp), \
1754 (de), (bh), (offset)))
1588extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, 1755extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
1589 __u32 minor_hash, 1756 __u32 minor_hash,
1590 struct ext4_dir_entry_2 *dirent); 1757 struct ext4_dir_entry_2 *dirent);
@@ -1592,6 +1759,7 @@ extern void ext4_htree_free_dir_info(struct dir_private_info *p);
1592 1759
1593/* fsync.c */ 1760/* fsync.c */
1594extern int ext4_sync_file(struct file *, int); 1761extern int ext4_sync_file(struct file *, int);
1762extern int ext4_flush_completed_IO(struct inode *);
1595 1763
1596/* hash.c */ 1764/* hash.c */
1597extern int ext4fs_dirhash(const char *name, int len, struct 1765extern int ext4fs_dirhash(const char *name, int len, struct
@@ -1605,11 +1773,9 @@ extern struct inode * ext4_orphan_get(struct super_block *, unsigned long);
1605extern unsigned long ext4_count_free_inodes(struct super_block *); 1773extern unsigned long ext4_count_free_inodes(struct super_block *);
1606extern unsigned long ext4_count_dirs(struct super_block *); 1774extern unsigned long ext4_count_dirs(struct super_block *);
1607extern void ext4_check_inodes_bitmap(struct super_block *); 1775extern void ext4_check_inodes_bitmap(struct super_block *);
1608extern unsigned ext4_init_inode_bitmap(struct super_block *sb, 1776extern void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
1609 struct buffer_head *bh, 1777extern int ext4_init_inode_table(struct super_block *sb,
1610 ext4_group_t group, 1778 ext4_group_t group, int barrier);
1611 struct ext4_group_desc *desc);
1612extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
1613 1779
1614/* mballoc.c */ 1780/* mballoc.c */
1615extern long ext4_mb_stats; 1781extern long ext4_mb_stats;
@@ -1620,16 +1786,17 @@ extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
1620 struct ext4_allocation_request *, int *); 1786 struct ext4_allocation_request *, int *);
1621extern int ext4_mb_reserve_blocks(struct super_block *, int); 1787extern int ext4_mb_reserve_blocks(struct super_block *, int);
1622extern void ext4_discard_preallocations(struct inode *); 1788extern void ext4_discard_preallocations(struct inode *);
1623extern int __init init_ext4_mballoc(void); 1789extern int __init ext4_init_mballoc(void);
1624extern void exit_ext4_mballoc(void); 1790extern void ext4_exit_mballoc(void);
1625extern void ext4_free_blocks(handle_t *handle, struct inode *inode, 1791extern void ext4_free_blocks(handle_t *handle, struct inode *inode,
1626 struct buffer_head *bh, ext4_fsblk_t block, 1792 struct buffer_head *bh, ext4_fsblk_t block,
1627 unsigned long count, int flags); 1793 unsigned long count, int flags);
1628extern int ext4_mb_add_groupinfo(struct super_block *sb, 1794extern int ext4_mb_add_groupinfo(struct super_block *sb,
1629 ext4_group_t i, struct ext4_group_desc *desc); 1795 ext4_group_t i, struct ext4_group_desc *desc);
1630extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t); 1796extern void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
1631extern void ext4_mb_put_buddy_cache_lock(struct super_block *, 1797 ext4_fsblk_t block, unsigned long count);
1632 ext4_group_t, int); 1798extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
1799
1633/* inode.c */ 1800/* inode.c */
1634struct buffer_head *ext4_getblk(handle_t *, struct inode *, 1801struct buffer_head *ext4_getblk(handle_t *, struct inode *,
1635 ext4_lblk_t, int, int *); 1802 ext4_lblk_t, int, int *);
@@ -1646,24 +1813,25 @@ extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
1646extern void ext4_evict_inode(struct inode *); 1813extern void ext4_evict_inode(struct inode *);
1647extern void ext4_clear_inode(struct inode *); 1814extern void ext4_clear_inode(struct inode *);
1648extern int ext4_sync_inode(handle_t *, struct inode *); 1815extern int ext4_sync_inode(handle_t *, struct inode *);
1649extern void ext4_dirty_inode(struct inode *); 1816extern void ext4_dirty_inode(struct inode *, int);
1650extern int ext4_change_inode_journal_flag(struct inode *, int); 1817extern int ext4_change_inode_journal_flag(struct inode *, int);
1651extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); 1818extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
1652extern int ext4_can_truncate(struct inode *inode); 1819extern int ext4_can_truncate(struct inode *inode);
1653extern void ext4_truncate(struct inode *); 1820extern void ext4_truncate(struct inode *);
1821extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length);
1654extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks); 1822extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
1655extern void ext4_set_inode_flags(struct inode *); 1823extern void ext4_set_inode_flags(struct inode *);
1656extern void ext4_get_inode_flags(struct ext4_inode_info *); 1824extern void ext4_get_inode_flags(struct ext4_inode_info *);
1657extern int ext4_alloc_da_blocks(struct inode *inode); 1825extern int ext4_alloc_da_blocks(struct inode *inode);
1658extern void ext4_set_aops(struct inode *inode); 1826extern void ext4_set_aops(struct inode *inode);
1659extern int ext4_writepage_trans_blocks(struct inode *); 1827extern int ext4_writepage_trans_blocks(struct inode *);
1660extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks);
1661extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); 1828extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1662extern int ext4_block_truncate_page(handle_t *handle, 1829extern int ext4_block_truncate_page(handle_t *handle,
1663 struct address_space *mapping, loff_t from); 1830 struct address_space *mapping, loff_t from);
1831extern int ext4_block_zero_page_range(handle_t *handle,
1832 struct address_space *mapping, loff_t from, loff_t length);
1664extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); 1833extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
1665extern qsize_t *ext4_get_reserved_space(struct inode *inode); 1834extern qsize_t *ext4_get_reserved_space(struct inode *inode);
1666extern int flush_completed_IO(struct inode *inode);
1667extern void ext4_da_update_reserve_space(struct inode *inode, 1835extern void ext4_da_update_reserve_space(struct inode *inode,
1668 int used, int quota_claim); 1836 int used, int quota_claim);
1669/* ioctl.c */ 1837/* ioctl.c */
@@ -1696,8 +1864,8 @@ extern void ext4_error_inode(struct inode *, const char *, unsigned int,
1696 ext4_fsblk_t, const char *, ...) 1864 ext4_fsblk_t, const char *, ...)
1697 __attribute__ ((format (printf, 5, 6))); 1865 __attribute__ ((format (printf, 5, 6)));
1698extern void ext4_error_file(struct file *, const char *, unsigned int, 1866extern void ext4_error_file(struct file *, const char *, unsigned int,
1699 const char *, ...) 1867 ext4_fsblk_t, const char *, ...)
1700 __attribute__ ((format (printf, 4, 5))); 1868 __attribute__ ((format (printf, 5, 6)));
1701extern void __ext4_std_error(struct super_block *, const char *, 1869extern void __ext4_std_error(struct super_block *, const char *,
1702 unsigned int, int); 1870 unsigned int, int);
1703extern void __ext4_abort(struct super_block *, const char *, unsigned int, 1871extern void __ext4_abort(struct super_block *, const char *, unsigned int,
@@ -1712,6 +1880,10 @@ extern void __ext4_warning(struct super_block *, const char *, unsigned int,
1712 __LINE__, ## message) 1880 __LINE__, ## message)
1713extern void ext4_msg(struct super_block *, const char *, const char *, ...) 1881extern void ext4_msg(struct super_block *, const char *, const char *, ...)
1714 __attribute__ ((format (printf, 3, 4))); 1882 __attribute__ ((format (printf, 3, 4)));
1883extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp,
1884 const char *, unsigned int, const char *);
1885#define dump_mmp_msg(sb, mmp, msg) __dump_mmp_msg(sb, mmp, __func__, \
1886 __LINE__, msg)
1715extern void __ext4_grp_locked_error(const char *, unsigned int, \ 1887extern void __ext4_grp_locked_error(const char *, unsigned int, \
1716 struct super_block *, ext4_group_t, \ 1888 struct super_block *, ext4_group_t, \
1717 unsigned long, ext4_fsblk_t, \ 1889 unsigned long, ext4_fsblk_t, \
@@ -1960,6 +2132,7 @@ extern const struct file_operations ext4_dir_operations;
1960/* file.c */ 2132/* file.c */
1961extern const struct inode_operations ext4_file_inode_operations; 2133extern const struct inode_operations ext4_file_inode_operations;
1962extern const struct file_operations ext4_file_operations; 2134extern const struct file_operations ext4_file_operations;
2135extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin);
1963 2136
1964/* namei.c */ 2137/* namei.c */
1965extern const struct inode_operations ext4_dir_inode_operations; 2138extern const struct inode_operations ext4_dir_inode_operations;
@@ -1973,8 +2146,8 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
1973/* block_validity */ 2146/* block_validity */
1974extern void ext4_release_system_zone(struct super_block *sb); 2147extern void ext4_release_system_zone(struct super_block *sb);
1975extern int ext4_setup_system_zone(struct super_block *sb); 2148extern int ext4_setup_system_zone(struct super_block *sb);
1976extern int __init init_ext4_system_zone(void); 2149extern int __init ext4_init_system_zone(void);
1977extern void exit_ext4_system_zone(void); 2150extern void ext4_exit_system_zone(void);
1978extern int ext4_data_block_valid(struct ext4_sb_info *sbi, 2151extern int ext4_data_block_valid(struct ext4_sb_info *sbi,
1979 ext4_fsblk_t start_blk, 2152 ext4_fsblk_t start_blk,
1980 unsigned int count); 2153 unsigned int count);
@@ -1987,9 +2160,11 @@ extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks,
1987extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, 2160extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
1988 struct ext4_map_blocks *map, int flags); 2161 struct ext4_map_blocks *map, int flags);
1989extern void ext4_ext_truncate(struct inode *); 2162extern void ext4_ext_truncate(struct inode *);
2163extern int ext4_ext_punch_hole(struct file *file, loff_t offset,
2164 loff_t length);
1990extern void ext4_ext_init(struct super_block *); 2165extern void ext4_ext_init(struct super_block *);
1991extern void ext4_ext_release(struct super_block *); 2166extern void ext4_ext_release(struct super_block *);
1992extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, 2167extern long ext4_fallocate(struct file *file, int mode, loff_t offset,
1993 loff_t len); 2168 loff_t len);
1994extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, 2169extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset,
1995 ssize_t len); 2170 ssize_t len);
@@ -2002,6 +2177,21 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
2002 __u64 start_orig, __u64 start_donor, 2177 __u64 start_orig, __u64 start_donor,
2003 __u64 len, __u64 *moved_len); 2178 __u64 len, __u64 *moved_len);
2004 2179
2180/* page-io.c */
2181extern int __init ext4_init_pageio(void);
2182extern void ext4_exit_pageio(void);
2183extern void ext4_ioend_wait(struct inode *);
2184extern void ext4_free_io_end(ext4_io_end_t *io);
2185extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags);
2186extern int ext4_end_io_nolock(ext4_io_end_t *io);
2187extern void ext4_io_submit(struct ext4_io_submit *io);
2188extern int ext4_bio_write_page(struct ext4_io_submit *io,
2189 struct page *page,
2190 int len,
2191 struct writeback_control *wbc);
2192
2193/* mmp.c */
2194extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t);
2005 2195
2006/* BH_Uninit flag: blocks are allocated but uninitialized on disk */ 2196/* BH_Uninit flag: blocks are allocated but uninitialized on disk */
2007enum ext4_state_bits { 2197enum ext4_state_bits {
@@ -2031,6 +2221,15 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh)
2031 2221
2032#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) 2222#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
2033 2223
2224/* For ioend & aio unwritten conversion wait queues */
2225#define EXT4_WQ_HASH_SZ 37
2226#define ext4_ioend_wq(v) (&ext4__ioend_wq[((unsigned long)(v)) %\
2227 EXT4_WQ_HASH_SZ])
2228#define ext4_aio_mutex(v) (&ext4__aio_mutex[((unsigned long)(v)) %\
2229 EXT4_WQ_HASH_SZ])
2230extern wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ];
2231extern struct mutex ext4__aio_mutex[EXT4_WQ_HASH_SZ];
2232
2034#endif /* __KERNEL__ */ 2233#endif /* __KERNEL__ */
2035 2234
2036#endif /* _EXT4_H */ 2235#endif /* _EXT4_H */