diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 157b458a69d4..c04743519865 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -42,6 +42,18 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * with AGGRESSIVE_CHECK allocator runs consistency checks over | ||
46 | * structures. these checks slow things down a lot | ||
47 | */ | ||
48 | #define AGGRESSIVE_CHECK__ | ||
49 | |||
50 | /* | ||
51 | * with DOUBLE_CHECK defined mballoc creates persistent in-core | ||
52 | * bitmaps, maintains and uses them to check for double allocations | ||
53 | */ | ||
54 | #define DOUBLE_CHECK__ | ||
55 | |||
56 | /* | ||
45 | * Define EXT4FS_DEBUG to produce debug messages | 57 | * Define EXT4FS_DEBUG to produce debug messages |
46 | */ | 58 | */ |
47 | #undef EXT4FS_DEBUG | 59 | #undef EXT4FS_DEBUG |
@@ -182,9 +194,9 @@ typedef struct ext4_io_end { | |||
182 | struct bio *bio; /* Linked list of completed | 194 | struct bio *bio; /* Linked list of completed |
183 | * bios covering the extent */ | 195 | * bios covering the extent */ |
184 | unsigned int flag; /* unwritten or not */ | 196 | unsigned int flag; /* unwritten or not */ |
197 | atomic_t count; /* reference counter */ | ||
185 | loff_t offset; /* offset in the file */ | 198 | loff_t offset; /* offset in the file */ |
186 | ssize_t size; /* size of the extent */ | 199 | ssize_t size; /* size of the extent */ |
187 | atomic_t count; /* reference counter */ | ||
188 | } ext4_io_end_t; | 200 | } ext4_io_end_t; |
189 | 201 | ||
190 | struct ext4_io_submit { | 202 | struct ext4_io_submit { |
@@ -1024,13 +1036,8 @@ struct ext4_inode_info { | |||
1024 | * transaction reserved | 1036 | * transaction reserved |
1025 | */ | 1037 | */ |
1026 | struct list_head i_rsv_conversion_list; | 1038 | struct list_head i_rsv_conversion_list; |
1027 | /* | ||
1028 | * Completed IOs that need unwritten extents handling and don't have | ||
1029 | * transaction reserved | ||
1030 | */ | ||
1031 | atomic_t i_ioend_count; /* Number of outstanding io_end structs */ | ||
1032 | atomic_t i_unwritten; /* Nr. of inflight conversions pending */ | ||
1033 | struct work_struct i_rsv_conversion_work; | 1039 | struct work_struct i_rsv_conversion_work; |
1040 | atomic_t i_unwritten; /* Nr. of inflight conversions pending */ | ||
1034 | 1041 | ||
1035 | spinlock_t i_block_reservation_lock; | 1042 | spinlock_t i_block_reservation_lock; |
1036 | 1043 | ||
@@ -1504,25 +1511,6 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
1504 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); | 1511 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); |
1505 | } | 1512 | } |
1506 | 1513 | ||
1507 | static inline void ext4_set_io_unwritten_flag(struct inode *inode, | ||
1508 | struct ext4_io_end *io_end) | ||
1509 | { | ||
1510 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | ||
1511 | io_end->flag |= EXT4_IO_END_UNWRITTEN; | ||
1512 | atomic_inc(&EXT4_I(inode)->i_unwritten); | ||
1513 | } | ||
1514 | } | ||
1515 | |||
1516 | static inline ext4_io_end_t *ext4_inode_aio(struct inode *inode) | ||
1517 | { | ||
1518 | return inode->i_private; | ||
1519 | } | ||
1520 | |||
1521 | static inline void ext4_inode_aio_set(struct inode *inode, ext4_io_end_t *io) | ||
1522 | { | ||
1523 | inode->i_private = io; | ||
1524 | } | ||
1525 | |||
1526 | /* | 1514 | /* |
1527 | * Inode dynamic state flags | 1515 | * Inode dynamic state flags |
1528 | */ | 1516 | */ |
@@ -2506,12 +2494,14 @@ extern int ext4_trim_fs(struct super_block *, struct fstrim_range *); | |||
2506 | int ext4_inode_is_fast_symlink(struct inode *inode); | 2494 | int ext4_inode_is_fast_symlink(struct inode *inode); |
2507 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int); | 2495 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int); |
2508 | struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int); | 2496 | struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int); |
2509 | int ext4_get_block_write(struct inode *inode, sector_t iblock, | 2497 | int ext4_get_block_unwritten(struct inode *inode, sector_t iblock, |
2510 | struct buffer_head *bh_result, int create); | 2498 | struct buffer_head *bh_result, int create); |
2511 | int ext4_dax_mmap_get_block(struct inode *inode, sector_t iblock, | 2499 | int ext4_dax_mmap_get_block(struct inode *inode, sector_t iblock, |
2512 | struct buffer_head *bh_result, int create); | 2500 | struct buffer_head *bh_result, int create); |
2513 | int ext4_get_block(struct inode *inode, sector_t iblock, | 2501 | int ext4_get_block(struct inode *inode, sector_t iblock, |
2514 | struct buffer_head *bh_result, int create); | 2502 | struct buffer_head *bh_result, int create); |
2503 | int ext4_dio_get_block(struct inode *inode, sector_t iblock, | ||
2504 | struct buffer_head *bh_result, int create); | ||
2515 | int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, | 2505 | int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, |
2516 | struct buffer_head *bh, int create); | 2506 | struct buffer_head *bh, int create); |
2517 | int ext4_walk_page_buffers(handle_t *handle, | 2507 | int ext4_walk_page_buffers(handle_t *handle, |
@@ -2559,6 +2549,9 @@ extern void ext4_da_update_reserve_space(struct inode *inode, | |||
2559 | int used, int quota_claim); | 2549 | int used, int quota_claim); |
2560 | extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, | 2550 | extern int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, |
2561 | ext4_fsblk_t pblk, ext4_lblk_t len); | 2551 | ext4_fsblk_t pblk, ext4_lblk_t len); |
2552 | extern int ext4_get_next_extent(struct inode *inode, ext4_lblk_t lblk, | ||
2553 | unsigned int map_len, | ||
2554 | struct extent_status *result); | ||
2562 | 2555 | ||
2563 | /* indirect.c */ | 2556 | /* indirect.c */ |
2564 | extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, | 2557 | extern int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, |
@@ -3285,15 +3278,33 @@ static inline void ext4_inode_resume_unlocked_dio(struct inode *inode) | |||
3285 | #define EXT4_WQ_HASH_SZ 37 | 3278 | #define EXT4_WQ_HASH_SZ 37 |
3286 | #define ext4_ioend_wq(v) (&ext4__ioend_wq[((unsigned long)(v)) %\ | 3279 | #define ext4_ioend_wq(v) (&ext4__ioend_wq[((unsigned long)(v)) %\ |
3287 | EXT4_WQ_HASH_SZ]) | 3280 | EXT4_WQ_HASH_SZ]) |
3288 | #define ext4_aio_mutex(v) (&ext4__aio_mutex[((unsigned long)(v)) %\ | ||
3289 | EXT4_WQ_HASH_SZ]) | ||
3290 | extern wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ]; | 3281 | extern wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ]; |
3291 | extern struct mutex ext4__aio_mutex[EXT4_WQ_HASH_SZ]; | ||
3292 | 3282 | ||
3293 | #define EXT4_RESIZING 0 | 3283 | #define EXT4_RESIZING 0 |
3294 | extern int ext4_resize_begin(struct super_block *sb); | 3284 | extern int ext4_resize_begin(struct super_block *sb); |
3295 | extern void ext4_resize_end(struct super_block *sb); | 3285 | extern void ext4_resize_end(struct super_block *sb); |
3296 | 3286 | ||
3287 | static inline void ext4_set_io_unwritten_flag(struct inode *inode, | ||
3288 | struct ext4_io_end *io_end) | ||
3289 | { | ||
3290 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | ||
3291 | io_end->flag |= EXT4_IO_END_UNWRITTEN; | ||
3292 | atomic_inc(&EXT4_I(inode)->i_unwritten); | ||
3293 | } | ||
3294 | } | ||
3295 | |||
3296 | static inline void ext4_clear_io_unwritten_flag(ext4_io_end_t *io_end) | ||
3297 | { | ||
3298 | struct inode *inode = io_end->inode; | ||
3299 | |||
3300 | if (io_end->flag & EXT4_IO_END_UNWRITTEN) { | ||
3301 | io_end->flag &= ~EXT4_IO_END_UNWRITTEN; | ||
3302 | /* Wake up anyone waiting on unwritten extent conversion */ | ||
3303 | if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten)) | ||
3304 | wake_up_all(ext4_ioend_wq(inode)); | ||
3305 | } | ||
3306 | } | ||
3307 | |||
3297 | #endif /* __KERNEL__ */ | 3308 | #endif /* __KERNEL__ */ |
3298 | 3309 | ||
3299 | #define EFSBADCRC EBADMSG /* Bad CRC detected */ | 3310 | #define EFSBADCRC EBADMSG /* Bad CRC detected */ |