]> git.hungrycats.org Git - linux/commit
Btrfs: correctly flush compressed data before/after direct IO
authorFilipe Manana <fdmanana@suse.com>
Thu, 9 Oct 2014 20:18:55 +0000 (21:18 +0100)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Fri, 23 Jan 2015 13:16:42 +0000 (08:16 -0500)
commit807c9c2fe1261896dede58d0d55fbdb416c4cdc5
treef57deb510405fed1edc46773e60a2950e83bd27a
parentff5f8e4c4cd9d6e66200348f8bddcfabeef76e7c
Btrfs: correctly flush compressed data before/after direct IO

For compressed writes, after doing the first filemap_fdatawrite_range() we
don't get the pages tagged for writeback immediately. Instead we create
a workqueue task, which is run by other kthread, and keep the pages locked.
That other kthread compresses data, creates the respective ordered extent/s,
tags the pages for writeback and unlocks them. Therefore we need a second
call to filemap_fdatawrite_range() if we have compressed writes, as this
second call will wait for the pages to become unlocked, then see they became
tagged for writeback and finally wait for the writeback to finish.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 075bdbdbe9f21d68950ba5b187f80a4a23105365)
fs/btrfs/file.c
fs/btrfs/inode.c