summaryrefslogtreecommitdiffstats
path: root/include/linux/bio.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-09-27 13:01:25 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 11:03:56 +0200
commitbf2de6f5a4faf0197268f18d08969b003b87b6e8 (patch)
tree16830a15a7effea352445a7aba5dbb433314d3eb /include/linux/bio.h
parentc07e2b41291853b19fff11ceee3657df252a4e42 (diff)
downloadop-kernel-dev-bf2de6f5a4faf0197268f18d08969b003b87b6e8.zip
op-kernel-dev-bf2de6f5a4faf0197268f18d08969b003b87b6e8.tar.gz
block: Initial support for data-less (or empty) barrier support
This implements functionality to pass down or insert a barrier in a queue, without having data attached to it. The ->prepare_flush_fn() infrastructure from data barriers are reused to provide this functionality. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 089a8bc..4da4413 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -176,13 +176,28 @@ struct bio {
#define bio_offset(bio) bio_iovec((bio))->bv_offset
#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
#define bio_sectors(bio) ((bio)->bi_size >> 9)
-#define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9)
-#define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio)))
#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
+#define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size)
+
+static inline unsigned int bio_cur_sectors(struct bio *bio)
+{
+ if (bio->bi_vcnt)
+ return bio_iovec(bio)->bv_len >> 9;
+
+ return 0;
+}
+
+static inline void *bio_data(struct bio *bio)
+{
+ if (bio->bi_vcnt)
+ return page_address(bio_page(bio)) + bio_offset(bio);
+
+ return NULL;
+}
/*
* will die
OpenPOWER on IntegriCloud