summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-08-08 11:17:12 +0200
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 08:56:00 +0200
commit7a67f63b3233ff28e753854fe27891c44f8588ae (patch)
tree0383a42c135605f976c126b263c07fb250b3ffca /include
parent35e396cd100489dfe8f5a76e3613fb8049ffdff3 (diff)
downloadlinux-3.10-7a67f63b3233ff28e753854fe27891c44f8588ae.tar.gz
linux-3.10-7a67f63b3233ff28e753854fe27891c44f8588ae.tar.bz2
linux-3.10-7a67f63b3233ff28e753854fe27891c44f8588ae.zip
block: add bio_has_data() to detect whether a bio carries data or not
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bio.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 0933a14e641..9e93c929947 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -445,6 +445,14 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
__bio_kmap_irq((bio), (bio)->bi_idx, (flags))
#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
+/*
+ * Check whether this bio carries any data or not. A NULL bio is allowed.
+ */
+static inline int bio_has_data(struct bio *bio)
+{
+ return bio && bio->bi_io_vec != NULL;
+}
+
#if defined(CONFIG_BLK_DEV_INTEGRITY)
#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))