From 8f6a76b4dd073885aba26f3bee2a0bf76a3c21c8 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 1 May 2000 13:36:25 +0000 Subject: Give struct bio it's own call back mechanism. --- sys/kern/subr_diskslice.c | 26 +++++++++----------------- sys/kern/vfs_bio.c | 18 +++++++++++------- 2 files changed, 20 insertions(+), 24 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index b5c197a..1e7d6c4 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -74,7 +74,7 @@ typedef u_char bool_t; static volatile bool_t ds_debug; static struct disklabel *clone_label __P((struct disklabel *lp)); -static void dsiodone __P((struct buf *bp)); +static void dsiodone __P((struct bio *bp)); static char *fixlabel __P((char *sname, struct diskslice *sp, struct disklabel *lp, int writeflag)); static void free_ds_label __P((struct diskslices *ssp, int slice)); @@ -270,13 +270,6 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); * XXX probably need to copy the data to avoid even * temporarily corrupting the in-core copy. */ -#ifdef notyet - if (bp->b_vp != NULL) { - s = splbio(); - bp->b_vp->v_numoutput++; - splx(s); - } -#endif /* XXX need name here. */ msg = fixlabel((char *)NULL, sp, (struct disklabel *) @@ -531,26 +524,25 @@ dsioctl(dev, cmd, data, flags, sspp) static void dsiodone(bp) - struct buf *bp; + struct bio *bp; { struct iodone_chain *ic; char *msg; - ic = bp->b_iodone_chain; - bp->b_flags = bp->b_flags & ~B_DONE; - bp->b_iodone = ic->ic_prev_iodone; - bp->b_iodone_chain = ic->ic_prev_iodone_chain; - if (!(bp->b_iocmd == BIO_READ) - || (!(bp->b_ioflags & BIO_ERROR) && bp->b_error == 0)) { + ic = bp->bio_done_chain; + bp->bio_done = ic->ic_prev_iodone; + bp->bio_done_chain = ic->ic_prev_iodone_chain; + if (!(bp->bio_cmd == BIO_READ) + || (!(bp->bio_flags & BIO_ERROR) && bp->bio_error == 0)) { msg = fixlabel((char *)NULL, ic->ic_args[1].ia_ptr, (struct disklabel *) - (bp->b_data + ic->ic_args[0].ia_long), + (bp->bio_data + ic->ic_args[0].ia_long), FALSE); if (msg != NULL) printf("%s\n", msg); } free(ic, M_DEVBUF); - biodone((struct bio *)bp); /* XXX */ + biodone(bp); } int diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 0338cc5..025d030 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2603,8 +2603,18 @@ bufwait(register struct buf * bp) } } + /* + * Call back function from struct bio back up to struct buf. + * The corresponding initialization lives in sys/conf.h:DEV_STRATEGY(). + */ +void +bufdonebio(struct bio *bp) +{ + bufdone(bp->bio_caller2); +} + /* - * biodone: + * bufdone: * * Finish I/O on a buffer, optionally calling a completion function. * This is usually called from an interrupt so process blocking is @@ -2623,12 +2633,6 @@ bufwait(register struct buf * bp) * in the biodone routine. */ void -biodone(struct bio * bip) -{ - bufdone((struct buf *)bip); -} - -void bufdone(struct buf *bp) { int s; -- cgit v1.1