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)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 Nov 2009 09:01:23 +0000 (04:01 -0500)
commitba230c3f6dc88ec008806adb27b12088486d508e
tree4cd81bc7425161f1103408ce210be9172a2ee6c3
parent4b70df181611012a3556f017b57dfcef7e1d279f
ext4: Fix return value of ext4_split_unwritten_extents() to fix direct I/O

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>
fs/ext4/extents.c