All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix floppy for PAGE_SIZE != 4KB
@ 2025-11-14 13:41 Rene Rebe
  2025-11-14 16:11 ` Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Rene Rebe @ 2025-11-14 13:41 UTC (permalink / raw)
  To: linux-block; +Cc: Denis Efremov

For years I wondered why the floppy driver does not just work on
sparc64, e.g:

root@SUNW_375_0066:# disktype /dev/fd0
--- /dev/fd0
disktype: Can't open /dev/fd0: No such device or address

[  525.341906] disktype: attempt to access beyond end of device
               fd0: rw=0, sector=0, nr_sectors = 16 limit=8
[  525.341991] floppy: error 10 while reading block 0

Turns out floppy.c __floppy_read_block_0 tries to read one page for
the first test read to determine the disk size and thus fails if that
is greater than 4k. Adjust minimum MAX_DISK_SIZE to PAGE_SIZE to fix
floppy on sparc64 and likely all other PAGE_SIZE != 4KB configs.

Signed-off-by: René Rebe <rene@exactco.de>

--- linux-6.16/drivers/block/floppy.c.vanilla	2025-09-07 11:16:02.420895667 +0200
+++ linux-6.16/drivers/block/floppy.c	2025-09-07 11:17:17.538595643 +0200
@@ -331,7 +331,7 @@
  * This default is used whenever the current disk size is unknown.
  * [Now it is rather a minimum]
  */
-#define MAX_DISK_SIZE 4		/* 3984 */
+#define MAX_DISK_SIZE (PAGE_SIZE / 1024)
 
 /*
  * globals used by 'result()'

-- 
  René Rebe, ExactCODE GmbH, Lietzenburger Str. 42, DE-10789 Berlin
  https://exactcode.com | https://t2sde.org | https://rene.rebe.de

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

end of thread, other threads:[~2025-11-22 10:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14 13:41 [PATCH] fix floppy for PAGE_SIZE != 4KB Rene Rebe
2025-11-14 16:11 ` Jens Axboe
2025-11-14 16:25   ` René Rebe
2025-11-14 17:39     ` Jens Axboe
2025-11-14 18:21       ` René Rebe
2025-11-17  9:56         ` René Rebe
2025-11-17 13:23           ` Jens Axboe
2025-11-17 13:57             ` René Rebe
2025-11-17 15:23               ` Jens Axboe
2025-11-19  9:00             ` John Paul Adrian Glaubitz
2025-11-19  9:12               ` René Rebe
2025-11-19  9:22                 ` John Paul Adrian Glaubitz
2025-11-19  9:24                   ` René Rebe
2025-11-19  9:39                     ` John Paul Adrian Glaubitz
2025-11-19 15:00                       ` Jens Axboe
2025-11-19  8:58   ` John Paul Adrian Glaubitz
2025-11-17 15:23 ` Jens Axboe
2025-11-22 10:28 ` Gregor Riepl

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.