diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index e227eea23f05..984ca0cb38c3 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 |
@@ -347,7 +363,16 @@ struct ext4_new_group_data { | |||
347 | /* Call ext4_da_update_reserve_space() after successfully | 363 | /* Call ext4_da_update_reserve_space() after successfully |
348 | allocating the blocks */ | 364 | allocating the blocks */ |
349 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 | 365 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 |
350 | 366 | /* caller is from the direct IO path, request to creation of an | |
367 | unitialized extents if not allocated, split the uninitialized | ||
368 | extent if blocks has been preallocated already*/ | ||
369 | #define EXT4_GET_BLOCKS_DIO 0x0010 | ||
370 | #define EXT4_GET_BLOCKS_CONVERT 0x0020 | ||
371 | #define EXT4_GET_BLOCKS_DIO_CREATE_EXT (EXT4_GET_BLOCKS_DIO|\ | ||
372 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | ||
373 | /* Convert extent to initialized after direct IO complete */ | ||
374 | #define EXT4_GET_BLOCKS_DIO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ | ||
375 | EXT4_GET_BLOCKS_DIO_CREATE_EXT) | ||
351 | 376 | ||
352 | /* | 377 | /* |
353 | * ioctl commands | 378 | * ioctl commands |
@@ -500,8 +525,8 @@ struct move_extent { | |||
500 | static inline __le32 ext4_encode_extra_time(struct timespec *time) | 525 | static inline __le32 ext4_encode_extra_time(struct timespec *time) |
501 | { | 526 | { |
502 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? | 527 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? |
503 | time->tv_sec >> 32 : 0) | | 528 | (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) | |
504 | ((time->tv_nsec << 2) & EXT4_NSEC_MASK)); | 529 | ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK)); |
505 | } | 530 | } |
506 | 531 | ||
507 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | 532 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) |
@@ -509,7 +534,7 @@ static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | |||
509 | if (sizeof(time->tv_sec) > 4) | 534 | if (sizeof(time->tv_sec) > 4) |
510 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) | 535 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) |
511 | << 32; | 536 | << 32; |
512 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2; | 537 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; |
513 | } | 538 | } |
514 | 539 | ||
515 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ | 540 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ |
@@ -672,6 +697,11 @@ struct ext4_inode_info { | |||
672 | __u16 i_extra_isize; | 697 | __u16 i_extra_isize; |
673 | 698 | ||
674 | spinlock_t i_block_reservation_lock; | 699 | spinlock_t i_block_reservation_lock; |
700 | |||
701 | /* completed async DIOs that might need unwritten extents handling */ | ||
702 | struct list_head i_aio_dio_complete_list; | ||
703 | /* current io_end structure for async DIO write*/ | ||
704 | ext4_io_end_t *cur_aio_dio; | ||
675 | }; | 705 | }; |
676 | 706 | ||
677 | /* | 707 | /* |
@@ -942,18 +972,11 @@ struct ext4_sb_info { | |||
942 | unsigned int s_mb_stats; | 972 | unsigned int s_mb_stats; |
943 | unsigned int s_mb_order2_reqs; | 973 | unsigned int s_mb_order2_reqs; |
944 | unsigned int s_mb_group_prealloc; | 974 | unsigned int s_mb_group_prealloc; |
975 | unsigned int s_max_writeback_mb_bump; | ||
945 | /* where last allocation was done - for stream allocation */ | 976 | /* where last allocation was done - for stream allocation */ |
946 | unsigned long s_mb_last_group; | 977 | unsigned long s_mb_last_group; |
947 | unsigned long s_mb_last_start; | 978 | unsigned long s_mb_last_start; |
948 | 979 | ||
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 */ | 980 | /* stats for buddy allocator */ |
958 | spinlock_t s_mb_pa_lock; | 981 | spinlock_t s_mb_pa_lock; |
959 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ | 982 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ |
@@ -980,6 +1003,9 @@ struct ext4_sb_info { | |||
980 | 1003 | ||
981 | unsigned int s_log_groups_per_flex; | 1004 | unsigned int s_log_groups_per_flex; |
982 | struct flex_groups *s_flex_groups; | 1005 | struct flex_groups *s_flex_groups; |
1006 | |||
1007 | /* workqueue for dio unwritten */ | ||
1008 | struct workqueue_struct *dio_unwritten_wq; | ||
983 | }; | 1009 | }; |
984 | 1010 | ||
985 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 1011 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
@@ -1397,7 +1423,7 @@ extern int ext4_block_truncate_page(handle_t *handle, | |||
1397 | struct address_space *mapping, loff_t from); | 1423 | struct address_space *mapping, loff_t from); |
1398 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 1424 | 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); | 1425 | extern qsize_t ext4_get_reserved_space(struct inode *inode); |
1400 | 1426 | extern int flush_aio_dio_completed_IO(struct inode *inode); | |
1401 | /* ioctl.c */ | 1427 | /* ioctl.c */ |
1402 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); | 1428 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); |
1403 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); | 1429 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); |
@@ -1699,6 +1725,8 @@ extern void ext4_ext_init(struct super_block *); | |||
1699 | extern void ext4_ext_release(struct super_block *); | 1725 | extern void ext4_ext_release(struct super_block *); |
1700 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1726 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
1701 | loff_t len); | 1727 | loff_t len); |
1728 | extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | ||
1729 | loff_t len); | ||
1702 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, | 1730 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, |
1703 | sector_t block, unsigned int max_blocks, | 1731 | sector_t block, unsigned int max_blocks, |
1704 | struct buffer_head *bh, int flags); | 1732 | struct buffer_head *bh, int flags); |