linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naohiro Aota <Naohiro.Aota@wdc.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: David Sterba <dsterba@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: zoned: clear data relocation bg on zone finish
Date: Thu, 2 Dec 2021 12:55:29 +0000	[thread overview]
Message-ID: <20211202125528.zrf67bgdp4ugwerm@naota-xeon> (raw)
In-Reply-To: <50bfb0a3d3bedc7038f2e1926c95aa71a3260e75.1638434808.git.johannes.thumshirn@wdc.com>

On Thu, Dec 02, 2021 at 12:47:14AM -0800, Johannes Thumshirn wrote:
> When finishing a zone that is used by a dedicated data relocation
> block_group, also remove its reference from fs_info, so we're not trying
> to use a full block_group for allocations during data relocation, which
> will always fail.
> 
> The result is we're not making any forward progress and end up in a
> deadlock situation.
> 
> Cc: Naohiro Aota <Naohiro.Aota@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Looks good.
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>

> ---
>  fs/btrfs/zoned.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index c917867a4261..9cdef5e8f6b7 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -1915,6 +1915,7 @@ int btrfs_zone_finish(struct btrfs_block_group *block_group)
>  	block_group->alloc_offset = block_group->zone_capacity;
>  	block_group->free_space_ctl->free_space = 0;
>  	btrfs_clear_treelog_bg(block_group);
> +	btrfs_clear_data_reloc_bg(block_group);
>  	spin_unlock(&block_group->lock);
>  
>  	ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
> @@ -1997,6 +1998,7 @@ void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 len
>  	ASSERT(block_group->alloc_offset == block_group->zone_capacity);
>  	ASSERT(block_group->free_space_ctl->free_space == 0);
>  	btrfs_clear_treelog_bg(block_group);
> +	btrfs_clear_data_reloc_bg(block_group);
>  	spin_unlock(&block_group->lock);
>  
>  	map = block_group->physical_map;
> -- 
> 2.31.1
> 

  reply	other threads:[~2021-12-02 12:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  8:47 [PATCH] btrfs: zoned: clear data relocation bg on zone finish Johannes Thumshirn
2021-12-02 12:55 ` Naohiro Aota [this message]
2021-12-06 17:59 ` David Sterba

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=20211202125528.zrf67bgdp4ugwerm@naota-xeon \
    --to=naohiro.aota@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=dsterba@suse.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 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).