diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2013-04-23 13:35:09 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2013-04-23 13:35:09 +0000 |
commit | 8079b9f2c1c22ee7496e46a5ace51f498b44b11b (patch) | |
tree | 31950024f185d92e044155a1dcd9eacb7450d2b3 /sys | |
parent | 3485695673557702586b560215d22ee2df3d3fbd (diff) |
Convert RAID4/5 to new ccb handling.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/softraid_raidp.c | 65 |
1 files changed, 13 insertions, 52 deletions
diff --git a/sys/dev/softraid_raidp.c b/sys/dev/softraid_raidp.c index 9a76014285a..25e3596099e 100644 --- a/sys/dev/softraid_raidp.c +++ b/sys/dev/softraid_raidp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raidp.c,v 1.43 2013/04/23 13:13:11 jsing Exp $ */ +/* $OpenBSD: softraid_raidp.c,v 1.44 2013/04/23 13:35:08 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -606,17 +606,17 @@ done: } int -sr_raidp_addio(struct sr_workunit *wu, int dsk, daddr64_t blk, daddr64_t len, - void *data, int flag, int ccbflags, void *xorbuf) +sr_raidp_addio(struct sr_workunit *wu, int chunk, daddr64_t blkno, + daddr64_t len, void *data, int xsflags, int ccbflags, void *xorbuf) { struct sr_discipline *sd = wu->swu_dis; struct sr_ccb *ccb; - ccb = sr_ccb_get(sd); - if (!ccb) - return (-1); + DNPRINTF(SR_D_DIS, "sr_raidp_addio: %s %d.%llx %llx %s\n", + (xsflags & SCSI_DATA_IN) ? "read" : "write", chunk, blkno, len, + xorbuf ? "X0R" : "-"); - /* allocate temporary buffer */ + /* Allocate temporary buffer. */ if (data == NULL) { data = sr_get_block(sd, len); if (data == NULL) @@ -624,53 +624,14 @@ sr_raidp_addio(struct sr_workunit *wu, int dsk, daddr64_t blk, daddr64_t len, ccbflags |= SR_CCBF_FREEBUF; } - DNPRINTF(0, "%sio: %d.%llx %llx %s\n", - flag & SCSI_DATA_IN ? "read" : "write", - dsk, blk, len, - xorbuf ? "X0R" : "-"); - - ccb->ccb_flags = ccbflags; - if (flag & SCSI_POLL) { - ccb->ccb_buf.b_flags = 0; - ccb->ccb_buf.b_iodone = NULL; - } else { - ccb->ccb_buf.b_flags = B_CALL; - ccb->ccb_buf.b_iodone = sr_raidp_intr; + ccb = sr_ccb_rw(sd, chunk, blkno, len, data, xsflags, ccbflags); + if (ccb == NULL) { + if (ccbflags & SR_CCBF_FREEBUF) + sr_put_block(sd, data, len); + return (-1); } - if (flag & SCSI_DATA_IN) - ccb->ccb_buf.b_flags |= B_READ; - else - ccb->ccb_buf.b_flags |= B_WRITE; - - /* add offset for metadata */ - ccb->ccb_buf.b_flags |= B_PHYS; - ccb->ccb_buf.b_blkno = blk; - ccb->ccb_buf.b_bcount = len; - ccb->ccb_buf.b_bufsize = len; - ccb->ccb_buf.b_resid = len; - ccb->ccb_buf.b_data = data; - ccb->ccb_buf.b_error = 0; - ccb->ccb_buf.b_proc = curproc; - ccb->ccb_buf.b_dev = sd->sd_vol.sv_chunks[dsk]->src_dev_mm; - ccb->ccb_buf.b_vp = sd->sd_vol.sv_chunks[dsk]->src_vn; - ccb->ccb_buf.b_bq = NULL; - if ((ccb->ccb_buf.b_flags & B_READ) == 0) - ccb->ccb_buf.b_vp->v_numoutput++; - - ccb->ccb_wu = wu; - ccb->ccb_target = dsk; ccb->ccb_opaque = xorbuf; - - LIST_INIT(&ccb->ccb_buf.b_dep); - TAILQ_INSERT_TAIL(&wu->swu_ccb, ccb, ccb_link); - - DNPRINTF(SR_D_DIS, "%s: %s: sr_raidp: b_bcount: %d " - "b_blkno: %x b_flags 0x%0x b_data %p\n", - 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); - - wu->swu_io_count++; + sr_wu_enqueue_ccb(wu, ccb); return (0); } |