summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-10-18 09:03:15 +0000
committerphk <phk@FreeBSD.org>2003-10-18 09:03:15 +0000
commit3dfc831549729fecf05cda278554a643f0f15049 (patch)
tree3739cd1a447c117bc422cf2eddc1b13ae20ff4b5 /sys/kern/vfs_bio.c
parenteec76e0d92ea52c0b11dab9eb047119d0e6ce013 (diff)
downloadFreeBSD-src-3dfc831549729fecf05cda278554a643f0f15049.zip
FreeBSD-src-3dfc831549729fecf05cda278554a643f0f15049.tar.gz
The size and contents of the DEV_STRATEGY() macro has progressed to
the point where it being a macro is no longer sensible, and it will only be more so in days to come. BIO_STRATEGY() is now only used from DEV_STRATEGY() and should not be used directly anymore. Put the contents of both in the new function dev_strategy() and make DEV_STRATEGY() call that function. In addition, this allows us to make the rather magic bufdonebio() helper function static. This alse saves hunderedandsome bytes of code in a typical kernel.
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 0c8d130..939f968 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bio.h>
+#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/devicestat.h>
#include <sys/eventhandler.h>
@@ -3054,7 +3055,7 @@ 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
+static void
bufdonebio(struct bio *bp)
{
@@ -3064,6 +3065,21 @@ bufdonebio(struct bio *bp)
mtx_unlock(&Giant);
}
+void
+dev_strategy(struct buf *bp)
+{
+
+ if ((!bp->b_iocmd) || (bp->b_iocmd & (bp->b_iocmd - 1)))
+ panic("b_iocmd botch");
+ if (bp->b_flags & B_PHYS)
+ bp->b_io.bio_offset = bp->b_offset;
+ else
+ bp->b_io.bio_offset = dbtob(bp->b_blkno);
+ bp->b_io.bio_done = bufdonebio;
+ bp->b_io.bio_caller2 = bp;
+ (*devsw(bp->b_io.bio_dev)->d_strategy)(&bp->b_io);
+}
+
/*
* bufdone:
*
OpenPOWER on IntegriCloud