linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3 v3] ext4: dio overwrite nolock
@ 2012-07-01 14:21 Zheng Liu
  2012-07-01 14:21 ` [PATCH 1/3 v3] ext4: split ext4_file_write into buffered IO and direct IO Zheng Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zheng Liu @ 2012-07-01 14:21 UTC (permalink / raw)
  To: linux-ext4; +Cc: Zheng Liu, Tao Ma, Eric Sandeen, Robin Dong

Hello list,

Here is the third version of dio overwrite nolock.  In this version, I rework
some codes according to Robin's reply.

This patch set can improve the performance of ext4 when the user does a dio
overwrite because, when a dio overwrite occurs, we don't need to take i_mutex
lock in some conditons.  The condition includes the size of file doesn't be
changed, and align aio.  So dio write can be parallelized in these conditions.

In patch 1, ext4_file_dio_write is defined to split buffered I/O and direct I/O
in ext4_file_write so that some codes can be added to check whether we can do a
dio overwrite without i_mutex lock later.

In patch 2, a new flag called EXT4_GET_BLOCKS_NOLOCK and a new get_block
function that is named ext4_get_block_write_nolock are defined to do a lookup to
let me know whether the extent of the file at this offset has been initialized
because we need to know whether a dio overwrite needs to modify the metadata of
the file or not.

In patch 3, we implement dio overwrite nolock.  In ext4_file_dio_write, we check
whether we can do a dio overwrite without lock.  Then we use 'iocb->private'
to store this flag to tell ext4_ext_direct_IO to handle it because
file_update_time will start a new journal and it will cause a deadlock.  So we
need to finish to update file time with i_mutex lock, and release lock in
ext4_ext_direct_IO.

v3 <- v2:
 * change the condition check of dio overwrite nolock in ext4_file_dio_write
 * rename 'create' variable to 'flags' in ext4_get_block_write_nolock
 * remove a duplicated if statement in ext4_ext_direct_IO

v2 <- v1:
 * rebase to 3.5
 * rework ext4_file_dio_write to avoid to copy vfs's code back into ext4
 * add some comments to explain how to determine whether we can do a nolocking
   overwrite dio

Any comments are welcomed.  Thanks.

Regards,
Zheng

Zheng Liu (3):
      ext4: split ext4_file_write into buffered IO and direct IO
      ext4: add a new flag for ext4_map_blocks
      ext4: add dio overwrite nolock

 fs/ext4/ext4.h  |    2 +
 fs/ext4/file.c  |  107 +++++++++++++++++++++++++++++++++++++++++++-----------
 fs/ext4/inode.c |   76 ++++++++++++++++++++++++++++++++++-----
 3 files changed, 153 insertions(+), 32 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-09 15:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-01 14:21 [PATCH 0/3 v3] ext4: dio overwrite nolock Zheng Liu
2012-07-01 14:21 ` [PATCH 1/3 v3] ext4: split ext4_file_write into buffered IO and direct IO Zheng Liu
2012-07-09 14:44   ` Theodore Ts'o
2012-07-01 14:21 ` [PATCH 2/3 v3] ext4: add a new flag for ext4_map_blocks Zheng Liu
2012-07-09 14:49   ` Theodore Ts'o
2012-07-01 14:21 ` [PATCH 3/3 v3] ext4: add dio overwrite nolock Zheng Liu
2012-07-09 15:01   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).