diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-05 21:20:23 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-24 13:56:55 -0500 |
commit | 3c356bde19e9a728b26a231a23099c8057dbe881 (patch) | |
tree | 5c36f956e9f8a15de22dfca057b07c63818eeeda /drivers/scsi/scsi_lib.c | |
parent | bb3ec62a179922b501535d5bd210cb8ba2ad069b (diff) |
scsi: stop passing a gfp_mask argument down the command setup path
There is no reason for ULDs to pass in a flag on how to allocate the S/G
lists. While we don't need GFP_ATOMIC for the blk-mq case because we
don't hold locks, that decision can be made way down the chain without
having to pass a pointless gfp_mask argument.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2179851cdaf3..fcdc585278bf 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -588,10 +588,10 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) | |||
588 | __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free); | 588 | __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free); |
589 | } | 589 | } |
590 | 590 | ||
591 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, | 591 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) |
592 | gfp_t gfp_mask, bool mq) | ||
593 | { | 592 | { |
594 | struct scatterlist *first_chunk = NULL; | 593 | struct scatterlist *first_chunk = NULL; |
594 | gfp_t gfp_mask = mq ? GFP_NOIO : GFP_ATOMIC; | ||
595 | int ret; | 595 | int ret; |
596 | 596 | ||
597 | BUG_ON(!nents); | 597 | BUG_ON(!nents); |
@@ -1077,8 +1077,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
1077 | } | 1077 | } |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | 1080 | static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb) |
1081 | gfp_t gfp_mask) | ||
1082 | { | 1081 | { |
1083 | int count; | 1082 | int count; |
1084 | 1083 | ||
@@ -1086,7 +1085,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
1086 | * If sg table allocation fails, requeue request later. | 1085 | * If sg table allocation fails, requeue request later. |
1087 | */ | 1086 | */ |
1088 | if (unlikely(scsi_alloc_sgtable(sdb, req->nr_phys_segments, | 1087 | if (unlikely(scsi_alloc_sgtable(sdb, req->nr_phys_segments, |
1089 | gfp_mask, req->mq_ctx != NULL))) | 1088 | req->mq_ctx != NULL))) |
1090 | return BLKPREP_DEFER; | 1089 | return BLKPREP_DEFER; |
1091 | 1090 | ||
1092 | /* | 1091 | /* |
@@ -1111,7 +1110,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
1111 | * BLKPREP_DEFER if the failure is retryable | 1110 | * BLKPREP_DEFER if the failure is retryable |
1112 | * BLKPREP_KILL if the failure is fatal | 1111 | * BLKPREP_KILL if the failure is fatal |
1113 | */ | 1112 | */ |
1114 | int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) | 1113 | int scsi_init_io(struct scsi_cmnd *cmd) |
1115 | { | 1114 | { |
1116 | struct scsi_device *sdev = cmd->device; | 1115 | struct scsi_device *sdev = cmd->device; |
1117 | struct request *rq = cmd->request; | 1116 | struct request *rq = cmd->request; |
@@ -1120,7 +1119,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
1120 | 1119 | ||
1121 | BUG_ON(!rq->nr_phys_segments); | 1120 | BUG_ON(!rq->nr_phys_segments); |
1122 | 1121 | ||
1123 | error = scsi_init_sgtable(rq, &cmd->sdb, gfp_mask); | 1122 | error = scsi_init_sgtable(rq, &cmd->sdb); |
1124 | if (error) | 1123 | if (error) |
1125 | goto err_exit; | 1124 | goto err_exit; |
1126 | 1125 | ||
@@ -1136,8 +1135,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
1136 | rq->next_rq->special = bidi_sdb; | 1135 | rq->next_rq->special = bidi_sdb; |
1137 | } | 1136 | } |
1138 | 1137 | ||
1139 | error = scsi_init_sgtable(rq->next_rq, rq->next_rq->special, | 1138 | error = scsi_init_sgtable(rq->next_rq, rq->next_rq->special); |
1140 | GFP_ATOMIC); | ||
1141 | if (error) | 1139 | if (error) |
1142 | goto err_exit; | 1140 | goto err_exit; |
1143 | } | 1141 | } |
@@ -1149,7 +1147,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
1149 | BUG_ON(prot_sdb == NULL); | 1147 | BUG_ON(prot_sdb == NULL); |
1150 | ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); | 1148 | ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); |
1151 | 1149 | ||
1152 | if (scsi_alloc_sgtable(prot_sdb, ivecs, gfp_mask, is_mq)) { | 1150 | if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) { |
1153 | error = BLKPREP_DEFER; | 1151 | error = BLKPREP_DEFER; |
1154 | goto err_exit; | 1152 | goto err_exit; |
1155 | } | 1153 | } |
@@ -1218,7 +1216,7 @@ static int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1218 | * submit a request without an attached bio. | 1216 | * submit a request without an attached bio. |
1219 | */ | 1217 | */ |
1220 | if (req->bio) { | 1218 | if (req->bio) { |
1221 | int ret = scsi_init_io(cmd, GFP_ATOMIC); | 1219 | int ret = scsi_init_io(cmd); |
1222 | if (unlikely(ret)) | 1220 | if (unlikely(ret)) |
1223 | return ret; | 1221 | return ret; |
1224 | } else { | 1222 | } else { |