• Filipe Manana's avatar
    Btrfs: correctly flush compressed data before/after direct IO · 075bdbdb
    Filipe Manana authored
    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: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    075bdbdb
file.c 74 KB