If we have a choice: do not trust the parity disk for read

balancing in a RAID 1 set if we know that the parity might not
be up-to-date.  Thanks to Thor for bringing this to my attention.
This commit is contained in:
oster 1999-11-09 03:07:20 +00:00
parent e1e554ac35
commit 3949e74f78
1 changed files with 16 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_dagutils.c,v 1.4 1999/08/13 03:41:53 oster Exp $ */ /* $NetBSD: rf_dagutils.c,v 1.5 1999/11/09 03:07:20 oster Exp $ */
/* /*
* Copyright (c) 1995 Carnegie-Mellon University. * Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved. * All rights reserved.
@ -1212,21 +1212,25 @@ rf_SelectMirrorDiskIdle(RF_DagNode_t * node)
if (RF_DEAD_DISK(disks[rowData][colData].status)) { if (RF_DEAD_DISK(disks[rowData][colData].status)) {
usemirror = 1; usemirror = 1;
} else } else
if (dataQueueLength < mirrorQueueLength) { if (raidPtr->parity_good == RF_RAID_DIRTY) {
/* Trust only the main disk */
usemirror = 0; usemirror = 0;
} else } else
if (mirrorQueueLength < dataQueueLength) { if (dataQueueLength < mirrorQueueLength) {
usemirror = 1; usemirror = 0;
} else { } else
/* queues are equal length. attempt if (mirrorQueueLength < dataQueueLength) {
* cleverness. */
if (SNUM_DIFF(dataQueue->last_deq_sector, data_pda->startSector)
<= SNUM_DIFF(mirrorQueue->last_deq_sector, mirror_pda->startSector)) {
usemirror = 0;
} else {
usemirror = 1; usemirror = 1;
} else {
/* queues are equal length. attempt
* cleverness. */
if (SNUM_DIFF(dataQueue->last_deq_sector, data_pda->startSector)
<= SNUM_DIFF(mirrorQueue->last_deq_sector, mirror_pda->startSector)) {
usemirror = 0;
} else {
usemirror = 1;
}
} }
}
if (usemirror) { if (usemirror) {
/* use mirror (parity) disk, swap params 0 & 4 */ /* use mirror (parity) disk, swap params 0 & 4 */