linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE
@ 2025-04-29 13:42 Johannes Thumshirn
  2025-04-29 14:48 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2025-04-29 13:42 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: linux-block, Damien Le Moal, Christoph Hellwig,
	Johannes Thumshirn

From: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Use ZONEFS_SUPER_SIZE constant instead of PAGE_SIZE allocating memory for
reading the super block in zonefs_read_super().

While PAGE_SIZE technically isn't incorrect as Linux doesn't support pages
smaller than 4k ZONEFS_SUPER_SIZE is semantically more correct.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

---
This patch is based on top of Christoph's series titled "add more bio
helper" specifically on top of "[PATCH 16/17] zonefs: use bdev_rw_virt in
zonefs_read_super"
---
 fs/zonefs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index d165eb979f21..4dc7f967c861 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -1113,11 +1113,12 @@ static int zonefs_read_super(struct super_block *sb)
 	u32 crc, stored_crc;
 	int ret;
 
-	super = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	super = kmalloc(ZONEFS_SUPER_SIZE, GFP_KERNEL);
 	if (!super)
 		return -ENOMEM;
 
-	ret = bdev_rw_virt(sb->s_bdev, 0, super, PAGE_SIZE, REQ_OP_READ);
+	ret = bdev_rw_virt(sb->s_bdev, 0, super, ZONEFS_SUPER_SIZE,
+			   REQ_OP_READ);
 	if (ret)
 		goto free_super;
 
-- 
2.43.0


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

* Re: [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE
  2025-04-29 13:42 [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE Johannes Thumshirn
@ 2025-04-29 14:48 ` Darrick J. Wong
  2025-05-07  4:16 ` Damien Le Moal
  2025-06-13  8:07 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2025-04-29 14:48 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: linux-fsdevel, linux-block, Damien Le Moal, Christoph Hellwig,
	Johannes Thumshirn

On Tue, Apr 29, 2025 at 03:42:53PM +0200, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> Use ZONEFS_SUPER_SIZE constant instead of PAGE_SIZE allocating memory for
> reading the super block in zonefs_read_super().
> 
> While PAGE_SIZE technically isn't incorrect as Linux doesn't support pages
> smaller than 4k ZONEFS_SUPER_SIZE is semantically more correct.

Yeah, that is less likely to leave a landmine if the super size ever
gets bigger or someone goes nuts and reintroduces tinypages.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> ---
> This patch is based on top of Christoph's series titled "add more bio
> helper" specifically on top of "[PATCH 16/17] zonefs: use bdev_rw_virt in
> zonefs_read_super"
> ---
>  fs/zonefs/super.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index d165eb979f21..4dc7f967c861 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -1113,11 +1113,12 @@ static int zonefs_read_super(struct super_block *sb)
>  	u32 crc, stored_crc;
>  	int ret;
>  
> -	super = kmalloc(PAGE_SIZE, GFP_KERNEL);
> +	super = kmalloc(ZONEFS_SUPER_SIZE, GFP_KERNEL);
>  	if (!super)
>  		return -ENOMEM;
>  
> -	ret = bdev_rw_virt(sb->s_bdev, 0, super, PAGE_SIZE, REQ_OP_READ);
> +	ret = bdev_rw_virt(sb->s_bdev, 0, super, ZONEFS_SUPER_SIZE,
> +			   REQ_OP_READ);
>  	if (ret)
>  		goto free_super;
>  
> -- 
> 2.43.0
> 
> 

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

* Re: [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE
  2025-04-29 13:42 [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE Johannes Thumshirn
  2025-04-29 14:48 ` Darrick J. Wong
@ 2025-05-07  4:16 ` Damien Le Moal
  2025-06-13  8:07 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-05-07  4:16 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-fsdevel
  Cc: linux-block, Christoph Hellwig, Johannes Thumshirn

On 4/29/25 10:42 PM, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> Use ZONEFS_SUPER_SIZE constant instead of PAGE_SIZE allocating memory for
> reading the super block in zonefs_read_super().
> 
> While PAGE_SIZE technically isn't incorrect as Linux doesn't support pages
> smaller than 4k ZONEFS_SUPER_SIZE is semantically more correct.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> ---
> This patch is based on top of Christoph's series titled "add more bio
> helper" specifically on top of "[PATCH 16/17] zonefs: use bdev_rw_virt in
> zonefs_read_super"

And because of that, I will apply it next cycle I think.

> ---
>  fs/zonefs/super.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index d165eb979f21..4dc7f967c861 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -1113,11 +1113,12 @@ static int zonefs_read_super(struct super_block *sb)
>  	u32 crc, stored_crc;
>  	int ret;
>  
> -	super = kmalloc(PAGE_SIZE, GFP_KERNEL);
> +	super = kmalloc(ZONEFS_SUPER_SIZE, GFP_KERNEL);
>  	if (!super)
>  		return -ENOMEM;
>  
> -	ret = bdev_rw_virt(sb->s_bdev, 0, super, PAGE_SIZE, REQ_OP_READ);
> +	ret = bdev_rw_virt(sb->s_bdev, 0, super, ZONEFS_SUPER_SIZE,
> +			   REQ_OP_READ);
>  	if (ret)
>  		goto free_super;
>  


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE
  2025-04-29 13:42 [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE Johannes Thumshirn
  2025-04-29 14:48 ` Darrick J. Wong
  2025-05-07  4:16 ` Damien Le Moal
@ 2025-06-13  8:07 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-06-13  8:07 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-fsdevel
  Cc: linux-block, Christoph Hellwig, Johannes Thumshirn

On 4/29/25 22:42, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> Use ZONEFS_SUPER_SIZE constant instead of PAGE_SIZE allocating memory for
> reading the super block in zonefs_read_super().
> 
> While PAGE_SIZE technically isn't incorrect as Linux doesn't support pages
> smaller than 4k ZONEFS_SUPER_SIZE is semantically more correct.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Applied to for-6.17. Thanks !

-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2025-06-13  8:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 13:42 [PATCH] zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE Johannes Thumshirn
2025-04-29 14:48 ` Darrick J. Wong
2025-05-07  4:16 ` Damien Le Moal
2025-06-13  8:07 ` Damien Le Moal

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).