aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/skd_main.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-04-16 23:37:30 -0400
committerJens Axboe <axboe@fb.com>2014-04-16 23:37:30 -0400
commitdc4a93078b8a6a10d2dcaba76ab488d6dbe73922 (patch)
treecee24991c2d4fa7d6ad6e2be790fde880c0223ed /drivers/block/skd_main.c
parentfb1be43301ce045b5e563416e701573464a2ed96 (diff)
sd/skd: stuff discard page in request->completion_data
Store the pointer to the page there, so we can always safely reference it from end_io context where ->bio may have been cleared. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/skd_main.c')
-rw-r--r--drivers/block/skd_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 36bcedfd930c..c48d9084c965 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -743,6 +743,7 @@ static void skd_request_fn(struct request_queue *q)
743 break; 743 break;
744 } 744 }
745 skreq->discard_page = 1; 745 skreq->discard_page = 1;
746 req->completion_data = page;
746 skd_prep_discard_cdb(scsi_req, skreq, page, lba, count); 747 skd_prep_discard_cdb(scsi_req, skreq, page, lba, count);
747 748
748 } else if (flush == SKD_FLUSH_ZERO_SIZE_FIRST) { 749 } else if (flush == SKD_FLUSH_ZERO_SIZE_FIRST) {
@@ -855,10 +856,9 @@ static void skd_end_request(struct skd_device *skdev,
855 856
856 if ((io_flags & REQ_DISCARD) && 857 if ((io_flags & REQ_DISCARD) &&
857 (skreq->discard_page == 1)) { 858 (skreq->discard_page == 1)) {
858 struct bio *bio = req->bio;
859 pr_debug("%s:%s:%d, free the page!", 859 pr_debug("%s:%s:%d, free the page!",
860 skdev->name, __func__, __LINE__); 860 skdev->name, __func__, __LINE__);
861 __free_page(bio->bi_io_vec->bv_page); 861 __free_page(req->completion_data);
862 } 862 }
863 863
864 if (unlikely(error)) { 864 if (unlikely(error)) {