Commit e7258c1a authored by Martin K. Petersen's avatar Martin K. Petersen Committed by Jens Axboe

block: Get rid of bdev_integrity_enabled()

bdev_integrity_enabled() is only used by bio_integrity_enabled().
Combine these two functions.
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent f70ced09
...@@ -192,16 +192,6 @@ will require extra work due to the application tag. ...@@ -192,16 +192,6 @@ will require extra work due to the application tag.
supported by the block device. supported by the block device.
int bdev_integrity_enabled(block_device, int rw);
bdev_integrity_enabled() will return 1 if the block device
supports integrity metadata transfer for the data direction
specified in 'rw'.
bdev_integrity_enabled() honors the write_generate and
read_verify flags in sysfs and will respond accordingly.
int bio_integrity_prep(bio); int bio_integrity_prep(bio);
To generate IMD for WRITE and to set up buffers for READ, the To generate IMD for WRITE and to set up buffers for READ, the
......
...@@ -147,24 +147,6 @@ int bio_integrity_add_page(struct bio *bio, struct page *page, ...@@ -147,24 +147,6 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
} }
EXPORT_SYMBOL(bio_integrity_add_page); EXPORT_SYMBOL(bio_integrity_add_page);
static int bdev_integrity_enabled(struct block_device *bdev, int rw)
{
struct blk_integrity *bi = bdev_get_integrity(bdev);
if (bi == NULL)
return 0;
if (rw == READ && bi->verify_fn != NULL &&
(bi->flags & INTEGRITY_FLAG_READ))
return 1;
if (rw == WRITE && bi->generate_fn != NULL &&
(bi->flags & INTEGRITY_FLAG_WRITE))
return 1;
return 0;
}
/** /**
* bio_integrity_enabled - Check whether integrity can be passed * bio_integrity_enabled - Check whether integrity can be passed
* @bio: bio to check * @bio: bio to check
...@@ -174,16 +156,29 @@ static int bdev_integrity_enabled(struct block_device *bdev, int rw) ...@@ -174,16 +156,29 @@ static int bdev_integrity_enabled(struct block_device *bdev, int rw)
* set prior to calling. The functions honors the write_generate and * set prior to calling. The functions honors the write_generate and
* read_verify flags in sysfs. * read_verify flags in sysfs.
*/ */
int bio_integrity_enabled(struct bio *bio) bool bio_integrity_enabled(struct bio *bio)
{ {
struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev);
if (!bio_is_rw(bio)) if (!bio_is_rw(bio))
return 0; return false;
/* Already protected? */ /* Already protected? */
if (bio_integrity(bio)) if (bio_integrity(bio))
return 0; return false;
if (bi == NULL)
return false;
if (bio_data_dir(bio) == READ && bi->verify_fn != NULL &&
(bi->flags & INTEGRITY_FLAG_READ))
return true;
if (bio_data_dir(bio) == WRITE && bi->generate_fn != NULL &&
(bi->flags & INTEGRITY_FLAG_WRITE))
return true;
return bdev_integrity_enabled(bio->bi_bdev, bio_data_dir(bio)); return false;
} }
EXPORT_SYMBOL(bio_integrity_enabled); EXPORT_SYMBOL(bio_integrity_enabled);
......
...@@ -666,7 +666,7 @@ struct biovec_slab { ...@@ -666,7 +666,7 @@ struct biovec_slab {
extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
extern void bio_integrity_free(struct bio *); extern void bio_integrity_free(struct bio *);
extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
extern int bio_integrity_enabled(struct bio *bio); extern bool bio_integrity_enabled(struct bio *bio);
extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
extern int bio_integrity_get_tag(struct bio *, void *, unsigned int); extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
extern int bio_integrity_prep(struct bio *); extern int bio_integrity_prep(struct bio *);
...@@ -685,9 +685,9 @@ static inline int bio_integrity(struct bio *bio) ...@@ -685,9 +685,9 @@ static inline int bio_integrity(struct bio *bio)
return 0; return 0;
} }
static inline int bio_integrity_enabled(struct bio *bio) static inline bool bio_integrity_enabled(struct bio *bio)
{ {
return 0; return false;
} }
static inline int bioset_integrity_create(struct bio_set *bs, int pool_size) static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment