All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Filipe Manana <fdmanana@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/6] btrfs: use a linked list for tracking per-transaction/log dirty buffers
Date: Wed, 17 May 2023 18:37:48 +0200	[thread overview]
Message-ID: <20230517163748.GA5784@lst.de> (raw)
In-Reply-To: <CAL3q7H6E6kUsqpVEaRqc=WRHatborKE+mG3BauNyYD+2Jc+O3A@mail.gmail.com>

On Wed, May 17, 2023 at 05:24:59PM +0100, Filipe Manana wrote:
> Probably what you ran into is the case where a tree block is allocated
> and freed in the same transaction before being written, in that case
> it gets added
> back to the free space cache (this happens at btrfs_free_tree_block())
> and can be allocated again in the same transaction.
> If so, in that case you can remove it from the list and you shouldn't
> run into that issue anymore.
> We currently don't remove it from the io tree in that case, because
> that may need splitting an existing extent state record and therefore
> requiring allocating memory.

Yes.  I did in fact run into exactly that when I resurrected the
old idea of the embedded list_head and add a lot of instrumentation.
With the list removal in btrfs_clear_buffer_dirty it works fine.

> > At least in theory yes.  But we also save a whole lot of lookups
> > by going directly to the object instead of indirecting through the
> > pages xarray and then again through the buffers array for the
> > sub-block case.
> 
> I think you are talking about further changes in the patchset, not
> about this particular patch?

Yes.  This one is the enabler.

> I'm talking about the data structure used to represent a range, not pages.
> The io tree is good to merge adjacent ranges and reduce the total
> structure size and used memory

Yes.  Assuming you actually want to track ranges.  But that's now
what we ultimatively want to track here, though.  In the end everything
is about the actual buffers.  Patches 3 and 6 are the other key ones
that completely removed the need for any ranges.  I've tried to keep
them separate as Dave tends to prefer split out patches, but maybe
I should just fold them back to make it more obvious what is going on
here.

> fs_mark (as you did already), dbench, fio for random writes and periodic fsync,
> anything that is not too short, runtimes of several minutes at least.

Ok.  If you have any particular workloads you care about and have
scripts for them, feel free to send them my way.

  reply	other threads:[~2023-05-17 16:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15 19:22 simplify dirty buffer tracking Christoph Hellwig
2023-05-15 19:22 ` [PATCH 1/6] btrfs: use a linked list for tracking per-transaction/log dirty buffers Christoph Hellwig
2023-05-17 10:40   ` Filipe Manana
2023-05-17 12:21     ` Christoph Hellwig
2023-05-17 16:24       ` Filipe Manana
2023-05-17 16:37         ` Christoph Hellwig [this message]
2023-05-15 19:22 ` [PATCH 2/6] btrfs: remove convert_extent_bit Christoph Hellwig
2023-05-15 19:22 ` [PATCH 3/6] btrfs: directly wait for buffer writeback completion in btrfs_wait_buffers Christoph Hellwig
2023-05-15 19:22 ` [PATCH 4/6] btrfs: move dropping the bg reference out of submit_eb_page Christoph Hellwig
2023-05-15 19:22 ` [PATCH 5/6] btrfs: move locking and write pointer checking into write_one_eb Christoph Hellwig
2023-05-15 19:22 ` [PATCH 6/6] btrfs: bypass filemap_fdatawrite_range in btrfs_write_buffers Christoph Hellwig

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=20230517163748.GA5784@lst.de \
    --to=hch@lst.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@gmail.com \
    --cc=josef@toxicpanda.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.