Skip to contentSkip to conversation

initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image()

PATCH In review Thorsten Blum 3 participants 4 messages Sep 13, 2025 – Sep 15, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image()

Both Minix and Ext2 filesystems are located at 'start_block + 1'. Update the log messages to report the correct block numbers.

Replace printk(KERN_NOTICE) with pr_notice() to avoid checkpatch warnings.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 init/do_mounts_rd.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
init/do_mounts_rd.c +4 -6
index ac021ae6e6fa..9283fdd605f0 100644
@@ -148,9 +148,8 @@ identify_ramdisk_image(struct file *file, loff_t pos,
 	/* Try minix */
 	if (minixsb->s_magic == MINIX_SUPER_MAGIC ||
 	    minixsb->s_magic == MINIX_SUPER_MAGIC2) {
-		printk(KERN_NOTICE
-		       "RAMDISK: Minix filesystem found at block %d\n",
-		       start_block);
+		pr_notice("RAMDISK: Minix filesystem found at block %d\n",
+			  start_block + 1);
 		nblocks = minixsb->s_nzones << minixsb->s_log_zone_size;
 		goto done;
 	}
@@ -158,9 +157,8 @@ identify_ramdisk_image(struct file *file, loff_t pos,
 	/* Try ext2 */
 	n = ext2_image_size(buf);
 	if (n) {
-		printk(KERN_NOTICE
-		       "RAMDISK: ext2 filesystem found at block %d\n",
-		       start_block);
+		pr_notice("RAMDISK: ext2 filesystem found at block %d\n",
+			  start_block + 1);
 		nblocks = n;
 		goto done;
 	}
Signature · 1 line
2.51.0
#1 lore raw

Hi Thorsten,

Quoted 2 lines · Thorsten Blum

Both Minix and Ext2 filesystems are located at 'start_block + 1'. Update the log messages to report the correct block numbers.

I don't think this change is worthwhile. The offset of the superblock within the filesystem image is an implementation detail.

Quoted 4 lines

Replace printk(KERN_NOTICE) with pr_notice() to avoid checkpatch warnings.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

Nothing is being fixed here.

#2 lore raw
Quoted 9 lines · David Disseldorp

Hi Thorsten,

Quoted 2 lines · Thorsten Blum

Both Minix and Ext2 filesystems are located at 'start_block + 1'. Update the log messages to report the correct block numbers.

I don't think this change is worthwhile. The offset of the superblock within the filesystem image is an implementation detail.

...and even if logging the detail is useful, for ext* the superblock is always at byte offset 1024, no matter which block (0 or 1) that is.

--D

Quoted 7 lines
Quoted 4 lines

Replace printk(KERN_NOTICE) with pr_notice() to avoid checkpatch warnings.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

Nothing is being fixed here.

#3 lore raw
Quoted 5 lines · Darrick J. Wong
Quoted 4 lines · David Disseldorp

Hi Thorsten,

On Sat, 13 Sep 2025 12:39:54 +0200, Thorsten Blum wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Both Minix and Ext2 filesystems are located at 'start_block + 1'. Update the log messages to report the correct block numbers.

I don't think this change is worthwhile. The offset of the superblock within the filesystem image is an implementation detail.

...and even if logging the detail is useful, for ext* the superblock is always at byte offset 1024, no matter which block (0 or 1) that is.

All logs ignore the individual filesystem offsets and only print the starting block. This may not be particularly useful information, but the printed starting blocks for minix/ext2 are off by one compared to the others, which is at least confusing.

Since initrd seems to be on its way out anyway, it's probably not worth changing this.

Thanks,
Thorsten