aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorFinn Thain <fthain@linux-m68k.org>2026-09-04 19:26:36 +1000
committerJens Axboe <axboe@kernel.dk>2026-09-23 05:14:07 -0600
commit22fbea97bc18fd099730572bf9aeba9879d62b02 (patch)
tree439a0893d5a2d1f46c83cc0ea8f53167354036c0 /scripts/Makefile.thinlto
parentswim: Remove pointless mode0 register write (diff)
swim: Don't needlessly re-read sectors
floppy_read_sectors() is confusing because the `track' variable seems to conflate tracks and cylinders. Rename this variable, eliminate a division operation and adopt suitable integer types. For readahead to work effectively, small sequential reads should not require waiting for spindle rotation. Unfortunately, the present algorithm is very inefficient and does a lot of unnecessary waiting. E.g. if the device is asked to read sectors 1 thru 16, and if sector 9 happens to be under the heads, the driver will proceed to read sectors 9 thru 18, but discard the results, while it waits for sector 1 to arrive. If sector 1 couldn't be read on the first attempt and needs a retry, the driver will proceed to read sectors 2 thru 18, but discard the results, while it waits for sector 1 to come around again. In between reading sector 1 and sector 2, the driver needlessly calls swim_track() and swim_head() again. But what's worse is re-enabling interrupts after each sector, because on a 68030 system this can result in a full rotation between sectors (which would be a 200 ms wait). Floppy drivers usually implement a track cache that can be filled in a single rotation to solve such problems. But I think there is a simpler solution. After stepping the heads, use a sector bitmap to record sectors that were successfully read from the present track. Read (or retry, if need be) the requested sectors in whatever sequence they become available. Keep interrupts disabled until the whole track has passed under the read head. swim_read_sector() assumes that it can search a whole track by reading a fixed number of sector headers (essentially, fs->secpertrack) but this assumes no false sector headers are matched in the sector contents. To prevent that, call swim_read_sector_data() unconditionally after any valid sector header is matched. Fixes: 8852ecd97488 ("m68k: mac - Add SWIM floppy support") Signed-off-by: Finn Thain <fthain@linux-m68k.org> Tested-by: Stan Johnson <userm57@yahoo.com> Link: https://patch.msgid.link/dc4c1944edecb6778534b7b5535e6b6dd8d852ae.1788513997.git.fthain@linux-m68k.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions