diff options
author | Mingming Cao <cmm@us.ibm.com> | 2009-09-28 15:49:08 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-09-28 15:49:08 -0400 |
commit | 0031462b5b392f90d17f1d75abb795883c44e969 (patch) | |
tree | e8323861b8dede0f3ddbfc8324d650bf1f4fd74b /fs/ext4/ext4.h | |
parent | 9f0ccfd8e07d61b413e6536ffa02fbf60d2e20d8 (diff) |
ext4: Split uninitialized extents for direct I/O
When writing into an unitialized extent via direct I/O, and the direct
I/O doesn't exactly cover the unitialized extent, split the extent
into uninitialized and initialized extents before submitting the I/O.
This avoids needing to deal with an ENOSPC error in the end_io
callback that gets used for direct I/O.
When the IO is complete, the written extent will be marked as initialized.
Singed-Off-By: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index a58438e18d0b..2b4293aac162 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -128,6 +128,15 @@ struct mpage_da_data { | |||
128 | int retval; | 128 | int retval; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | typedef struct ext4_io_end { | ||
132 | struct inode *inode; /* file being written to */ | ||
133 | unsigned int flag; /* sync IO or AIO */ | ||
134 | int error; /* I/O error code */ | ||
135 | ext4_lblk_t offset; /* offset in the file */ | ||
136 | size_t size; /* size of the extent */ | ||
137 | struct work_struct work; /* data work queue */ | ||
138 | } ext4_io_end_t; | ||
139 | |||
131 | /* | 140 | /* |
132 | * Special inodes numbers | 141 | * Special inodes numbers |
133 | */ | 142 | */ |
@@ -347,7 +356,16 @@ struct ext4_new_group_data { | |||
347 | /* Call ext4_da_update_reserve_space() after successfully | 356 | /* Call ext4_da_update_reserve_space() after successfully |
348 | allocating the blocks */ | 357 | allocating the blocks */ |
349 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 | 358 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 |
350 | 359 | /* caller is from the direct IO path, request to creation of an | |
360 | unitialized extents if not allocated, split the uninitialized | ||
361 | extent if blocks has been preallocated already*/ | ||
362 | #define EXT4_GET_BLOCKS_DIO 0x0010 | ||
363 | #define EXT4_GET_BLOCKS_CONVERT 0x0020 | ||
364 | #define EXT4_GET_BLOCKS_DIO_CREATE_EXT (EXT4_GET_BLOCKS_DIO|\ | ||
365 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | ||
366 | /* Convert extent to initialized after direct IO complete */ | ||
367 | #define EXT4_GET_BLOCKS_DIO_CONVERT_EXT (EXT4_GET_BLOCKS_CONVERT|\ | ||
368 | EXT4_GET_BLOCKS_DIO_CREATE_EXT) | ||
351 | 369 | ||
352 | /* | 370 | /* |
353 | * ioctl commands | 371 | * ioctl commands |
@@ -1700,6 +1718,8 @@ extern void ext4_ext_init(struct super_block *); | |||
1700 | extern void ext4_ext_release(struct super_block *); | 1718 | extern void ext4_ext_release(struct super_block *); |
1701 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1719 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
1702 | loff_t len); | 1720 | loff_t len); |
1721 | extern int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | ||
1722 | loff_t len); | ||
1703 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, | 1723 | extern int ext4_get_blocks(handle_t *handle, struct inode *inode, |
1704 | sector_t block, unsigned int max_blocks, | 1724 | sector_t block, unsigned int max_blocks, |
1705 | struct buffer_head *bh, int flags); | 1725 | struct buffer_head *bh, int flags); |