mfs: ditch global readahead

This commit is contained in:
Ben Gras 2011-09-21 18:48:48 +00:00
parent 47aad344c3
commit c83a90e2f1
2 changed files with 1 additions and 43 deletions

View file

@ -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);

View file

@ -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 *
*===========================================================================*/