version 1.312.2.5, 2017/07/14 15:39:32 |
version 1.313, 2014/10/11 12:01:27 |
Line 251 struct raid_softc { |
|
Line 251 struct raid_softc { |
|
#define RAIDF_SHUTDOWN 0x08 /* unit is being shutdown */ |
#define RAIDF_SHUTDOWN 0x08 /* unit is being shutdown */ |
#define RAIDF_WANTED 0x40 /* someone is waiting to obtain a lock */ |
#define RAIDF_WANTED 0x40 /* someone is waiting to obtain a lock */ |
#define RAIDF_LOCKED 0x80 /* unit is locked */ |
#define RAIDF_LOCKED 0x80 /* unit is locked */ |
#define RAIDF_UNIT_CHANGED 0x100 /* unit is being changed */ |
|
|
|
#define raidunit(x) DISKUNIT(x) |
#define raidunit(x) DISKUNIT(x) |
|
|
Line 801 raidopen(dev_t dev, int flags, int fmt, |
|
Line 800 raidopen(dev_t dev, int flags, int fmt, |
|
pmask = (1 << part); |
pmask = (1 << part); |
|
|
if ((rs->sc_flags & RAIDF_INITED) && |
if ((rs->sc_flags & RAIDF_INITED) && |
(rs->sc_dkdev.dk_nwedges == 0) && |
|
(rs->sc_dkdev.dk_openmask == 0)) |
(rs->sc_dkdev.dk_openmask == 0)) |
raidgetdisklabel(dev); |
raidgetdisklabel(dev); |
|
|
Line 1092 raidioctl(dev_t dev, u_long cmd, void *d |
|
Line 1090 raidioctl(dev_t dev, u_long cmd, void *d |
|
case DIOCWLABEL: |
case DIOCWLABEL: |
case DIOCAWEDGE: |
case DIOCAWEDGE: |
case DIOCDWEDGE: |
case DIOCDWEDGE: |
case DIOCMWEDGES: |
|
case DIOCSSTRATEGY: |
case DIOCSSTRATEGY: |
if ((flag & FWRITE) == 0) |
if ((flag & FWRITE) == 0) |
return (EBADF); |
return (EBADF); |
Line 1115 raidioctl(dev_t dev, u_long cmd, void *d |
|
Line 1112 raidioctl(dev_t dev, u_long cmd, void *d |
|
case DIOCAWEDGE: |
case DIOCAWEDGE: |
case DIOCDWEDGE: |
case DIOCDWEDGE: |
case DIOCLWEDGES: |
case DIOCLWEDGES: |
case DIOCMWEDGES: |
|
case DIOCCACHESYNC: |
case DIOCCACHESYNC: |
case RAIDFRAME_SHUTDOWN: |
case RAIDFRAME_SHUTDOWN: |
case RAIDFRAME_REWRITEPARITY: |
case RAIDFRAME_REWRITEPARITY: |
Line 1534 raidioctl(dev_t dev, u_long cmd, void *d |
|
Line 1530 raidioctl(dev_t dev, u_long cmd, void *d |
|
} |
} |
for (j = d_cfg->cols, i = 0; i < d_cfg->nspares; i++, j++) { |
for (j = d_cfg->cols, i = 0; i < d_cfg->nspares; i++, j++) { |
d_cfg->spares[i] = raidPtr->Disks[j]; |
d_cfg->spares[i] = raidPtr->Disks[j]; |
if (d_cfg->spares[i].status == rf_ds_rebuilding_spare) { |
|
/* XXX: raidctl(8) expects to see this as a used spare */ |
|
d_cfg->spares[i].status = rf_ds_used_spare; |
|
} |
|
} |
} |
retcode = copyout(d_cfg, *ucfgp, sizeof(RF_DeviceConfig_t)); |
retcode = copyout(d_cfg, *ucfgp, sizeof(RF_DeviceConfig_t)); |
RF_Free(d_cfg, sizeof(RF_DeviceConfig_t)); |
RF_Free(d_cfg, sizeof(RF_DeviceConfig_t)); |
Line 1762 raidioctl(dev_t dev, u_long cmd, void *d |
|
Line 1754 raidioctl(dev_t dev, u_long cmd, void *d |
|
sizeof(RF_ProgressInfo_t)); |
sizeof(RF_ProgressInfo_t)); |
return (retcode); |
return (retcode); |
|
|
case RAIDFRAME_SET_LAST_UNIT: |
|
for (column = 0; column < raidPtr->numCol; column++) |
|
if (raidPtr->Disks[column].status != rf_ds_optimal) |
|
return EBUSY; |
|
|
|
for (column = 0; column < raidPtr->numCol; column++) { |
|
clabel = raidget_component_label(raidPtr, column); |
|
clabel->last_unit = *(int *)data; |
|
raidflush_component_label(raidPtr, column); |
|
} |
|
rs->sc_cflags |= RAIDF_UNIT_CHANGED; |
|
return 0; |
|
|
|
/* the sparetable daemon calls this to wait for the kernel to |
/* the sparetable daemon calls this to wait for the kernel to |
* need a spare table. this ioctl does not return until a |
* need a spare table. this ioctl does not return until a |
* spare table is needed. XXX -- calling mpsleep here in the |
* spare table is needed. XXX -- calling mpsleep here in the |
Line 1938 raidioctl(dev_t dev, u_long cmd, void *d |
|
Line 1917 raidioctl(dev_t dev, u_long cmd, void *d |
|
case DIOCLWEDGES: |
case DIOCLWEDGES: |
return dkwedge_list(&rs->sc_dkdev, |
return dkwedge_list(&rs->sc_dkdev, |
(struct dkwedge_list *)data, l); |
(struct dkwedge_list *)data, l); |
case DIOCMWEDGES: |
|
dkwedge_discover(&rs->sc_dkdev); |
|
return 0; |
|
case DIOCCACHESYNC: |
case DIOCCACHESYNC: |
return rf_sync_component_caches(raidPtr); |
return rf_sync_component_caches(raidPtr); |
|
|
Line 2464 raidgetdisklabel(dev_t dev) |
|
Line 2440 raidgetdisklabel(dev_t dev) |
|
* same components are used, and old disklabel may used |
* same components are used, and old disklabel may used |
* if that is found. |
* if that is found. |
*/ |
*/ |
if (lp->d_secperunit < UINT32_MAX ? |
if (lp->d_secperunit != rs->sc_size) |
lp->d_secperunit != rs->sc_size : |
|
lp->d_secperunit > rs->sc_size) |
|
printf("raid%d: WARNING: %s: " |
printf("raid%d: WARNING: %s: " |
"total sector size in disklabel (%ju) != " |
"total sector size in disklabel (%" PRIu32 ") != " |
"the size of raid (%ju)\n", unit, rs->sc_xname, |
"the size of raid (%" PRIu64 ")\n", unit, rs->sc_xname, |
(uintmax_t)lp->d_secperunit, |
lp->d_secperunit, rs->sc_size); |
(uintmax_t)rs->sc_size); |
|
for (i = 0; i < lp->d_npartitions; i++) { |
for (i = 0; i < lp->d_npartitions; i++) { |
pp = &lp->d_partitions[i]; |
pp = &lp->d_partitions[i]; |
if (pp->p_offset + pp->p_size > rs->sc_size) |
if (pp->p_offset + pp->p_size > rs->sc_size) |
printf("raid%d: WARNING: %s: end of partition `%c' " |
printf("raid%d: WARNING: %s: end of partition `%c' " |
"exceeds the size of raid (%ju)\n", |
"exceeds the size of raid (%" PRIu64 ")\n", |
unit, rs->sc_xname, 'a' + i, |
unit, rs->sc_xname, 'a' + i, rs->sc_size); |
(uintmax_t)rs->sc_size); |
|
} |
} |
} |
} |
|
|
Line 2863 rf_update_component_labels(RF_Raid_t *ra |
|
Line 2835 rf_update_component_labels(RF_Raid_t *ra |
|
int c; |
int c; |
int j; |
int j; |
int scol; |
int scol; |
struct raid_softc *rs = raidPtr->softc; |
|
|
|
scol = -1; |
scol = -1; |
|
|
Line 2879 rf_update_component_labels(RF_Raid_t *ra |
|
Line 2850 rf_update_component_labels(RF_Raid_t *ra |
|
clabel->status = rf_ds_optimal; |
clabel->status = rf_ds_optimal; |
|
|
/* note what unit we are configured as */ |
/* note what unit we are configured as */ |
if ((rs->sc_cflags & RAIDF_UNIT_CHANGED) == 0) |
clabel->last_unit = raidPtr->raidid; |
clabel->last_unit = raidPtr->raidid; |
|
|
|
raidflush_component_label(raidPtr, c); |
raidflush_component_label(raidPtr, c); |
if (final == RF_FINAL_COMPONENT_UPDATE) { |
if (final == RF_FINAL_COMPONENT_UPDATE) { |
Line 2920 rf_update_component_labels(RF_Raid_t *ra |
|
Line 2890 rf_update_component_labels(RF_Raid_t *ra |
|
|
|
clabel->column = scol; |
clabel->column = scol; |
clabel->status = rf_ds_optimal; |
clabel->status = rf_ds_optimal; |
if ((rs->sc_cflags & RAIDF_UNIT_CHANGED) == 0) |
clabel->last_unit = raidPtr->raidid; |
clabel->last_unit = raidPtr->raidid; |
|
|
|
raidflush_component_label(raidPtr, sparecol); |
raidflush_component_label(raidPtr, sparecol); |
if (final == RF_FINAL_COMPONENT_UPDATE) { |
if (final == RF_FINAL_COMPONENT_UPDATE) { |