diff options
| -rw-r--r-- | sys/dev/vinum/vinumconfig.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c index 7fc6520bd860..67cd1c64b5ec 100644 --- a/sys/dev/vinum/vinumconfig.c +++ b/sys/dev/vinum/vinumconfig.c @@ -1826,19 +1826,21 @@ update_plex_config(int plexno, int diskconfig) * the stripe size. If not, trim off the end * of each subdisk and return it to the drive. */ - 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 (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 */ + } } } } |
