break;
}
skreq->discard_page = 1;
+ req->completion_data = page;
skd_prep_discard_cdb(scsi_req, skreq, page, lba, count);
} else if (flush == SKD_FLUSH_ZERO_SIZE_FIRST) {
if ((io_flags & REQ_DISCARD) &&
(skreq->discard_page == 1)) {
- struct bio *bio = req->bio;
pr_debug("%s:%s:%d, free the page!",
skdev->name, __func__, __LINE__);
- __free_page(bio->bi_io_vec->bv_page);
+ __free_page(req->completion_data);
}
if (unlikely(error)) {
goto out;
}
+ rq->completion_data = page;
blk_add_request_payload(rq, page, len);
ret = scsi_setup_blk_pc_cmnd(sdp, rq);
rq->__data_len = nr_bytes;
{
struct scsi_cmnd *SCpnt = rq->special;
- if (rq->cmd_flags & REQ_DISCARD) {
- struct bio *bio = rq->bio;
+ if (rq->cmd_flags & REQ_DISCARD)
+ __free_page(rq->completion_data);
- __free_page(bio->bi_io_vec->bv_page);
- }
if (SCpnt->cmnd != rq->cmd) {
mempool_free(SCpnt->cmnd, sd_cdb_pool);
SCpnt->cmnd = NULL;