From: Ben Gras Date: Wed, 21 Sep 2011 18:48:48 +0000 (+0000) Subject: mfs: ditch global readahead X-Git-Tag: v3.2.0~273 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mult.png?a=commitdiff_plain;h=c83a90e2f189b4a28517d51d5e4cbe8024383bc2;p=minix.git mfs: ditch global readahead --- diff --git a/servers/mfs/main.c b/servers/mfs/main.c index d0b3408f7..96b9c5afe 100644 --- a/servers/mfs/main.c +++ b/servers/mfs/main.c @@ -77,10 +77,6 @@ PUBLIC int main(int argc, char *argv[]) fs_m_out.m_type = TRNS_ADD_ID(fs_m_out.m_type, transid); } reply(src, &fs_m_out); - - if (error == OK) - read_ahead(); /* do block read ahead */ - } return(OK); diff --git a/servers/mfs/read.c b/servers/mfs/read.c index abf0af653..27cdd9e91 100644 --- a/servers/mfs/read.c +++ b/servers/mfs/read.c @@ -12,7 +12,7 @@ FORWARD _PROTOTYPE( struct buf *rahead, (struct inode *rip, block_t baseblock, - u64_t position, unsigned bytes_ahead) ); + u64_t position, unsigned bytes_ahead) ); FORWARD _PROTOTYPE( int rw_chunk, (struct inode *rip, u64_t position, unsigned off, size_t chunk, unsigned left, int rw_flag, cp_grant_id_t gid, unsigned buf_off, unsigned int block_size, @@ -20,9 +20,6 @@ FORWARD _PROTOTYPE( int rw_chunk, (struct inode *rip, u64_t position, PRIVATE char getdents_buf[GETDENTS_BUFSIZ]; -PRIVATE off_t rdahedpos; /* position to read ahead */ -PRIVATE struct inode *rdahed_inode; /* pointer to inode to read ahead */ - /*===========================================================================* * fs_readwrite * *===========================================================================*/ @@ -112,14 +109,6 @@ PUBLIC int fs_readwrite(void) } } - /* Check to see if read-ahead is called for, and if so, set it up. */ - if(rw_flag == READING && rip->i_seek == NO_SEEK && - (unsigned int) position % block_size == 0 && - (regular || mode_word == I_DIRECTORY)) { - rdahed_inode = rip; - rdahedpos = position; - } - rip->i_seek = NO_SEEK; if (rdwt_err != OK) r = rdwt_err; /* check for disk error */ @@ -392,33 +381,6 @@ int index; /* index into *bp */ return(zone); } - -/*===========================================================================* - * read_ahead * - *===========================================================================*/ -PUBLIC void read_ahead() -{ -/* Read a block into the cache before it is needed. */ - unsigned int block_size; - register struct inode *rip; - struct buf *bp; - block_t b; - - if(!rdahed_inode) - return; - - rip = rdahed_inode; /* pointer to inode to read ahead from */ - block_size = get_block_size(rip->i_dev); - rdahed_inode = NULL; /* turn off read ahead */ - if ( (b = read_map(rip, rdahedpos)) == NO_BLOCK) return; /* at EOF */ - - assert(rdahedpos >= 0); /* So we can safely cast it to unsigned below */ - - bp = rahead(rip, b, cvul64( (unsigned long) rdahedpos), block_size); - put_block(bp, PARTIAL_DATA_BLOCK); -} - - /*===========================================================================* * rahead * *===========================================================================*/