aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:19:56 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 11:14:46 -0400
commit180b2f95dd331010a9930a65c8a18d6d81b94dc1 (patch)
tree8ceb4a28e15e1e588b52022a844f81daabd0f92d /include/linux
parente7258c1a269e0967856c81d182c286a78f5ecf15 (diff)
block: Replace bi_integrity with bi_special
For commands like REQ_COPY we need a way to pass extra information along with each bio. Like integrity metadata this information must be available at the bottom of the stack so bi_private does not suffice. Rename the existing bi_integrity field to bi_special and make it a union so we can have different bio extensions for each class of command. We previously used bi_integrity != NULL as a way to identify whether a bio had integrity metadata or not. Introduce a REQ_INTEGRITY to be the indicator now that bi_special can contain different things. In addition, bio_integrity(bio) will now return a pointer to the integrity payload (when applicable). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h11
-rw-r--r--include/linux/blk_types.h8
-rw-r--r--include/linux/blkdev.h7
3 files changed, 17 insertions, 9 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 63e399b4fde5..a810a74071b2 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -293,6 +293,15 @@ static inline unsigned bio_segments(struct bio *bio)
293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
294 294
295#if defined(CONFIG_BLK_DEV_INTEGRITY) 295#if defined(CONFIG_BLK_DEV_INTEGRITY)
296
297static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
298{
299 if (bio->bi_rw & REQ_INTEGRITY)
300 return bio->bi_integrity;
301
302 return NULL;
303}
304
296/* 305/*
297 * bio integrity payload 306 * bio integrity payload
298 */ 307 */
@@ -661,8 +670,6 @@ struct biovec_slab {
661 for_each_bio(_bio) \ 670 for_each_bio(_bio) \
662 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) 671 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter)
663 672
664#define bio_integrity(bio) (bio->bi_integrity != NULL)
665
666extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 673extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
667extern void bio_integrity_free(struct bio *); 674extern void bio_integrity_free(struct bio *);
668extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 675extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index bb7d66460e7a..6a5d2f2de1b9 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -78,9 +78,11 @@ struct bio {
78 struct io_context *bi_ioc; 78 struct io_context *bi_ioc;
79 struct cgroup_subsys_state *bi_css; 79 struct cgroup_subsys_state *bi_css;
80#endif 80#endif
81 union {
81#if defined(CONFIG_BLK_DEV_INTEGRITY) 82#if defined(CONFIG_BLK_DEV_INTEGRITY)
82 struct bio_integrity_payload *bi_integrity; /* data integrity */ 83 struct bio_integrity_payload *bi_integrity; /* data integrity */
83#endif 84#endif
85 };
84 86
85 unsigned short bi_vcnt; /* how many bio_vec's */ 87 unsigned short bi_vcnt; /* how many bio_vec's */
86 88
@@ -162,6 +164,7 @@ enum rq_flag_bits {
162 __REQ_WRITE_SAME, /* write same block many times */ 164 __REQ_WRITE_SAME, /* write same block many times */
163 165
164 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 166 __REQ_NOIDLE, /* don't anticipate more IO after this one */
167 __REQ_INTEGRITY, /* I/O includes block integrity payload */
165 __REQ_FUA, /* forced unit access */ 168 __REQ_FUA, /* forced unit access */
166 __REQ_FLUSH, /* request for cache flush */ 169 __REQ_FLUSH, /* request for cache flush */
167 170
@@ -203,13 +206,14 @@ enum rq_flag_bits {
203#define REQ_DISCARD (1ULL << __REQ_DISCARD) 206#define REQ_DISCARD (1ULL << __REQ_DISCARD)
204#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME) 207#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME)
205#define REQ_NOIDLE (1ULL << __REQ_NOIDLE) 208#define REQ_NOIDLE (1ULL << __REQ_NOIDLE)
209#define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY)
206 210
207#define REQ_FAILFAST_MASK \ 211#define REQ_FAILFAST_MASK \
208 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 212 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
209#define REQ_COMMON_MASK \ 213#define REQ_COMMON_MASK \
210 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \ 214 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
211 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \ 215 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \
212 REQ_SECURE) 216 REQ_SECURE | REQ_INTEGRITY)
213#define REQ_CLONE_MASK REQ_COMMON_MASK 217#define REQ_CLONE_MASK REQ_COMMON_MASK
214 218
215#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME) 219#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 49f3461e4272..7fcb2caef559 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1514,12 +1514,9 @@ static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1514 return disk->integrity; 1514 return disk->integrity;
1515} 1515}
1516 1516
1517static inline int blk_integrity_rq(struct request *rq) 1517static inline bool blk_integrity_rq(struct request *rq)
1518{ 1518{
1519 if (rq->bio == NULL) 1519 return rq->cmd_flags & REQ_INTEGRITY;
1520 return 0;
1521
1522 return bio_integrity(rq->bio);
1523} 1520}
1524 1521
1525static inline void blk_queue_max_integrity_segments(struct request_queue *q, 1522static inline void blk_queue_max_integrity_segments(struct request_queue *q,