From: ike Snitzer Date: Sun, 8 Aug 2010 16:11:33 +0000 (-0400) Subject: block: update request stacking methods to support discards X-Git-Tag: upstream/snapshot3+hdmi~13504^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3383977fadc4027f20907f6208a9033cd043adab;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git block: update request stacking methods to support discards Propagate REQ_DISCARD in cmd_flags when cloning a discard request. Skip blk_rq_check_limits's existing checks for discard requests because discard limits will have already been checked in blkdev_issue_discard. Signed-off-by: Mike Snitzer Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/block/blk-core.c b/block/blk-core.c index 5ab3ac2..7da630e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1644,6 +1644,9 @@ EXPORT_SYMBOL(submit_bio); */ int blk_rq_check_limits(struct request_queue *q, struct request *rq) { + if (rq->cmd_flags & REQ_DISCARD) + return 0; + if (blk_rq_sectors(rq) > queue_max_sectors(q) || blk_rq_bytes(rq) > queue_max_hw_sectors(q) << 9) { printk(KERN_ERR "%s: over max size limit.\n", __func__); @@ -2492,6 +2495,8 @@ static void __blk_rq_prep_clone(struct request *dst, struct request *src) { dst->cpu = src->cpu; dst->cmd_flags = (rq_data_dir(src) | REQ_NOMERGE); + if (src->cmd_flags & REQ_DISCARD) + dst->cmd_flags |= REQ_DISCARD; dst->cmd_type = src->cmd_type; dst->__sector = blk_rq_pos(src); dst->__data_len = blk_rq_bytes(src);