btrfs: track ordered bytes instead of just dio ordered bytes
authorJosef Bacik <josef@toxicpanda.com>
Fri, 9 Oct 2020 13:28:20 +0000 (09:28 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:58 +0000 (22:58 +0100)
commit5deb17e18e27a3502f21581ba4d086e762b86b31
treee42ea3752a860bc9f209527bfaeb76703fa67883
parentac1ea10e757a57fb61512ae9beb2ef67e5340e31
btrfs: track ordered bytes instead of just dio ordered bytes

We track dio_bytes because the shrink delalloc code needs to know if we
have more DIO in flight than we have normal buffered IO.  The reason for
this is because we can't "flush" DIO, we have to just wait on the
ordered extents to finish.

However this is true of all ordered extents.  If we have more ordered
space outstanding than dirty pages we should be waiting on ordered
extents.  We already are ok on this front technically, because we always
do a FLUSH_DELALLOC_WAIT loop, but I want to use the ordered counter in
the preemptive flushing code as well, so change this to count all
ordered bytes instead of just DIO ordered bytes.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/ordered-data.c
fs/btrfs/space-info.c