Re: tuning for large files in xfs

From: fitzboy
Date: Mon May 22 2006 - 20:43:36 EST

> What's your testing methodology?

here is my code... pretty simple, opens the file and reads around to a random block, 32k worth (note, doing a 2k read doesn't make much of a difference, only marginal, from 6.7ms per seek down to 6.1).

int main (int argc, char* argv[]) {
char buffer[256*1024];
int fd = open(argv[1],O_RDONLY);
struct stat s;
long long currentPos;
int currentSize=32*1024;
int startTime=getTimeMS();
for (int currentRead = 0;currentRead<10000;currentRead++) {
if (pread(fd,buffer,currentSize,currentPos) != currentSize)
std::cout<<"couldn't read in"<<std::endl;
std::cout << "blocksize of "<<currentSize<<"took"<<getTimeMS()-startTime<<" ms"<<std::endl;

> You can try to measure the amount of seeks going to the disk by using
> iostat, and see if that matches your test program.

I used iostat and found exactly what I was expecting: 10,000 rounds x 16 (number of 2k blocks in a 32k read) x 4 (number of 512 blocks per 2k block) = 640,000 reads, which is what iostat told me. so now my question remains, if each seek is supposed to average 3.5ms, how come I am seeing an average of 6-7ms?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at