diff options
Diffstat (limited to 'sys/dev/softraid_raid0.c')
-rw-r--r-- | sys/dev/softraid_raid0.c | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c index d8994687878..9fa1fed1e69 100644 --- a/sys/dev/softraid_raid0.c +++ b/sys/dev/softraid_raid0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid0.c,v 1.8 2008/02/05 16:49:25 marco Exp $ */ +/* $OpenBSD: softraid_raid0.c,v 1.9 2008/07/19 22:41:58 marco Exp $ */ /* * Copyright (c) 2008 Marco Peereboom <marco@peereboom.us> * @@ -55,14 +55,14 @@ sr_raid0_alloc_resources(struct sr_discipline *sd) DNPRINTF(SR_D_DIS, "%s: sr_raid0_alloc_resources\n", DEVNAME(sd->sd_sc)); - if (sr_alloc_wu(sd)) + if (sr_wu_alloc(sd)) goto bad; - if (sr_alloc_ccb(sd)) + if (sr_ccb_alloc(sd)) goto bad; /* setup runtime values */ sd->mds.mdd_raid0.sr0_strip_bits = - sr_validate_stripsize(sd->sd_vol.sv_meta.svm_strip_size); + sr_validate_stripsize(sd->sd_meta->ssdi.ssd_strip_size); if (sd->mds.mdd_raid0.sr0_strip_bits == -1) goto bad; @@ -82,11 +82,8 @@ sr_raid0_free_resources(struct sr_discipline *sd) DNPRINTF(SR_D_DIS, "%s: sr_raid0_free_resources\n", DEVNAME(sd->sd_sc)); - sr_free_wu(sd); - sr_free_ccb(sd); - - if (sd->sd_meta) - free(sd->sd_meta, M_DEVBUF); + sr_wu_free(sd); + sr_ccb_free(sd); rv = 0; return (rv); @@ -98,8 +95,8 @@ sr_raid0_set_chunk_state(struct sr_discipline *sd, int c, int new_state) int old_state, s; DNPRINTF(SR_D_STATE, "%s: %s: %s: sr_raid_set_chunk_state %d -> %d\n", - DEVNAME(sd->sd_sc), sd->sd_vol.sv_meta.svm_devname, - sd->sd_vol.sv_chunks[c]->src_meta.scm_devname, c, new_state); + DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, + sd->sd_vol.sv_chunks[c]->src_meta.scmi.scm_devname, c, new_state); /* ok to go to splbio since this only happens in error path */ s = splbio(); @@ -125,8 +122,8 @@ die: splx(s); /* XXX */ panic("%s: %s: %s: invalid chunk state transition " "%d -> %d\n", DEVNAME(sd->sd_sc), - sd->sd_vol.sv_meta.svm_devname, - sd->sd_vol.sv_chunks[c]->src_meta.scm_devname, + sd->sd_meta->ssd_devname, + sd->sd_vol.sv_chunks[c]->src_meta.scmi.scm_devname, old_state, new_state); /* NOTREACHED */ } @@ -135,7 +132,7 @@ die: sd->sd_set_vol_state(sd); sd->sd_must_flush = 1; - workq_add_task(NULL, 0, sr_save_metadata_callback, sd, NULL); + workq_add_task(NULL, 0, sr_meta_save_callback, sd, NULL); done: splx(s); } @@ -145,12 +142,12 @@ sr_raid0_set_vol_state(struct sr_discipline *sd) { int states[SR_MAX_STATES]; int new_state, i, s, nd; - int old_state = sd->sd_vol.sv_meta.svm_status; + int old_state = sd->sd_vol_status; DNPRINTF(SR_D_STATE, "%s: %s: sr_raid_set_vol_state\n", - DEVNAME(sd->sd_sc), sd->sd_vol.sv_meta.svm_devname); + DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname); - nd = sd->sd_vol.sv_meta.svm_no_chunk; + nd = sd->sd_meta->ssdi.ssd_chunk_no; for (i = 0; i < SR_MAX_STATES; i++) states[i] = 0; @@ -160,8 +157,8 @@ sr_raid0_set_vol_state(struct sr_discipline *sd) if (s > SR_MAX_STATES) panic("%s: %s: %s: invalid chunk state", DEVNAME(sd->sd_sc), - sd->sd_vol.sv_meta.svm_devname, - sd->sd_vol.sv_chunks[i]->src_meta.scm_devname); + sd->sd_meta->ssd_devname, + sd->sd_vol.sv_chunks[i]->src_meta.scmi.scm_devname); states[s]++; } @@ -171,7 +168,7 @@ sr_raid0_set_vol_state(struct sr_discipline *sd) new_state = BIOC_SVOFFLINE; DNPRINTF(SR_D_STATE, "%s: %s: sr_raid_set_vol_state %d -> %d\n", - DEVNAME(sd->sd_sc), sd->sd_vol.sv_meta.svm_devname, + DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, old_state, new_state); switch (old_state) { @@ -190,12 +187,12 @@ sr_raid0_set_vol_state(struct sr_discipline *sd) die: panic("%s: %s: invalid volume state transition " "%d -> %d\n", DEVNAME(sd->sd_sc), - sd->sd_vol.sv_meta.svm_devname, + sd->sd_meta->ssd_devname, old_state, new_state); /* NOTREACHED */ } - sd->sd_vol.sv_meta.svm_status = new_state; + sd->sd_vol_status = new_state; } int @@ -215,12 +212,12 @@ sr_raid0_rw(struct sr_workunit *wu) if (sr_validate_io(wu, &blk, "sr_raid0_rw")) goto bad; - strip_size = sd->sd_vol.sv_meta.svm_strip_size; + strip_size = sd->sd_meta->ssdi.ssd_strip_size; strip_bits = sd->mds.mdd_raid0.sr0_strip_bits; - no_chunk = sd->sd_vol.sv_meta.svm_no_chunk; + no_chunk = sd->sd_meta->ssdi.ssd_chunk_no; DNPRINTF(SR_D_DIS, "%s: %s: front end io: lba %lld size %d\n", - DEVNAME(sd->sd_sc), sd->sd_vol.sv_meta.svm_devname, + DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, blk, xs->datalen); /* all offs are in bytes */ @@ -238,16 +235,16 @@ sr_raid0_rw(struct sr_workunit *wu) /* make sure chunk is online */ scp = sd->sd_vol.sv_chunks[chunk]; if (scp->src_meta.scm_status != BIOC_SDONLINE) { - sr_put_ccb(ccb); + sr_ccb_put(ccb); goto bad; } - ccb = sr_get_ccb(sd); + ccb = sr_ccb_get(sd); if (!ccb) { /* should never happen but handle more gracefully */ printf("%s: %s: too many ccbs queued\n", DEVNAME(sd->sd_sc), - sd->sd_vol.sv_meta.svm_devname); + sd->sd_meta->ssd_devname); goto bad; } @@ -255,7 +252,7 @@ sr_raid0_rw(struct sr_workunit *wu) "strip_no: %lld chunk: %lld stripoffs: %lld " "chunkoffs: %lld physoffs: %lld length: %lld " "leftover: %lld data: %p\n", - DEVNAME(sd->sd_sc), sd->sd_vol.sv_meta.svm_devname, lbaoffs, + DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, lbaoffs, strip_no, chunk, stripoffs, chunkoffs, physoffs, length, leftover, data); @@ -279,7 +276,7 @@ sr_raid0_rw(struct sr_workunit *wu) DNPRINTF(SR_D_DIS, "%s: %s: sr_raid0: b_bcount: %d " "b_blkno: %lld b_flags 0x%0x b_data %p\n", - DEVNAME(sd->sd_sc), sd->sd_vol.sv_meta.svm_devname, + DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, ccb->ccb_buf.b_bcount, ccb->ccb_buf.b_blkno, ccb->ccb_buf.b_flags, ccb->ccb_buf.b_data); @@ -306,7 +303,7 @@ queued: splx(s); return (0); bad: - /* wu is unwound by sr_put_wu */ + /* wu is unwound by sr_wu_put */ return (1); } @@ -385,7 +382,7 @@ sr_raid0_intr(struct buf *bp) DEVNAME(sc), wu); /* do not change the order of these 2 functions */ - sr_put_wu(wu); + sr_wu_put(wu); scsi_done(xs); if (sd->sd_sync && sd->sd_wu_pending == 0) @@ -397,7 +394,7 @@ sr_raid0_intr(struct buf *bp) bad: xs->error = XS_DRIVER_STUFFUP; xs->flags |= ITSDONE; - sr_put_wu(wu); + sr_wu_put(wu); scsi_done(xs); splx(s); } |