summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-14 19:34:11 +0000
committerphk <phk@FreeBSD.org>2002-09-14 19:34:11 +0000
commitcff87abbac5243f0a34923de8c9a99a54a663adb (patch)
tree44ed797fbc1fadb644d7aacd1e0b88e69a6755e4 /sys
parent79ce8a243fa3651af69ae1551da894135499e83b (diff)
downloadFreeBSD-src-cff87abbac5243f0a34923de8c9a99a54a663adb.zip
FreeBSD-src-cff87abbac5243f0a34923de8c9a99a54a663adb.tar.gz
Un-inline the non-trivial "trivial" bio* functions.
Untangle devstat_end_transaction_bio()
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_bio.c39
-rw-r--r--sys/sys/bio.h61
-rw-r--r--sys/sys/devicestat.h2
3 files changed, 45 insertions, 57 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a4e0397..3ef984a 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -32,6 +32,7 @@
#include <sys/stdint.h>
#include <sys/bio.h>
#include <sys/buf.h>
+#include <sys/devicestat.h>
#include <sys/eventhandler.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@@ -2834,6 +2835,44 @@ biowait(struct bio *bp, const char *wchan)
return (EIO);
}
+void
+biofinish(struct bio *bp, struct devstat *stat, int error)
+{
+
+ if (error) {
+ bp->bio_error = error;
+ bp->bio_flags |= BIO_ERROR;
+ }
+ if (stat != NULL)
+ devstat_end_transaction_bio(stat, bp);
+ biodone(bp);
+}
+
+void
+bioq_init(struct bio_queue_head *head)
+{
+ TAILQ_INIT(&head->queue);
+ head->last_pblkno = 0;
+ head->insert_point = NULL;
+ head->switch_point = NULL;
+}
+
+void
+bioq_remove(struct bio_queue_head *head, struct bio *bp)
+{
+ if (bp == head->switch_point)
+ head->switch_point = TAILQ_NEXT(bp, bio_queue);
+ if (bp == head->insert_point) {
+ head->insert_point = TAILQ_PREV(bp, bio_queue, bio_queue);
+ if (head->insert_point == NULL)
+ head->last_pblkno = 0;
+ } else if (bp == TAILQ_FIRST(&head->queue))
+ head->last_pblkno = bp->bio_pblkno;
+ TAILQ_REMOVE(&head->queue, bp, bio_queue);
+ if (TAILQ_FIRST(&head->queue) == head->switch_point)
+ head->switch_point = NULL;
+}
+
/*
* bufwait:
*
diff --git a/sys/sys/bio.h b/sys/sys/bio.h
index 173636b..8b28838 100644
--- a/sys/sys/bio.h
+++ b/sys/sys/bio.h
@@ -106,27 +106,7 @@ struct bio {
#ifdef _KERNEL
struct uio;
-
-void biodone(struct bio *bp);
-int biowait(struct bio *bp, const char *wchan);
-
-#ifndef _DEVICESTAT_H
struct devstat;
-void devstat_end_transaction_bio(struct devstat *, struct bio *);
-#endif
-
-static __inline__ void
-biofinish(struct bio *bp, struct devstat *stat, int error)
-{
-
- if (error) {
- bp->bio_error = error;
- bp->bio_flags |= BIO_ERROR;
- }
- if (stat != NULL)
- devstat_end_transaction_bio(stat, bp);
- biodone(bp);
-}
struct bio_queue_head {
TAILQ_HEAD(bio_queue, bio) queue;
@@ -136,58 +116,29 @@ struct bio_queue_head {
int busy;
};
-static __inline void bioq_init(struct bio_queue_head *head);
static __inline void bioq_insert_tail(struct bio_queue_head *head,
struct bio *bp);
-static __inline void bioq_remove(struct bio_queue_head *head,
- struct bio *bp);
static __inline struct bio *bioq_first(struct bio_queue_head *head);
static __inline void
-bioq_init(struct bio_queue_head *head)
-{
- TAILQ_INIT(&head->queue);
- head->last_pblkno = 0;
- head->insert_point = NULL;
- head->switch_point = NULL;
-}
-
-static __inline void
bioq_insert_tail(struct bio_queue_head *head, struct bio *bp)
{
TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue);
}
-static __inline void
-bioq_remove(struct bio_queue_head *head, struct bio *bp)
-{
- if (bp == head->switch_point)
- head->switch_point = TAILQ_NEXT(bp, bio_queue);
- if (bp == head->insert_point) {
- head->insert_point = TAILQ_PREV(bp, bio_queue, bio_queue);
- if (head->insert_point == NULL)
- head->last_pblkno = 0;
- } else if (bp == TAILQ_FIRST(&head->queue))
- head->last_pblkno = bp->bio_pblkno;
- TAILQ_REMOVE(&head->queue, bp, bio_queue);
- if (TAILQ_FIRST(&head->queue) == head->switch_point)
- head->switch_point = NULL;
-}
-
static __inline struct bio *
bioq_first(struct bio_queue_head *head)
{
+
return (TAILQ_FIRST(&head->queue));
}
-/*
- * Zero out the bio's data area.
- */
-#define clrbio(bp) { \
- bzero((bp)->bio_data, (u_int)(bp)->bio_bcount); \
- (bp)->bio_resid = 0; \
-}
+void biodone(struct bio *bp);
+void biofinish(struct bio *bp, struct devstat *stat, int error);
+int biowait(struct bio *bp, const char *wchan);
+void bioq_init(struct bio_queue_head *head);
+void bioq_remove(struct bio_queue_head *head, struct bio *bp);
int physio(dev_t dev, struct uio *uio, int ioflag);
#define physread physio
diff --git a/sys/sys/devicestat.h b/sys/sys/devicestat.h
index b7becea..a75aff3 100644
--- a/sys/sys/devicestat.h
+++ b/sys/sys/devicestat.h
@@ -220,9 +220,7 @@ void devstat_start_transaction(struct devstat *ds);
void devstat_end_transaction(struct devstat *ds, u_int32_t bytes,
devstat_tag_type tag_type,
devstat_trans_flags flags);
-#ifndef _SYS_BIO_H_
void devstat_end_transaction_bio(struct devstat *ds, struct bio *bp);
#endif
-#endif
#endif /* _DEVICESTAT_H */
OpenPOWER on IntegriCloud