lkml.org 
[lkml]   [1999]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectfs/etx2/file.c question from postgres developers...
Date
hi...

in response to a performance issue with disk i/o when using the postgresql
database (maintained and developed mostly by bsd users, though used by many
linux users) the following has come up...

(i'm not on the kernel list, so could all replies be cc'd to me directly? mucho
thanks!)

____________________________________

> Next question is what to do about it. I don't suppose we have any way
> of turning off the OS' read-ahead algorithm :-(. We could forget about
> this space-recycling improvement and go back to separate temp files.
> The objection to that, of course, is that while sorting might be faster,
> it doesn't matter how fast the algorithm is if you don't have the disk
> space to execute it.


Look what I found. I downloaded Linux kernel source for 2.2.0, and
started looking for the word 'ahead' in the file system files. I found
that read-ahead seems to be controlled by f_reada, and look where I
found it being turned off? Seems like any seek turns off read-ahead on
Linux.

When you do a read or write, it seems to be turned on again. Once you
read/write, the next read/write will do read-ahead, assuming you don't
do any lseek() before the second read/write().

Seems like the algorithm in psort now is rarely having read-ahead on
Linux, while other OS's check to see if the read-ahead was eventually
used, and control read-ahead that way.

read-head also seems be off on the first read from a file.

---------------------------------------------------------------------------

/*
* linux/fs/ext2/file.c
...
//*
* Make sure the offset never goes beyond the 32-bit mark..
*/
static long long ext2_file_lseek(
struct file *file,
long long offset,
int origin)
{
struct inode *inode = file->f_dentry->d_inode;

switch (origin) {
case 2:
offset += inode->i_size;
break;
case 1:
offset += file->f_pos;
}
if (((unsigned long long) offset >> 32) != 0) {
#if BITS_PER_LONG < 64
return -EINVAL;
#else
if (offset > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)])
return -EINVAL;
#endif
}
if (offset != file->f_pos) {
file->f_pos = offset;
file->f_reada = 0;
file->f_version = ++event;
}
return offset;
}

----------------------------

--
Aaron J. Seigo
Sys Admin

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.174 / U:1.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site