Page 1 of 1
Buffer size
Posted: Sun Feb 25, 2007 2:50 pm
by frank
I have recently been reevaluating my filesystem and disk drive interface. Right now my buffer sizes are as follows
Hard Disks: 128kb
Floppy Disks: ~90kb
I was just wondering if these sound a little small or a little big, by the way these numbers are per drive. Also what is a good size for the buffers for the filesystems.
Posted: Sun Feb 25, 2007 3:21 pm
by Combuster
buffer size depends on the filesystem as well: IIRC systems like XFS tends to use far larger buffers than FAT (due to scheduling). Also, you can use unused memory as disk cache: i.e. increase the buffer size when lots of memory is available, and decrease it when memory becomes scarce.
</theoretical rambling>
Posted: Sun Feb 25, 2007 11:11 pm
by Solar
Is that in-kernel buffering, or user-space buffering?
The latter can be controlled from user-space using setvbuf(), with the default size being defined as BUFSIZ. Both declared in <stdio.h>. Here (x86 Linux), BUFSIZ is 8k.
Posted: Mon Feb 26, 2007 10:17 am
by frank
No thats for the in-kernel buffers for the disk drives. I was just wondering if that size sounds ok.
Posted: Tue Feb 27, 2007 9:02 pm
by bewing
The DMA buffer for a floppy drive maxes out at one page (=64K). However, the floppy can really only transfer one cylinder at a time (= 18 sectors = 9k). Two 9K buffers = 18K ought to cover any possible floppy transfer.
For a hard disk, I think 128K to 1M for the total buffer space sounds fine. Memory is precious, but the data comes off a drive pretty fast, and your kernel really can't service it all THAT often.
Posted: Wed Feb 28, 2007 10:54 am
by frank
bewing wrote:The DMA buffer for a floppy drive maxes out at one page (=64K). However, the floppy can really only transfer one cylinder at a time (= 18 sectors = 9k). Two 9K buffers = 18K ought to cover any possible floppy transfer.
For a hard disk, I think 128K to 1M for the total buffer space sounds fine. Memory is precious, but the data comes off a drive pretty fast, and your kernel really can't service it all THAT often.
Ok, then I guess my next question is, how do I make the hard drive and floppy drive accesses faster? I already use DMA on the floppy drive and I haven't messed with any thing on the hard drive(other than reseting it).
Posted: Sun Mar 04, 2007 3:09 am
by bewing
DMA on a floppy is as fast as it gets. Floppies are dead slow devices -- that's why we all hate them.
For standard P-ATA disk drives, your speed improvement steps are going to be UDMA and then ADMA -- both used only with multitasking. But ADMA is only supported on ATA-6 drives, I think.