diff options
| author | Greg Lehey <grog@FreeBSD.org> | 1999-04-10 08:08:45 +0000 |
|---|---|---|
| committer | Greg Lehey <grog@FreeBSD.org> | 1999-04-10 08:08:45 +0000 |
| commit | ec3a7296927f08056f1f3e47e2643efd84c1fb62 (patch) | |
| tree | f24e0c010ebaee7f8ffba5f611507a40664a5101 /sys/dev/vinum | |
| parent | 42d21b86b22a33f0130dd55d53fb019ca543c890 (diff) | |
Notes
Diffstat (limited to 'sys/dev/vinum')
| -rw-r--r-- | sys/dev/vinum/vinumconfig.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c index 67cd1c64b5ec..3668dad9ac4f 100644 --- a/sys/dev/vinum/vinumconfig.c +++ b/sys/dev/vinum/vinumconfig.c @@ -590,7 +590,7 @@ void free_drive(struct drive *drive) { if (drive->state > drive_referenced) { /* real drive */ - lockdrive(drive); + LOCKDRIVE(drive); if (drive->vp != NULL) /* device open */ vn_close(drive->vp, FREAD | FWRITE, FSCRED, drive->p); if (drive->freelist) @@ -1827,20 +1827,25 @@ update_plex_config(int plexno, int diskconfig) * of each subdisk and return it to the drive. */ if (plex->length > 0) { - remainder = (int) (plex->length % ((u_int64_t) plex->stripesize * data_sds)); /* are we exact? */ - if (remainder) { /* no */ - log(LOG_INFO, "vinum: removing %d blocks of partial stripe at the end of %s\n", - remainder, - plex->name); - plex->length -= remainder; /* shorten the plex */ - remainder /= data_sds; /* spread the remainder amongst the sds */ - for (sdno = 0; sdno < plex->subdisks; sdno++) { - sd = &SD[plex->sdnos[sdno]]; /* point to the subdisk */ - return_drive_space(sd->driveno, /* return the space */ - sd->driveoffset + sd->sectors - remainder, - remainder); - sd->sectors -= remainder; /* and shorten it */ - } + if (data_sds > 0) { + if (plex->stripesize > 0) { + remainder = (int) (plex->length % ((u_int64_t) plex->stripesize * data_sds)); /* are we exact? */ + if (remainder) { /* no */ + log(LOG_INFO, "vinum: removing %d blocks of partial stripe at the end of %s\n", + remainder, + plex->name); + plex->length -= remainder; /* shorten the plex */ + remainder /= data_sds; /* spread the remainder amongst the sds */ + for (sdno = 0; sdno < plex->subdisks; sdno++) { + sd = &SD[plex->sdnos[sdno]]; /* point to the subdisk */ + return_drive_space(sd->driveno, /* return the space */ + sd->driveoffset + sd->sectors - remainder, + remainder); + sd->sectors -= remainder; /* and shorten it */ + } + } + } else /* no data sds, */ + plex->length = 0; /* reset length */ } } } |
