Re: [Patch] Cleanup struct gendisk registration, 2.3.40-pre1

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sun Jan 16 2000 - 22:28:56 EST


On Mon, 17 Jan 2000, Andrea Arcangeli wrote:
>
> The only point of delaying flushes to disk is to merge two writes into one
> single flush. This applyes even more strongly to floppies that are very
> slow to write data. The slower the disk is, the more delay you want to
> have between the flushes.

Definitely not.

The slower the disk is, the MORE EFFICIENT you want to be at writing
things out.

And doing it in bursts may be efficient, but also it can be the WORST way
to do it. Especially with something like a floppy that needs to spin up
the platter etc.

With any device, but _especially_ with slow devices that don't get
appreciably faster by having multi-megabyte writes done to them, the most
efficient way of writing things out is to do it _early_. Instead of
waiting for your buffers to fill up.

> It's not catastrophic for linux (or it's an implementation bug that has to
> be fixed and not a design one as far I can tell) but you'll find your fd
> corrupted when you'll read it from another computer, and that's expected.

"Expected" is not the same as "that's how it should work".

Especially with floppies, we do have a good way of telling people that
it's busy and being written to: the light is on and the floppy is running.
We should be better at being polite, and just try to do a better job at
not leaving things in memory unnecessarily.

Note that nobody writes to a floppy if they don't have to. With a
harddisk, you often end up having temp-files etc, and it may be
advantageous to delay the write even for a long time, in the hope that the
file will be removed and the write doesn't have to be done at all.

When was the last time you had your floppy as a /tmp directory?

So the slower and "more removable" a device is, the more reason you have
to start the flush early - the faster you start, the faster it will be
over, and the nicer the behaviour will be from a removability point of
view.

It's not about getting rid of write-behind - it's about being better at
avoiding not using the bad bandwidth you have in the first place.

Waiting won't make the floppy faster.

(in contrast, waiting _can_ and _will_ make "real" disk accesses faster:
unlike floppies, real disks are often used in a much more random-access
way, with multiple open files etc, and they are much better at taking
advantage of large writes. Floppy accesses tend to be "save this file as
a backup or for moving to another machine". Very different.)

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:14 EST