linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Naohiro Aota <naohiro.aota@wdc.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/8] btrfs: zoned: introduce block_group context for submit_eb_page()
Date: Mon, 24 Jul 2023 08:00:04 -0700	[thread overview]
Message-ID: <ZL6R9OwFlwwmrcKo@infradead.org> (raw)
In-Reply-To: <d20226362b9b193d85f63e81ee128ef3062e2203.1690171333.git.naohiro.aota@wdc.com>

On Mon, Jul 24, 2023 at 01:18:30PM +0900, Naohiro Aota wrote:
> For metadata write out on the zoned mode, we call
> btrfs_check_meta_write_pointer() to check if an extent buffer to be written
> is aligned to the write pointer.
> 
> We lookup for a block group containing the extent buffer for every extent
> buffer, which take unnecessary effort as the writing extent buffers are
> mostly contiguous.
> 
> Introduce "bg_context" to cache the block group working on.

As someone who already found the eb_context naming and handling in the
existing code highly confusing, I wonder if we should first add a new
eb_write_context structure, which initially contains the wbc
and eb_context pointers, and which also would grow the bg.  This
should make argument passing a little simpler, but most importantly
removes all the dealing with the double pointers that need a lot
of checking and clearing.

> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index 5e4285ae112c..58bd2de4026d 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -1751,27 +1751,33 @@ bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
>  				    struct extent_buffer *eb,
>  				    struct btrfs_block_group **cache_ret)
>  {
>
>
> -	struct btrfs_block_group *cache;
> -	bool ret = true;
> +	struct btrfs_block_group *cache = NULL;

.. and independent of the above comment, I also found the "cache" and
"cache_ret" namings here very highly confusing.  What speaks again
using a bg-based naming that makes it clear what we're dealing with?

  reply	other threads:[~2023-07-24 15:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24  4:18 [PATCH 0/8] btrfs: zoned: write-time activation of metadata block group Naohiro Aota
2023-07-24  4:18 ` [PATCH 1/8] btrfs: zoned: introduce block_group context for submit_eb_page() Naohiro Aota
2023-07-24 15:00   ` Christoph Hellwig [this message]
2023-07-25  5:44     ` Naohiro Aota
2023-07-24  4:18 ` [PATCH 2/8] btrfs: zoned: defer advancing meta_write_pointer Naohiro Aota
2023-07-24 15:04   ` Christoph Hellwig
2023-07-25  8:59     ` Naohiro Aota
2023-07-26 13:06       ` hch
2023-07-24  4:18 ` [PATCH 3/8] btrfs: zoned: update meta_write_pointer on zone finish Naohiro Aota
2023-07-24 15:04   ` Christoph Hellwig
2023-07-25  9:01     ` Naohiro Aota
2023-07-24  4:18 ` [PATCH 4/8] btrfs: zoned: reserve zones for an active metadata/system block group Naohiro Aota
2023-07-24 15:06   ` Christoph Hellwig
2023-07-25  9:07     ` Naohiro Aota
2023-07-26 13:07       ` hch
2023-07-24  4:18 ` [PATCH 5/8] btrfs: zoned: activate metadata block group on write time Naohiro Aota
2023-07-24  6:24   ` kernel test robot
2023-07-24  7:36   ` kernel test robot
2023-07-24  7:57   ` kernel test robot
2023-07-24 15:12   ` Christoph Hellwig
2023-07-25  9:28     ` Naohiro Aota
2023-07-26 13:10       ` hch
2023-07-24  4:18 ` [PATCH 6/8] btrfs: zoned: no longer count fresh BG region as zone unusable Naohiro Aota
2023-07-24  4:18 ` [PATCH 7/8] btrfs: zoned: don't activate non-DATA BG on allocation Naohiro Aota
2023-07-24  4:18 ` [PATCH 8/8] btrfs: zoned: re-enable metadata over-commit for zoned mode Naohiro Aota

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=ZL6R9OwFlwwmrcKo@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).