All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: David Sterba <dsterba@suse.com>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	Naohiro Aota <naohiro.aota@wdc.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: zoned: limit ordered extent to zoned append size
Date: Tue, 1 Jun 2021 18:17:47 +0200	[thread overview]
Message-ID: <20210601161747.GH31483@suse.cz> (raw)
In-Reply-To: <da3a097233a87541120dbb2a9624841c7a9e3962.1622552385.git.johannes.thumshirn@wdc.com>

On Tue, Jun 01, 2021 at 10:02:10PM +0900, Johannes Thumshirn wrote:
> Damien reported a test failure with btrfs/209. The test itself ran fine,
> but the fsck run afterwards reported a corrupted filesystem.
> 
> The filesystem corruption happens because we're splitting an extent and
> then writing the extent twice. We have to split the extent though, because
> we're creating too large extents for a REQ_OP_ZONE_APPEND operation.
> 
> When dumping the extent tree, we can see two EXTENT_ITEMs at the same
> start address but different lengths.
> 
> $ btrfs inspect dump-tree /dev/nullb1 -t extent
> ...
>    item 19 key (269484032 EXTENT_ITEM 126976) itemoff 15470 itemsize 53
>            refs 1 gen 7 flags DATA
>            extent data backref root FS_TREE objectid 257 offset 786432 count 1
>    item 20 key (269484032 EXTENT_ITEM 262144) itemoff 15417 itemsize 53
>            refs 1 gen 7 flags DATA
>            extent data backref root FS_TREE objectid 257 offset 786432 count 1
> 
> On a zoned filesystem, limit the size of an ordered extent to the maximum
> size that can be issued as a single REQ_OP_ZONE_APPEND operation.
> 
> Note: This patch breaks fstests btrfs/079, as it increases the number of
> on-disk extents from 80 to 83 per 10M write.
> 
> Reported-by: Damien Le Moal <damien.lemoal@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  fs/btrfs/ctree.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 5d0398528a7a..6fbafaaebda0 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -1373,7 +1373,10 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
>  
>  static inline u64 btrfs_get_max_extent_size(struct btrfs_fs_info *fs_info)
>  {
> -	return BTRFS_MAX_EXTENT_SIZE;
> +	if (!fs_info || !fs_info->max_zone_append_size)
> +		return BTRFS_MAX_EXTENT_SIZE;
> +	return min_t(u64, BTRFS_MAX_EXTENT_SIZE,
> +		     ALIGN_DOWN(fs_info->max_zone_append_size, PAGE_SIZE));

Should this be set only once in btrfs_check_zoned_mode ?

>  }
>  
>  /*
> -- 
> 2.31.1
> 

  reply	other threads:[~2021-06-01 16:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 13:02 [PATCH 0/2] btrfs: zoned: limit max extent size to max zone append Johannes Thumshirn
2021-06-01 13:02 ` [PATCH 1/2] btrfs: add a helper for retrieving BTRFS_MAX_EXTENT_SIZE Johannes Thumshirn
2021-06-01 13:02 ` [PATCH 2/2] btrfs: zoned: limit ordered extent to zoned append size Johannes Thumshirn
2021-06-01 16:17   ` David Sterba [this message]
2021-06-02  6:05     ` Johannes Thumshirn
2021-06-02 11:13       ` 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=20210601161747.GH31483@suse.cz \
    --to=dsterba@suse.cz \
    --cc=damien.lemoal@wdc.com \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --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 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.