]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: Use end_io callback to avoid direct I/O fallback to buffered I/O
authorMingming Cao <cmm@us.ibm.com>
Mon, 28 Sep 2009 19:48:41 +0000 (15:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 28 Sep 2009 19:48:41 +0000 (15:48 -0400)
commitc0c6c5d66053fb22dde8fa5412e80b6ce0a8e091
treea8718f5f4574af8e15fd876b24f4aec88d62451b
parent320d1908f23fb5cc423b4f7792f2bde5bcba6410
ext4: Use end_io callback to avoid direct I/O fallback to buffered I/O

Currently the DIO VFS code passes create = 0 when writing to the
middle of file.  It does this to avoid block allocation for holes, so
as not to expose stale data out when there is a parallel buffered read
(which does not hold the i_mutex lock).  Direct I/O writes into holes
falls back to buffered IO for this reason.

Since preallocated extents are treated as holes when doing a
get_block() look up (buffer is not mapped), direct IO over fallocate
also falls back to buffered IO.  Thus ext4 actually silently falls
back to buffered IO in above two cases, which is undesirable.

To fix this, this patch creates unitialized extents when a direct I/O
write into holes in sparse files, and registering an end_io callback which
converts the uninitialized extent to an initialized extent after the
I/O is completed.

Singed-Off-By: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/super.c