]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Btrfs: just do dirty page flush for the inode with compression before direct IO
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 6 Mar 2014 05:54:57 +0000 (13:54 +0800)
committerJosef Bacik <jbacik@fb.com>
Mon, 10 Mar 2014 19:17:24 +0000 (15:17 -0400)
commit41bd9ca459a007cc5588563bb08de9677c8d23fd
tree4721ab45d20f2e4baa7092ff96241c5aa94b1434
parentaf7a65097b3f0a63caf1755df78d04e1a33588ef
Btrfs: just do dirty page flush for the inode with compression before direct IO

As the comment in the btrfs_direct_IO says, only the compressed pages need be
flush again to make sure they are on the disk, but the common pages needn't,
so we add a if statement to check if the inode has compressed pages or not,
if no, skip the flush.

And in order to prevent the write ranges from intersecting, we need wait for
the running ordered extents. But the current code waits for them twice, one
is done before the direct IO starts (in btrfs_wait_ordered_range()), the other
is before we get the blocks, it is unnecessary. because we can do the direct
IO without holding i_mutex, it means that the intersected ordered extents may
happen during the direct IO, the first wait can not avoid this problem. So we
use filemap_fdatawrite_range() instead of btrfs_wait_ordered_range() to remove
the first wait.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/inode.c