aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-08-08 05:17:12 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:00 -0400
commit7a67f63b3233ff28e753854fe27891c44f8588ae (patch)
tree0383a42c135605f976c126b263c07fb250b3ffca
parent35e396cd100489dfe8f5a76e3613fb8049ffdff3 (diff)
block: add bio_has_data() to detect whether a bio carries data or not
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-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 0933a14e6414..9e93c9299479 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,
445 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 445 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
446#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 446#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
447 447
448/*
449 * Check whether this bio carries any data or not. A NULL bio is allowed.
450 */
451static inline int bio_has_data(struct bio *bio)
452{
453 return bio && bio->bi_io_vec != NULL;
454}
455
448#if defined(CONFIG_BLK_DEV_INTEGRITY) 456#if defined(CONFIG_BLK_DEV_INTEGRITY)
449 457
450#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) 458#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))