When doing round-robin reads from a multi-plex volume, only switch to the
next plex if the sector to be read isn't nearby the last read sector. Submitted by: Vsevolod Lobko <seva@ip.net.ua> via ru@ Approved by: grog (mentor)
This commit is contained in:
parent
f639538c20
commit
2c1305420f
@ -275,6 +275,7 @@ struct _plex
|
||||
#ifdef _KERNEL
|
||||
struct rangelock *lock; /* ranges of locked addresses */
|
||||
struct mtx *lockmtx; /* lock mutex, one of plexmutex [] */
|
||||
daddr_t last_addr; /* last address read from this plex */
|
||||
dev_t dev; /* associated device */
|
||||
#endif
|
||||
};
|
||||
|
@ -234,10 +234,18 @@ vinumstart(struct buf *bp, int reviveok)
|
||||
if (vol != NULL) {
|
||||
plexno = vol->preferred_plex; /* get the plex to use */
|
||||
if (plexno < 0) { /* round robin */
|
||||
plexno = vol->last_plex_read;
|
||||
vol->last_plex_read++;
|
||||
if (vol->last_plex_read >= vol->plexes) /* got the the end? */
|
||||
vol->last_plex_read = 0; /* wrap around */
|
||||
for (plexno = 0; plexno < vol->plexes; plexno++)
|
||||
if (abs(bp->b_blkno - PLEX[vol->plex[plexno]].last_addr) <= ROUNDROBIN_SWITCH)
|
||||
break;
|
||||
if (plexno >= vol->plexes) {
|
||||
vol->last_plex_read++;
|
||||
if (vol->last_plex_read >= vol->plexes)
|
||||
vol->last_plex_read = 0;
|
||||
plexno = vol->last_plex_read;
|
||||
} else {
|
||||
vol->last_plex_read = plexno;
|
||||
};
|
||||
PLEX[vol->plex[plexno]].last_addr = bp->b_blkno;
|
||||
}
|
||||
status = build_read_request(rq, plexno); /* build a request */
|
||||
} else {
|
||||
|
@ -361,6 +361,13 @@ enum parityop {
|
||||
rebuildandcheckparity, /* rebuildparity with the -v option */
|
||||
};
|
||||
|
||||
/*
|
||||
* When doing round-robin reads from a multi-plex volume, switch to the
|
||||
* next plex if the difference of the last read sector and the next sector
|
||||
* to be read is this many sectors.
|
||||
*/
|
||||
#define ROUNDROBIN_SWITCH 128 /* 64k */
|
||||
|
||||
#ifdef VINUMDEBUG
|
||||
/* Debugging stuff */
|
||||
enum debugflags {
|
||||
|
Loading…
Reference in New Issue
Block a user