From: Ben Gras Date: Mon, 21 Jun 2010 18:25:04 +0000 (+0000) Subject: mfs: minor cleanup of readahead: they can be private to read.c. X-Git-Tag: v3.1.8~422 X-Git-Url: http://zhaoyanbai.com/repos/nsupdate.html?a=commitdiff_plain;h=a89bcc465bb9d093ca0b05a5bd034017dd6b25ad;p=minix.git mfs: minor cleanup of readahead: they can be private to read.c. --- diff --git a/servers/mfs/glo.h b/servers/mfs/glo.h index 24f281b35..1cfb0355f 100644 --- a/servers/mfs/glo.h +++ b/servers/mfs/glo.h @@ -9,9 +9,6 @@ #include -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 */ diff --git a/servers/mfs/main.c b/servers/mfs/main.c index 1f8435679..61ed8dc7f 100644 --- a/servers/mfs/main.c +++ b/servers/mfs/main.c @@ -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 */ } diff --git a/servers/mfs/read.c b/servers/mfs/read.c index 900502f2a..56b129c1e 100644 --- a/servers/mfs/read.c +++ b/servers/mfs/read.c @@ -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 */