diff options
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 2d739ca10923..5cc29299f6ac 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1657,8 +1657,8 @@ generic_make_request_checks(struct bio *bio) | |||
1657 | goto end_io; | 1657 | goto end_io; |
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | if (unlikely(!(bio->bi_rw & REQ_DISCARD) && | 1660 | if (likely(bio_is_rw(bio) && |
1661 | nr_sectors > queue_max_hw_sectors(q))) { | 1661 | nr_sectors > queue_max_hw_sectors(q))) { |
1662 | printk(KERN_ERR "bio too big device %s (%u > %u)\n", | 1662 | printk(KERN_ERR "bio too big device %s (%u > %u)\n", |
1663 | bdevname(bio->bi_bdev, b), | 1663 | bdevname(bio->bi_bdev, b), |
1664 | bio_sectors(bio), | 1664 | bio_sectors(bio), |
@@ -1699,8 +1699,7 @@ generic_make_request_checks(struct bio *bio) | |||
1699 | 1699 | ||
1700 | if ((bio->bi_rw & REQ_DISCARD) && | 1700 | if ((bio->bi_rw & REQ_DISCARD) && |
1701 | (!blk_queue_discard(q) || | 1701 | (!blk_queue_discard(q) || |
1702 | ((bio->bi_rw & REQ_SECURE) && | 1702 | ((bio->bi_rw & REQ_SECURE) && !blk_queue_secdiscard(q)))) { |
1703 | !blk_queue_secdiscard(q)))) { | ||
1704 | err = -EOPNOTSUPP; | 1703 | err = -EOPNOTSUPP; |
1705 | goto end_io; | 1704 | goto end_io; |
1706 | } | 1705 | } |
@@ -1818,7 +1817,7 @@ void submit_bio(int rw, struct bio *bio) | |||
1818 | * If it's a regular read/write or a barrier with data attached, | 1817 | * If it's a regular read/write or a barrier with data attached, |
1819 | * go through the normal accounting stuff before submission. | 1818 | * go through the normal accounting stuff before submission. |
1820 | */ | 1819 | */ |
1821 | if (bio_has_data(bio) && !(rw & REQ_DISCARD)) { | 1820 | if (bio_has_data(bio)) { |
1822 | if (rw & WRITE) { | 1821 | if (rw & WRITE) { |
1823 | count_vm_events(PGPGOUT, count); | 1822 | count_vm_events(PGPGOUT, count); |
1824 | } else { | 1823 | } else { |
@@ -1864,7 +1863,7 @@ EXPORT_SYMBOL(submit_bio); | |||
1864 | */ | 1863 | */ |
1865 | int blk_rq_check_limits(struct request_queue *q, struct request *rq) | 1864 | int blk_rq_check_limits(struct request_queue *q, struct request *rq) |
1866 | { | 1865 | { |
1867 | if (rq->cmd_flags & REQ_DISCARD) | 1866 | if (!rq_mergeable(rq)) |
1868 | return 0; | 1867 | return 0; |
1869 | 1868 | ||
1870 | if (blk_rq_sectors(rq) > queue_max_sectors(q) || | 1869 | if (blk_rq_sectors(rq) > queue_max_sectors(q) || |
@@ -2338,7 +2337,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
2338 | req->buffer = bio_data(req->bio); | 2337 | req->buffer = bio_data(req->bio); |
2339 | 2338 | ||
2340 | /* update sector only for requests with clear definition of sector */ | 2339 | /* update sector only for requests with clear definition of sector */ |
2341 | if (req->cmd_type == REQ_TYPE_FS || (req->cmd_flags & REQ_DISCARD)) | 2340 | if (req->cmd_type == REQ_TYPE_FS) |
2342 | req->__sector += total_bytes >> 9; | 2341 | req->__sector += total_bytes >> 9; |
2343 | 2342 | ||
2344 | /* mixed attributes always follow the first bio */ | 2343 | /* mixed attributes always follow the first bio */ |