diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-08-08 11:17:12 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 08:56:00 +0200 |
commit | 7a67f63b3233ff28e753854fe27891c44f8588ae (patch) | |
tree | 0383a42c135605f976c126b263c07fb250b3ffca | |
parent | 35e396cd100489dfe8f5a76e3613fb8049ffdff3 (diff) | |
download | linux-7a67f63b3233ff28e753854fe27891c44f8588ae.tar.gz linux-7a67f63b3233ff28e753854fe27891c44f8588ae.tar.bz2 linux-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>
-rw-r--r-- | include/linux/bio.h | 8 |
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, __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)])) |