]> git.itanic.dy.fi Git - linux-stable/commit
ext4: Fix return value of ext4_split_unwritten_extents() to fix direct I/O
authorMingming <cmm@us.ibm.com>
Fri, 6 Nov 2009 09:01:23 +0000 (04:01 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:07:20 +0000 (08:07 -0800)
commit00909f7247db77fa3a3237b1d7b3d69ea25edd8a
tree18df8a50f44db44f6190dc98c947f16ecd18de56
parent2bcfe650d1b5c9994ce58a25efd5a6f5eb4ad0ee
ext4: Fix return value of ext4_split_unwritten_extents() to fix direct I/O

(cherry picked from commit ba230c3f6dc88ec008806adb27b12088486d508e)

To prepare for a direct I/O write, we need to split the unwritten
extents before submitting the I/O.  When no extents needed to be
split, ext4_split_unwritten_extents() was incorrectly returning 0
instead of the size of uninitialized extents. This bug caused the
wrong return value sent back to VFS code when it gets called from
async IO path, leading to an unnecessary fall back to buffered IO.

This bug also hid the fact that the check to see whether or not a
split would be necessary was incorrect; we can only skip splitting the
extent if the write completely covers the uninitialized extent.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/extents.c