mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
blk-integrity: empty implementation when disabled
This patch moves the blk_integrity_payload definition outside the CONFIG_BLK_DEV_INTERITY dependency and provides empty function implementations when the kernel configuration disables integrity extensions. This simplifies drivers that make use of these to map user data so they don't need to repeat the same configuration checks. Signed-off-by: Keith Busch <keith.busch@intel.com> Updated by Jens to pass an error pointer return from bio_integrity_alloc(), otherwise if CONFIG_BLK_DEV_INTEGRITY isn't set, we return a weird ENOMEM from __nvme_submit_user_cmd() if a meta buffer is set. Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
9a0be7abb6
commit
06c1e3902a
4 changed files with 28 additions and 16 deletions
|
@ -318,16 +318,6 @@ enum bip_flags {
|
|||
BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_INTEGRITY)
|
||||
|
||||
static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
|
||||
{
|
||||
if (bio->bi_rw & REQ_INTEGRITY)
|
||||
return bio->bi_integrity;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* bio integrity payload
|
||||
*/
|
||||
|
@ -349,6 +339,16 @@ struct bio_integrity_payload {
|
|||
struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_INTEGRITY)
|
||||
|
||||
static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
|
||||
{
|
||||
if (bio->bi_rw & REQ_INTEGRITY)
|
||||
return bio->bi_integrity;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
|
||||
{
|
||||
struct bio_integrity_payload *bip = bio_integrity(bio);
|
||||
|
@ -795,6 +795,18 @@ static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline void *bio_integrity_alloc(struct bio * bio, gfp_t gfp,
|
||||
unsigned int nr)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline int bio_integrity_add_page(struct bio *bio, struct page *page,
|
||||
unsigned int len, unsigned int offset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLK_DEV_INTEGRITY */
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue