aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 38a5ff772a37..19c2e947d4d1 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -456,6 +456,8 @@ struct request_queue {
456 struct blk_mq_tag_set *tag_set; 456 struct blk_mq_tag_set *tag_set;
457 struct list_head tag_set_list; 457 struct list_head tag_set_list;
458 struct bio_set *bio_split; 458 struct bio_set *bio_split;
459
460 bool mq_sysfs_init_done;
459}; 461};
460 462
461#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 463#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -1368,6 +1370,26 @@ static inline bool bvec_gap_to_prev(struct request_queue *q,
1368 ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q)); 1370 ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));
1369} 1371}
1370 1372
1373static inline bool bio_will_gap(struct request_queue *q, struct bio *prev,
1374 struct bio *next)
1375{
1376 if (!bio_has_data(prev))
1377 return false;
1378
1379 return bvec_gap_to_prev(q, &prev->bi_io_vec[prev->bi_vcnt - 1],
1380 next->bi_io_vec[0].bv_offset);
1381}
1382
1383static inline bool req_gap_back_merge(struct request *req, struct bio *bio)
1384{
1385 return bio_will_gap(req->q, req->biotail, bio);
1386}
1387
1388static inline bool req_gap_front_merge(struct request *req, struct bio *bio)
1389{
1390 return bio_will_gap(req->q, bio, req->bio);
1391}
1392
1371struct work_struct; 1393struct work_struct;
1372int kblockd_schedule_work(struct work_struct *work); 1394int kblockd_schedule_work(struct work_struct *work);
1373int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay); 1395int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay);
@@ -1494,6 +1516,26 @@ queue_max_integrity_segments(struct request_queue *q)
1494 return q->limits.max_integrity_segments; 1516 return q->limits.max_integrity_segments;
1495} 1517}
1496 1518
1519static inline bool integrity_req_gap_back_merge(struct request *req,
1520 struct bio *next)
1521{
1522 struct bio_integrity_payload *bip = bio_integrity(req->bio);
1523 struct bio_integrity_payload *bip_next = bio_integrity(next);
1524
1525 return bvec_gap_to_prev(req->q, &bip->bip_vec[bip->bip_vcnt - 1],
1526 bip_next->bip_vec[0].bv_offset);
1527}
1528
1529static inline bool integrity_req_gap_front_merge(struct request *req,
1530 struct bio *bio)
1531{
1532 struct bio_integrity_payload *bip = bio_integrity(bio);
1533 struct bio_integrity_payload *bip_next = bio_integrity(req->bio);
1534
1535 return bvec_gap_to_prev(req->q, &bip->bip_vec[bip->bip_vcnt - 1],
1536 bip_next->bip_vec[0].bv_offset);
1537}
1538
1497#else /* CONFIG_BLK_DEV_INTEGRITY */ 1539#else /* CONFIG_BLK_DEV_INTEGRITY */
1498 1540
1499struct bio; 1541struct bio;
@@ -1560,6 +1602,16 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g)
1560{ 1602{
1561 return 0; 1603 return 0;
1562} 1604}
1605static inline bool integrity_req_gap_back_merge(struct request *req,
1606 struct bio *next)
1607{
1608 return false;
1609}
1610static inline bool integrity_req_gap_front_merge(struct request *req,
1611 struct bio *bio)
1612{
1613 return false;
1614}
1563 1615
1564#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1616#endif /* CONFIG_BLK_DEV_INTEGRITY */
1565 1617