]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: track DIO bytes in flight
authorJosef Bacik <josef@toxicpanda.com>
Wed, 10 Apr 2019 19:56:09 +0000 (15:56 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:25:37 +0000 (19:25 +0200)
commite412b83723f9bb320aa0bb9693c8d92d3ec148cf
tree1067cbeed0ca1e28f56402343a6b156c6ac91bea
parentbb4b6e3974f957a21ca424e92dec934a8c2bf894
btrfs: track DIO bytes in flight

When diagnosing a slowdown of generic/224 I noticed we were not doing
anything when calling into shrink_delalloc().  This is because all
writes in 224 are O_DIRECT, not delalloc, and thus our delalloc_bytes
counter is 0, which short circuits most of the work inside of
shrink_delalloc().  However O_DIRECT writes still consume metadata
resources and generate ordered extents, which we can still wait on.

Fix this by tracking outstanding DIO write bytes, and use this as well
as the delalloc bytes counter to decide if we need to lookup and wait on
any ordered extents.  If we have more DIO writes than delalloc bytes
we'll go ahead and wait on any ordered extents regardless of our flush
state as flushing delalloc is likely to not gain us anything.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[ use dio instead of odirect in identifiers ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/ordered-data.c