diff options
author | des <des@FreeBSD.org> | 2000-11-17 23:40:01 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-11-17 23:40:01 +0000 |
commit | 2c31bf9c128647650272666d64d18fea7da337de (patch) | |
tree | 660c09f21829cb601f60af4b8625e0d97ccde7c8 /sys/dev/vinum | |
parent | 3c3947a8d5e631437effb137a6132424a87c6438 (diff) | |
download | FreeBSD-src-2c31bf9c128647650272666d64d18fea7da337de.zip FreeBSD-src-2c31bf9c128647650272666d64d18fea7da337de.tar.gz |
Make sure we don't cross stripe boundaries when reviving striped plexes.
This makes crash recovery work for stripe sizes that are not multiples of
DEFAULT_REVIVE_BLOCKSIZE (currently 64 kB).
While we're here, fix a few cosmetic nits.
Reviewed by: grog
Sponsored by: Enitel ASA (http://www.enitel.no/)
Diffstat (limited to 'sys/dev/vinum')
-rw-r--r-- | sys/dev/vinum/vinumrevive.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/vinum/vinumrevive.c b/sys/dev/vinum/vinumrevive.c index f02c5e8..8132b27 100644 --- a/sys/dev/vinum/vinumrevive.c +++ b/sys/dev/vinum/vinumrevive.c @@ -101,9 +101,11 @@ revive_block(int sdno) case plex_striped: stripeoffset = sd->revived % plex->stripesize; /* offset from beginning of stripe */ + if (stripeoffset + (size >> DEV_BSHIFT) > plex->stripesize) + size = (plex->stripesize - stripeoffset) << DEV_BSHIFT; plexblkno = sd->plexoffset /* base */ + (sd->revived - stripeoffset) * plex->subdisks /* offset to beginning of stripe */ - + sd->revived % plex->stripesize; /* offset from beginning of stripe */ + + stripeoffset; /* offset from beginning of stripe */ break; case plex_raid4: @@ -111,7 +113,7 @@ revive_block(int sdno) stripeoffset = sd->revived % plex->stripesize; /* offset from beginning of stripe */ plexblkno = sd->plexoffset /* base */ + (sd->revived - stripeoffset) * (plex->subdisks - 1) /* offset to beginning of stripe */ - +stripeoffset; /* offset from beginning of stripe */ + + stripeoffset; /* offset from beginning of stripe */ stripe = (sd->revived / plex->stripesize); /* stripe number */ /* Make sure we don't go beyond the end of the band. */ @@ -157,8 +159,8 @@ revive_block(int sdno) lock = lockrange(plexblkno << DEV_BSHIFT, bp, plex); /* lock it */ if (vol != NULL) /* it's part of a volume, */ /* - * First, read the data from the volume. We - * don't care which plex, that's bre's job. + * First, read the data from the volume. We + * don't care which plex, that's bre's job. */ bp->b_dev = VINUMDEV(plex->volno, 0, 0, VINUM_VOLUME_TYPE); /* create the device number */ else /* it's an unattached plex */ |