public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image()
@ 2025-09-13 10:39 Thorsten Blum
  2025-09-15  2:21 ` David Disseldorp
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-09-13 10:39 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara
  Cc: Thorsten Blum, linux-fsdevel, linux-kernel

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")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 init/do_mounts_rd.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index ac021ae6e6fa..9283fdd605f0 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -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;
 	}
-- 
2.51.0


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

* Re: [PATCH] initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image()
  2025-09-13 10:39 [PATCH] initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image() Thorsten Blum
@ 2025-09-15  2:21 ` David Disseldorp
  2025-09-15  4:31   ` Darrick J. Wong
  0 siblings, 1 reply; 4+ messages in thread
From: David Disseldorp @ 2025-09-15  2:21 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Alexander Viro, Christian Brauner, Jan Kara, linux-fsdevel,
	linux-kernel

Hi Thorsten,

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

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

> Replace printk(KERN_NOTICE) with pr_notice() to avoid checkpatch
> warnings.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

Nothing is being fixed here.

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

* Re: [PATCH] initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image()
  2025-09-15  2:21 ` David Disseldorp
@ 2025-09-15  4:31   ` Darrick J. Wong
  2025-09-15 10:30     ` Thorsten Blum
  0 siblings, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2025-09-15  4:31 UTC (permalink / raw)
  To: David Disseldorp
  Cc: Thorsten Blum, Alexander Viro, Christian Brauner, Jan Kara,
	linux-fsdevel, linux-kernel

On Mon, Sep 15, 2025 at 12:21:46PM +1000, David Disseldorp wrote:
> Hi Thorsten,
> 
> On Sat, 13 Sep 2025 12:39:54 +0200, Thorsten Blum wrote:
> 
> > 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

> > Replace printk(KERN_NOTICE) with pr_notice() to avoid checkpatch
> > warnings.
> > 
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> 
> Nothing is being fixed here.
> 

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

* Re: [PATCH] initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image()
  2025-09-15  4:31   ` Darrick J. Wong
@ 2025-09-15 10:30     ` Thorsten Blum
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Blum @ 2025-09-15 10:30 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: David Disseldorp, Alexander Viro, Christian Brauner, Jan Kara,
	linux-fsdevel, linux-kernel

On 15. Sep 2025, at 06:31, Darrick J. Wong wrote:
> On Mon, Sep 15, 2025 at 12:21:46PM +1000, David Disseldorp wrote:
>> Hi Thorsten,
>> 
>> On Sat, 13 Sep 2025 12:39:54 +0200, Thorsten Blum wrote:
>> 
>>> 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


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

end of thread, other threads:[~2025-09-15 10:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13 10:39 [PATCH] initrd: Fix logged Minix/Ext2 block numbers in identify_ramdisk_image() Thorsten Blum
2025-09-15  2:21 ` David Disseldorp
2025-09-15  4:31   ` Darrick J. Wong
2025-09-15 10:30     ` Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox