Re: __commit_write() with the Page Cache

From: Linus Torvalds (torvalds@transmeta.com)
Date: Thu May 11 2000 - 19:17:04 EST


On Thu, 11 May 2000, Jeff V. Merkey wrote:
>
> And one more thing. I have grabbed Steve Dodd's NTFS code, and I am
> implementing a fully featured NTFS implementation on Linux. I've got
> some bad news for you here, without the ability to post variable length
> asynch IO requests, as are supported in Windows 2000, performance of
> Linux NTFS vs. Native Windows 2000 NTFS will SUCK WIND and perform
> poorly. Their entire AIO architecture is built on the concept of "file
> runs" of variable lengths for R/W IO, and most of the performance tricks
> in native NTFS are heavily dependent on this capability.

Note that what you can always do is actually very simple:
 - _always_ use a sector size of 512 bytes.
 - allocate 8 sectors per 4kB page
 - fill in the sector numbers appropriately: if you have a 2kB "run", then
   you just fill in sector numbers X, X+1, X+2 and X+3 on the four buffer
   heads in question.
 - the ll_rw_block logic will all coalesce the writes back again, so the
   IO should still be done in 2kB blocks. But you'd have the option of
   just writing 512 bytes of them if you wanted to.

Note that the 512-byte sector is basically forced upon us by hardware.
There's nothing we can do about that in software, so the above should be
able to handle all cases that hardware can do for us reasonably.

(And yes, it _will_ use slightly more CPU time, no question about that.
However, most of the common operations are done on pages rather than on
the buffers that are used to fill in the pages or write them back, so many
of the higher-level IO abstractions won't even know the difference).

You can do funky stuff like changing the sector numbers etc on the fly
too, without the upper layers caring. Of course, you'd better do this when
you own the buffer head lock, because otherwise it might be in the middle
of a write-out or something like that, and you sure as h*ll don't want to
confuse the device drivers with changing the sector number from underneath
them ;)

                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 : Mon May 15 2000 - 21:00:19 EST