aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/sd.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index aa6b48ba78b1..e8c295e01466 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -471,6 +471,18 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
471 return ret; 471 return ret;
472} 472}
473 473
474static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
475{
476 /* for now, we use REQ_TYPE_BLOCK_PC. */
477 rq->cmd_type = REQ_TYPE_BLOCK_PC;
478 rq->timeout = SD_TIMEOUT;
479 rq->retries = SD_MAX_RETRIES;
480 rq->cmd[0] = SYNCHRONIZE_CACHE;
481 rq->cmd_len = 10;
482
483 return scsi_setup_blk_pc_cmnd(sdp, rq);
484}
485
474static void sd_unprep_fn(struct request_queue *q, struct request *rq) 486static void sd_unprep_fn(struct request_queue *q, struct request *rq)
475{ 487{
476 if (rq->cmd_flags & REQ_DISCARD) 488 if (rq->cmd_flags & REQ_DISCARD)
@@ -504,6 +516,9 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
504 if (rq->cmd_flags & REQ_DISCARD) { 516 if (rq->cmd_flags & REQ_DISCARD) {
505 ret = scsi_setup_discard_cmnd(sdp, rq); 517 ret = scsi_setup_discard_cmnd(sdp, rq);
506 goto out; 518 goto out;
519 } else if (rq->cmd_flags & REQ_FLUSH) {
520 ret = scsi_setup_flush_cmnd(sdp, rq);
521 goto out;
507 } else if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { 522 } else if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
508 ret = scsi_setup_blk_pc_cmnd(sdp, rq); 523 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
509 goto out; 524 goto out;
@@ -1053,15 +1068,6 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
1053 return 0; 1068 return 0;
1054} 1069}
1055 1070
1056static void sd_prepare_flush(struct request_queue *q, struct request *rq)
1057{
1058 rq->cmd_type = REQ_TYPE_BLOCK_PC;
1059 rq->timeout = SD_TIMEOUT;
1060 rq->retries = SD_MAX_RETRIES;
1061 rq->cmd[0] = SYNCHRONIZE_CACHE;
1062 rq->cmd_len = 10;
1063}
1064
1065static void sd_rescan(struct device *dev) 1071static void sd_rescan(struct device *dev)
1066{ 1072{
1067 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 1073 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
@@ -2129,7 +2135,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
2129 else 2135 else
2130 ordered = QUEUE_ORDERED_DRAIN; 2136 ordered = QUEUE_ORDERED_DRAIN;
2131 2137
2132 blk_queue_ordered(sdkp->disk->queue, ordered, sd_prepare_flush); 2138 blk_queue_ordered(sdkp->disk->queue, ordered, NULL);
2133 2139
2134 set_capacity(disk, sdkp->capacity); 2140 set_capacity(disk, sdkp->capacity);
2135 kfree(buffer); 2141 kfree(buffer);