All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH][v2] btrfs: track odirect bytes in flight
Date: Mon, 29 Apr 2019 20:17:24 +0200	[thread overview]
Message-ID: <20190429181724.GX20156@twin.jikos.cz> (raw)
In-Reply-To: <20190425205247.99177-1-josef@toxicpanda.com>

On Thu, Apr 25, 2019 at 04:52:47PM -0400, Josef Bacik wrote:
> 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 outstandingn odirect write bytes, and use this as
> well as the delalloc byts counter to decide if we need to lookup and
> wait on any ordered extents.  If we have more odirect writes than
> delalloc bytes we'll go ahead and wait on any ordered extents
> irregardless of our flush state as flushing delalloc is likely to not
> gain us anything.

Ok, that helps.

> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
> v1->v2:
> - updated the changelog
> 
>  fs/btrfs/ctree.h        |  1 +
>  fs/btrfs/disk-io.c      | 15 ++++++++++++++-
>  fs/btrfs/extent-tree.c  | 17 +++++++++++++++--
>  fs/btrfs/ordered-data.c |  9 ++++++++-
>  4 files changed, 38 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 7e774d48c48c..e293d74b2ead 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -1016,6 +1016,7 @@ struct btrfs_fs_info {
>  	/* used to keep from writing metadata until there is a nice batch */
>  	struct percpu_counter dirty_metadata_bytes;
>  	struct percpu_counter delalloc_bytes;
> +	struct percpu_counter odirect_bytes;

I've changed odirect to dio everywhere, as this is the common reference
to direct IO kernel code, O_DIRECT is for userspace.

      reply	other threads:[~2019-04-29 18:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 19:56 [PATCH 0/2] ENOSPC refinements Josef Bacik
2019-04-10 19:56 ` [PATCH 1/2] btrfs: track odirect bytes in flight Josef Bacik
2019-04-12 10:17   ` Nikolay Borisov
2019-04-12 13:30     ` Josef Bacik
2019-04-24 17:26     ` David Sterba
2019-04-10 19:56 ` [PATCH 2/2] btrfs: reserve delalloc metadata differently Josef Bacik
2019-04-12 13:06   ` Nikolay Borisov
2019-04-12 13:26     ` Josef Bacik
2019-04-12 13:35       ` Nikolay Borisov
2019-04-12 13:37         ` Josef Bacik
2019-04-29 18:33   ` David Sterba
2019-04-25 15:22 ` [PATCH 0/2] ENOSPC refinements David Sterba
2019-04-25 20:52 ` [PATCH][v2] btrfs: track odirect bytes in flight Josef Bacik
2019-04-29 18:17   ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190429181724.GX20156@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.