diff options
author | Jiaying Zhang <jiayingz@google.com> | 2010-03-04 16:14:02 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-03-04 16:14:02 -0500 |
commit | 744692dc059845b2a3022119871846e74d4f6e11 (patch) | |
tree | ed246651aebcb8dae57de8c58dc20983064ee017 /fs/ext4/ext4.h | |
parent | c7064ef13b2181a489836349f9baf87df0dab28f (diff) |
ext4: use ext4_get_block_write in buffer write
Allocate uninitialized extent before ext4 buffer write and
convert the extent to initialized after io completes.
The purpose is to make sure an extent can only be marked
initialized after it has been written with new data so
we can safely drop the i_mutex lock in ext4 DIO read without
exposing stale data. This helps to improve multi-thread DIO
read performance on high-speed disks.
Skip the nobh and data=journal mount cases to make things simple for now.
Signed-off-by: Jiaying Zhang <jiayingz@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index c831a580bd76..dee45800dc95 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -138,7 +138,7 @@ typedef struct ext4_io_end { | |||
138 | struct list_head list; /* per-file finished AIO list */ | 138 | struct list_head list; /* per-file finished AIO list */ |
139 | struct inode *inode; /* file being written to */ | 139 | struct inode *inode; /* file being written to */ |
140 | unsigned int flag; /* unwritten or not */ | 140 | unsigned int flag; /* unwritten or not */ |
141 | int error; /* I/O error code */ | 141 | struct page *page; /* page struct for buffer write */ |
142 | loff_t offset; /* offset in the file */ | 142 | loff_t offset; /* offset in the file */ |
143 | ssize_t size; /* size of the extent */ | 143 | ssize_t size; /* size of the extent */ |
144 | struct work_struct work; /* data work queue */ | 144 | struct work_struct work; /* data work queue */ |
@@ -361,7 +361,7 @@ struct ext4_new_group_data { | |||
361 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | 361 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) |
362 | /* Convert extent to initialized after IO complete */ | 362 | /* Convert extent to initialized after IO complete */ |
363 | #define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ | 363 | #define EXT4_GET_BLOCKS_IO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ |
364 | EXT4_GET_BLOCKS_IO_CREATE_EXT) | 364 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) |
365 | 365 | ||
366 | /* | 366 | /* |
367 | * Flags used by ext4_free_blocks | 367 | * Flags used by ext4_free_blocks |
@@ -702,6 +702,7 @@ struct ext4_inode_info { | |||
702 | 702 | ||
703 | /* completed IOs that might need unwritten extents handling */ | 703 | /* completed IOs that might need unwritten extents handling */ |
704 | struct list_head i_completed_io_list; | 704 | struct list_head i_completed_io_list; |
705 | spinlock_t i_completed_io_lock; | ||
705 | /* current io_end structure for async DIO write*/ | 706 | /* current io_end structure for async DIO write*/ |
706 | ext4_io_end_t *cur_aio_dio; | 707 | ext4_io_end_t *cur_aio_dio; |
707 | 708 | ||
@@ -752,6 +753,7 @@ struct ext4_inode_info { | |||
752 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ | 753 | #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */ |
753 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | 754 | #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ |
754 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | 755 | #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ |
756 | #define EXT4_MOUNT_DIOREAD_NOLOCK 0x400000 /* Enable support for dio read nolocking */ | ||
755 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | 757 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ |
756 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 758 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
757 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | 759 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ |
@@ -1781,6 +1783,15 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
1781 | __u64 len, __u64 *moved_len); | 1783 | __u64 len, __u64 *moved_len); |
1782 | 1784 | ||
1783 | 1785 | ||
1786 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ | ||
1787 | enum ext4_state_bits { | ||
1788 | BH_Uninit /* blocks are allocated but uninitialized on disk */ | ||
1789 | = BH_JBDPrivateStart, | ||
1790 | }; | ||
1791 | |||
1792 | BUFFER_FNS(Uninit, uninit) | ||
1793 | TAS_BUFFER_FNS(Uninit, uninit) | ||
1794 | |||
1784 | /* | 1795 | /* |
1785 | * Add new method to test wether block and inode bitmaps are properly | 1796 | * Add new method to test wether block and inode bitmaps are properly |
1786 | * initialized. With uninit_bg reading the block from disk is not enough | 1797 | * initialized. With uninit_bg reading the block from disk is not enough |