diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 708923b9b623..99da9ebc7377 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -584,7 +584,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
584 | 584 | ||
585 | #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) | 585 | #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) |
586 | 586 | ||
587 | #define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) | 587 | #define rq_data_dir(rq) ((int)((rq)->cmd_flags & 1)) |
588 | 588 | ||
589 | /* | 589 | /* |
590 | * Driver can handle struct request, if it either has an old style | 590 | * Driver can handle struct request, if it either has an old style |
@@ -1368,6 +1368,26 @@ static inline bool bvec_gap_to_prev(struct request_queue *q, | |||
1368 | ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q)); | 1368 | ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q)); |
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | static inline bool bio_will_gap(struct request_queue *q, struct bio *prev, | ||
1372 | struct bio *next) | ||
1373 | { | ||
1374 | if (!bio_has_data(prev)) | ||
1375 | return false; | ||
1376 | |||
1377 | return bvec_gap_to_prev(q, &prev->bi_io_vec[prev->bi_vcnt - 1], | ||
1378 | next->bi_io_vec[0].bv_offset); | ||
1379 | } | ||
1380 | |||
1381 | static inline bool req_gap_back_merge(struct request *req, struct bio *bio) | ||
1382 | { | ||
1383 | return bio_will_gap(req->q, req->biotail, bio); | ||
1384 | } | ||
1385 | |||
1386 | static inline bool req_gap_front_merge(struct request *req, struct bio *bio) | ||
1387 | { | ||
1388 | return bio_will_gap(req->q, bio, req->bio); | ||
1389 | } | ||
1390 | |||
1371 | struct work_struct; | 1391 | struct work_struct; |
1372 | int kblockd_schedule_work(struct work_struct *work); | 1392 | int kblockd_schedule_work(struct work_struct *work); |
1373 | int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay); | 1393 | int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay); |
@@ -1494,6 +1514,26 @@ queue_max_integrity_segments(struct request_queue *q) | |||
1494 | return q->limits.max_integrity_segments; | 1514 | return q->limits.max_integrity_segments; |
1495 | } | 1515 | } |
1496 | 1516 | ||
1517 | static inline bool integrity_req_gap_back_merge(struct request *req, | ||
1518 | struct bio *next) | ||
1519 | { | ||
1520 | struct bio_integrity_payload *bip = bio_integrity(req->bio); | ||
1521 | struct bio_integrity_payload *bip_next = bio_integrity(next); | ||
1522 | |||
1523 | return bvec_gap_to_prev(req->q, &bip->bip_vec[bip->bip_vcnt - 1], | ||
1524 | bip_next->bip_vec[0].bv_offset); | ||
1525 | } | ||
1526 | |||
1527 | static inline bool integrity_req_gap_front_merge(struct request *req, | ||
1528 | struct bio *bio) | ||
1529 | { | ||
1530 | struct bio_integrity_payload *bip = bio_integrity(bio); | ||
1531 | struct bio_integrity_payload *bip_next = bio_integrity(req->bio); | ||
1532 | |||
1533 | return bvec_gap_to_prev(req->q, &bip->bip_vec[bip->bip_vcnt - 1], | ||
1534 | bip_next->bip_vec[0].bv_offset); | ||
1535 | } | ||
1536 | |||
1497 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | 1537 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
1498 | 1538 | ||
1499 | struct bio; | 1539 | struct bio; |
@@ -1560,6 +1600,16 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g) | |||
1560 | { | 1600 | { |
1561 | return 0; | 1601 | return 0; |
1562 | } | 1602 | } |
1603 | static inline bool integrity_req_gap_back_merge(struct request *req, | ||
1604 | struct bio *next) | ||
1605 | { | ||
1606 | return false; | ||
1607 | } | ||
1608 | static inline bool integrity_req_gap_front_merge(struct request *req, | ||
1609 | struct bio *bio) | ||
1610 | { | ||
1611 | return false; | ||
1612 | } | ||
1563 | 1613 | ||
1564 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 1614 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
1565 | 1615 | ||