All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: align max_zone_append_size to the sector size
@ 2022-07-14  9:16 Christoph Hellwig
  2022-07-14  9:21 ` Johannes Thumshirn
  2022-07-14 12:52 ` David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-07-14  9:16 UTC (permalink / raw)
  To: clm, josef, dsterba, naohiro.aota; +Cc: linux-btrfs

max_zone_append_size and thus the maximum extent size needs to be aligned
to the sector size, else a lot code becomes rather unhappy and various
alignment asserts trigger.

Fixes: 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/zoned.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 3b45b35aa945c..fbad2e489dc80 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -739,7 +739,8 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
 	}
 
 	fs_info->zone_size = zone_size;
-	fs_info->max_zone_append_size = max_zone_append_size;
+	fs_info->max_zone_append_size =
+		ALIGN(max_zone_append_size, fs_info->sectorsize);
 	fs_info->fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_ZONED;
 	if (fs_info->max_zone_append_size < fs_info->max_extent_size)
 		fs_info->max_extent_size = fs_info->max_zone_append_size;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: align max_zone_append_size to the sector size
  2022-07-14  9:16 [PATCH] btrfs: align max_zone_append_size to the sector size Christoph Hellwig
@ 2022-07-14  9:21 ` Johannes Thumshirn
  2022-07-14 12:52 ` David Sterba
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2022-07-14  9:21 UTC (permalink / raw)
  To: Christoph Hellwig, clm, josef, dsterba, Naohiro Aota; +Cc: linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: align max_zone_append_size to the sector size
  2022-07-14  9:16 [PATCH] btrfs: align max_zone_append_size to the sector size Christoph Hellwig
  2022-07-14  9:21 ` Johannes Thumshirn
@ 2022-07-14 12:52 ` David Sterba
  2022-07-18  8:11   ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: David Sterba @ 2022-07-14 12:52 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: clm, josef, dsterba, naohiro.aota, linux-btrfs

On Thu, Jul 14, 2022 at 11:16:09AM +0200, Christoph Hellwig wrote:
> max_zone_append_size and thus the maximum extent size needs to be aligned
> to the sector size, else a lot code becomes rather unhappy and various
> alignment asserts trigger.
> 
> Fixes: 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Folded to the patch, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: align max_zone_append_size to the sector size
  2022-07-14 12:52 ` David Sterba
@ 2022-07-18  8:11   ` Christoph Hellwig
  2022-07-18 14:31     ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2022-07-18  8:11 UTC (permalink / raw)
  To: dsterba, Christoph Hellwig, clm, josef, dsterba, naohiro.aota,
	linux-btrfs

On Thu, Jul 14, 2022 at 02:52:47PM +0200, David Sterba wrote:
> > Fixes: 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Folded to the patch, thanks.

Turns out this is still broken as I was misled by the fancy ALIGN
macro.  We need the incremental change below.  Do you want to fold
this in again or should I sent it as a separate patch:


diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 606cd4aab3902..fb335e87b2212 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -740,7 +740,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
 
 	fs_info->zone_size = zone_size;
 	fs_info->max_zone_append_size =
-		ALIGN(max_zone_append_size, fs_info->sectorsize);
+		ALIGN_DOWN(max_zone_append_size, fs_info->sectorsize);
 	fs_info->fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_ZONED;
 	if (fs_info->max_zone_append_size < fs_info->max_extent_size)
 		fs_info->max_extent_size = fs_info->max_zone_append_size;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: align max_zone_append_size to the sector size
  2022-07-18  8:11   ` Christoph Hellwig
@ 2022-07-18 14:31     ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2022-07-18 14:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: dsterba, clm, josef, dsterba, naohiro.aota, linux-btrfs

On Mon, Jul 18, 2022 at 10:11:27AM +0200, Christoph Hellwig wrote:
> On Thu, Jul 14, 2022 at 02:52:47PM +0200, David Sterba wrote:
> > > Fixes: 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > 
> > Folded to the patch, thanks.
> 
> Turns out this is still broken as I was misled by the fancy ALIGN
> macro.  We need the incremental change below.  Do you want to fold
> this in again or should I sent it as a separate patch:

Folding small fixups is easier for me, no need to resend, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-18 14:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14  9:16 [PATCH] btrfs: align max_zone_append_size to the sector size Christoph Hellwig
2022-07-14  9:21 ` Johannes Thumshirn
2022-07-14 12:52 ` David Sterba
2022-07-18  8:11   ` Christoph Hellwig
2022-07-18 14:31     ` David Sterba

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.