diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index e227eea23f0..8825515eedd 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -65,6 +65,12 @@ typedef __u32 ext4_lblk_t; | |||
65 | /* data type for block group number */ | 65 | /* data type for block group number */ |
66 | typedef unsigned int ext4_group_t; | 66 | typedef unsigned int ext4_group_t; |
67 | 67 | ||
68 | /* | ||
69 | * Flags used in mballoc's allocation_context flags field. | ||
70 | * | ||
71 | * Also used to show what's going on for debugging purposes when the | ||
72 | * flag field is exported via the traceport interface | ||
73 | */ | ||
68 | 74 | ||
69 | /* prefer goal again. length */ | 75 | /* prefer goal again. length */ |
70 | #define EXT4_MB_HINT_MERGE 0x0001 | 76 | #define EXT4_MB_HINT_MERGE 0x0001 |
@@ -127,6 +133,16 @@ struct mpage_da_data { | |||
127 | int pages_written; | 133 | int pages_written; |
128 | int retval; | 134 | int retval; |
129 | }; | 135 | }; |
136 | #define DIO_AIO_UNWRITTEN 0x1 | ||
137 | typedef struct ext4_io_end { | ||
138 | struct list_head list; /* per-file finished AIO list */ | ||
139 | struct inode *inode; /* file being written to */ | ||
140 | unsigned int flag; /* unwritten or not */ | ||
141 | int error; /* I/O error code */ | ||
142 | ext4_lblk_t offset; /* offset in the file */ | ||
143 | size_t size; /* size of the extent */ | ||
144 | struct work_struct work; /* data work queue */ | ||
145 | } ext4_io_end_t; | ||
130 | 146 | ||
131 | /* | 147 | /* |
132 | * Special inodes numbers | 148 | * Special inodes numbers |
@@ -306,6 +322,7 @@ static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags) | |||
306 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ | 322 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ |
307 | #define EXT4_STATE_DA_ALLOC_CLOSE 0x00000010 /* Alloc DA blks on close */ | 323 | #define EXT4_STATE_DA_ALLOC_CLOSE 0x00000010 /* Alloc DA blks on close */ |
308 | #define EXT4_STATE_EXT_MIGRATE 0x00000020 /* Inode is migrating */ | 324 | #define EXT4_STATE_EXT_MIGRATE 0x00000020 /* Inode is migrating */ |
325 | #define EXT4_STATE_DIO_UNWRITTEN 0x00000040 /* need convert on dio done*/ | ||
309 | 326 | ||
310 | /* Used to pass group descriptor data when online resize is done */ | 327 | /* Used to pass group descriptor data when online resize is done */ |
311 | struct ext4_new_group_input { | 328 | struct ext4_new_group_input { |
@@ -347,7 +364,16 @@ struct ext4_new_group_data { | |||
347 | /* Call ext4_da_update_reserve_space() after successfully | 364 | /* Call ext4_da_update_reserve_space() after successfully |
348 | allocating the blocks */ | 365 | allocating the blocks */ |
349 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 | 366 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 |
350 | 367 | /* caller is from the direct IO path, request to creation of an | |
368 | unitialized extents if not allocated, split the uninitialized | ||
369 | extent if blocks has been preallocated already*/ | ||
370 | #define EXT4_GET_BLOCKS_DIO 0x0010 | ||
371 | #define EXT4_GET_BLOCKS_CONVERT 0x0020 | ||
372 | #define EXT4_GET_BLOCKS_DIO_CREATE_EXT (EXT4_GET_BLOCKS_DIO|\ | ||
373 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | ||
374 | /* Convert extent to initialized after direct IO complete */ | ||
375 | #define EXT4_GET_BLOCKS_DIO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ | ||
376 | EXT4_GET_BLOCKS_DIO_CREATE_EXT) | ||
351 | 377 | ||
352 | /* | 378 | /* |
353 | * ioctl commands | 379 | * ioctl commands |
@@ -500,8 +526,8 @@ struct move_extent { | |||
500 | static inline __le32 ext4_encode_extra_time(struct timespec *time) | 526 | static inline __le32 ext4_encode_extra_time(struct timespec *time) |
501 | { | 527 | { |
502 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? | 528 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? |
503 | time->tv_sec >> 32 : 0) | | 529 | (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) | |
504 | ((time->tv_nsec << 2) & EXT4_NSEC_MASK)); | 530 | ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK)); |
505 | } | 531 | } |
506 | 532 | ||
507 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | 533 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) |
@@ -509,7 +535,7 @@ static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | |||
509 | if (sizeof(time->tv_sec) > 4) | 535 | if (sizeof(time->tv_sec) > 4) |
510 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) | 536 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) |
511 | << 32; | 537 | << 32; |
512 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2; | 538 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; |
513 | } | 539 | } |
514 | 540 | ||
515 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ | 541 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ |
@@ -672,6 +698,11 @@ struct ext4_inode_info { | |||
672 | __u16 i_extra_isize; | 698 | __u16 i_extra_isize; |
673 | 699 | ||
674 | spinlock_t i_block_reservation_lock; | 700 | spinlock_t i_block_reservation_lock; |
701 | |||
702 | /* completed async DIOs that might need unwritten extents handling */ | ||
703 | struct list_head i_aio_dio_complete_list; | ||
704 | /* current io_end structure for async DIO write*/ | ||
705 | ext4_io_end_t *cur_aio_dio; | ||
675 | }; | 706 | }; |
676 | 707 | ||
677 | /* | 708 | /* |
@@ -713,6 +744,7 @@ struct ext4_inode_info { | |||
713 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ | 744 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ |
714 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | 745 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ |
715 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | 746 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ |
747 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | ||
716 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 748 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
717 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | 749 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ |
718 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ | 750 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ |
@@ -942,18 +974,11 @@ struct ext4_sb_info { | |||
942 | unsigned int s_mb_stats; | 974 | unsigned int s_mb_stats; |
943 | unsigned int s_mb_order2_reqs; | 975 | unsigned int s_mb_order2_reqs; |
944 | unsigned int s_mb_group_prealloc; | 976 | unsigned int s_mb_group_prealloc; |
977 | unsigned int s_max_writeback_mb_bump; | ||
945 | /* where last allocation was done - for stream allocation */ | 978 | /* where last allocation was done - for stream allocation */ |
946 | unsigned long s_mb_last_group; | 979 | unsigned long s_mb_last_group; |
947 | unsigned long s_mb_last_start; | 980 | unsigned long s_mb_last_start; |
948 | 981 | ||
949 | /* history to debug policy */ | ||
950 | struct ext4_mb_history *s_mb_history; | ||
951 | int s_mb_history_cur; | ||
952 | int s_mb_history_max; | ||
953 | int s_mb_history_num; | ||
954 | spinlock_t s_mb_history_lock; | ||
955 | int s_mb_history_filter; | ||
956 | |||
957 | /* stats for buddy allocator */ | 982 | /* stats for buddy allocator */ |
958 | spinlock_t s_mb_pa_lock; | 983 | spinlock_t s_mb_pa_lock; |
959 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ | 984 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ |
@@ -980,6 +1005,9 @@ struct ext4_sb_info { | |||
980 | 1005 | ||
981 | unsigned int s_log_groups_per_flex; | 1006 | unsigned int s_log_groups_per_flex; |
982 | struct flex_groups *s_flex_groups; | 1007 | struct flex_groups *s_flex_groups; |
1008 | |||
1009 | /* workqueue for dio unwritten */ | ||
1010 | struct workqueue_struct *dio_unwritten_wq; | ||
983 | }; | 1011 | }; |
984 | 1012 | ||
985 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 1013 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
@@ -1397,7 +1425,7 @@ extern int ext4_block_truncate_page(handle_t *handle, | |||
1397 | struct address_space *mapping, loff_t from); | 1425 | struct address_space *mapping, loff_t from); |
1398 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 1426 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
1399 | extern qsize_t ext4_get_reserved_space(struct inode *inode); | 1427 | extern qsize_t ext4_get_reserved_space(struct inode *inode); |
1400 | 1428 | extern int flush_aio_dio_completed_IO(struct inode *inode); | |
1401 | /* ioctl.c */ | 1429 | /* ioctl.c */ |
1402 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); | 1430 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); |
1403 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); | 1431 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); |
@@ -1699,6 +1727,8 @@ extern void ext4_ext_init(struct super_block *); | |||
1699 | extern void ext4_ext_release(struct super_block *); | 1727 | extern void ext4_ext_release(struct super_block *); |
1700 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1728 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
1701 | loff_t len); | 1729 | loff_t len); |
1730 | extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | ||
1731 | loff_t len); | ||
1702 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, | 1732 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, |
1703 | sector_t block, unsigned int max_blocks, | 1733 | sector_t block, unsigned int max_blocks, |
1704 | struct buffer_head *bh, int flags); | 1734 | struct buffer_head *bh, int flags); |