OSDN Git Service

Btrfs: do not make defrag wait on async_delalloc_pages
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 7 Sep 2017 17:22:21 +0000 (11:22 -0600)
committerDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 11:27:59 +0000 (12:27 +0100)
commit80e03a2c512bd78858c130d6fe3b11982a61c0c5
treeabc120b5917b68a05ad6975463a599991e1b066f
parentf851689b5ae3eb8e1b4d397eaf2805ccfd88bf77
Btrfs: do not make defrag wait on async_delalloc_pages

By setting compression for a defrag task, the task will start IO at
the end of defrag.

After the combo of filemap_flush(), we've already made sure that
dirty pages have made progress via async compress thread because the
second filemap_flush() will wait for page lock, which won't be
unlocked until those pages have been marked as writeback and ordered
extents have been queued.

And this is for per-inode defrag, it's not helpful to wait on a global
%async_delalloc_pages and %nr_async_submits from fs_info.

Although waiting on %nr_async_submits means that all bios are
submitted down to per-device schedule IO lists, it doesn't wait for
their completions, thus users still need to do fsync/sync to make sure
the data is on disk.  While with this change, it makes sure that pages
are marked with writeback bits and will be submitted asynchronously
shortly, therefore, the behavior of defrag option '-c' remains unchanged.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c