From Bruce Evans: Ignore the read-ahead cache if the device changes.

This commit is contained in:
mycroft 1994-02-20 14:05:19 +00:00
parent 64b3a3e372
commit 3b3ce2d3c6
1 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@
* any improvements or extensions that they make and grant Carnegie Mellon * any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes. * the rights to redistribute these changes.
* *
* $Id: disk.c,v 1.5 1994/02/03 23:21:25 mycroft Exp $ * $Id: disk.c,v 1.6 1994/02/20 14:05:19 mycroft Exp $
*/ */
#include "boot.h" #include "boot.h"
@ -158,13 +158,14 @@ devread()
*/ */
#define RA_SECTORS 18 #define RA_SECTORS 18
static char ra_buf[RA_SECTORS * BPS]; static char ra_buf[RA_SECTORS * BPS];
static int ra_dev;
static int ra_end; static int ra_end;
static int ra_first; static int ra_first;
Bread(dosdev, sector) Bread(dosdev, sector)
int dosdev, sector; int dosdev, sector;
{ {
if (sector < ra_first || sector >= ra_end) { if (dosdev != ra_dev || sector < ra_first || sector >= ra_end) {
int cyl, head, sec, nsec; int cyl, head, sec, nsec;
cyl = sector/spc; cyl = sector/spc;
@ -182,6 +183,7 @@ Bread(dosdev, sector)
twiddle(); twiddle();
} }
} }
ra_dev = dosdev;
ra_first = sector; ra_first = sector;
ra_end = sector + nsec; ra_end = sector + nsec;
} }