mfs: minor cleanup of readahead: they can be private to read.c.

This commit is contained in:
Ben Gras 2010-06-21 18:25:04 +00:00
parent e2730c3e2f
commit a89bcc465b
3 changed files with 9 additions and 6 deletions

View file

@ -9,9 +9,6 @@
#include <minix/vfsif.h>
EXTERN off_t rdahedpos; /* position to read ahead */
EXTERN struct inode *rdahed_inode; /* pointer to inode to read ahead */
/* The following variables are used for returning results to the caller. */
EXTERN int err_code; /* temporary storage for error number */
EXTERN int rdwt_err; /* status of last disk i/o request */

View file

@ -67,7 +67,7 @@ PUBLIC int main(int argc, char *argv[])
fs_m_out.m_type = error;
reply(src, &fs_m_out);
if (error == OK && rdahed_inode != NULL)
if (error == OK)
read_ahead(); /* do block read ahead */
}

View file

@ -20,6 +20,9 @@ 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 *
*===========================================================================*/
@ -61,7 +64,7 @@ PUBLIC int fs_readwrite(void)
nrbytes = (size_t) fs_m_in.REQ_NBYTES;
rdwt_err = OK; /* set to EIO if disk error occurs */
if (rw_flag == WRITING && !block_spec) {
/* Check in advance to see if file will grow too big. */
if (position > (off_t) (rip->i_sp->s_max_size - nrbytes))
@ -115,7 +118,7 @@ PUBLIC int fs_readwrite(void)
(regular || mode_word == I_DIRECTORY)) {
rdahed_inode = rip;
rdahedpos = position;
}
}
rip->i_seek = NO_SEEK;
@ -401,6 +404,9 @@ PUBLIC void read_ahead()
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 */