diff options
author | Mingming <cmm@us.ibm.com> | 2009-11-10 10:48:04 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-11-10 10:48:04 -0500 |
commit | 5f5249507e4b5c4fc0f9c93f33d133d8c95f47e1 (patch) | |
tree | 0b0a790f568c07298c3a4122572e84392c787648 /fs/ext4/extents.c | |
parent | 109f55651954def97fa41ee71c464d268c512ab0 (diff) |
ext4: skip conversion of uninit extents after direct IO if there isn't any
At the end of direct I/O operation, ext4_ext_direct_IO() always called
ext4_convert_unwritten_extents(), regardless of whether there were any
unwritten extents involved in the I/O or not.
This commit adds a state flag so that ext4_ext_direct_IO() only calls
ext4_convert_unwritten_extents() when necessary.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 441716f33b4a..e991ae2b461c 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3048,12 +3048,18 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3048 | ret = ext4_split_unwritten_extents(handle, | 3048 | ret = ext4_split_unwritten_extents(handle, |
3049 | inode, path, iblock, | 3049 | inode, path, iblock, |
3050 | max_blocks, flags); | 3050 | max_blocks, flags); |
3051 | /* flag the io_end struct that we need convert when IO done */ | 3051 | /* |
3052 | * Flag the inode(non aio case) or end_io struct (aio case) | ||
3053 | * that this IO needs to convertion to written when IO is | ||
3054 | * completed | ||
3055 | */ | ||
3052 | if (io) | 3056 | if (io) |
3053 | io->flag = DIO_AIO_UNWRITTEN; | 3057 | io->flag = DIO_AIO_UNWRITTEN; |
3058 | else | ||
3059 | EXT4_I(inode)->i_state |= EXT4_STATE_DIO_UNWRITTEN; | ||
3054 | goto out; | 3060 | goto out; |
3055 | } | 3061 | } |
3056 | /* DIO end_io complete, convert the filled extent to written */ | 3062 | /* async DIO end_io complete, convert the filled extent to written */ |
3057 | if (flags == EXT4_GET_BLOCKS_DIO_CONVERT_EXT) { | 3063 | if (flags == EXT4_GET_BLOCKS_DIO_CONVERT_EXT) { |
3058 | ret = ext4_convert_unwritten_extents_dio(handle, inode, | 3064 | ret = ext4_convert_unwritten_extents_dio(handle, inode, |
3059 | path); | 3065 | path); |
@@ -3295,10 +3301,16 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
3295 | * To avoid unecessary convertion for every aio dio rewrite | 3301 | * To avoid unecessary convertion for every aio dio rewrite |
3296 | * to the mid of file, here we flag the IO that is really | 3302 | * to the mid of file, here we flag the IO that is really |
3297 | * need the convertion. | 3303 | * need the convertion. |
3298 | * | 3304 | * For non asycn direct IO case, flag the inode state |
3305 | * that we need to perform convertion when IO is done. | ||
3299 | */ | 3306 | */ |
3300 | if (io && flags == EXT4_GET_BLOCKS_DIO_CREATE_EXT) | 3307 | if (flags == EXT4_GET_BLOCKS_DIO_CREATE_EXT) { |
3301 | io->flag = DIO_AIO_UNWRITTEN; | 3308 | if (io) |
3309 | io->flag = DIO_AIO_UNWRITTEN; | ||
3310 | else | ||
3311 | EXT4_I(inode)->i_state |= | ||
3312 | EXT4_STATE_DIO_UNWRITTEN;; | ||
3313 | } | ||
3302 | } | 3314 | } |
3303 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); | 3315 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); |
3304 | if (err) { | 3316 | if (err) { |