Skip to contentSkip to conversation

zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE

PATCH Applied Johannes Thumshirn 3 participants 4 messages Apr 29, 2025 – Jun 13, 2025

Subsystems (3)
lore
Share & tools
lore

Johannes Thumshirn

author reviewer
#0 lore raw

PATCH 1/1 zonefs: use ZONEFS_SUPER_SIZE instead of PAGE_SIZE

From: Johannes Thumshirn <[email protected]>

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.

---
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(-)
fs/zonefs/super.c +3 -2
index d165eb979f21..4dc7f967c861 100644
@@ -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;
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Johannes Thumshirn

From: Johannes Thumshirn <[email protected]>

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.

--D

Quoted 34 lines

---
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(-)
fs/zonefs/super.c +3 -2
index d165eb979f21..4dc7f967c861 100644
@@ -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;
 
Signature · 1 line
2.43.0
maintainer
#2 lore raw
In reply to Johannes Thumshirn
Quoted 8 lines · Johannes Thumshirn

From: Johannes Thumshirn <[email protected]>

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.

Quoted 6 lines

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

Quoted 23 lines
---
 fs/zonefs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/zonefs/super.c +3 -2
index d165eb979f21..4dc7f967c861 100644
@@ -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;
 
Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer Applied
#3 lore raw
In reply to Johannes Thumshirn
Quoted 9 lines · Johannes Thumshirn

From: Johannes Thumshirn <[email protected]>

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.

Applied to for-6.17. Thanks !

Signature · 2 lines
Damien Le Moal
Western Digital Research