diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-12 11:02:03 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-12 11:02:03 -0400 |
commit | 82681a318f9f028ea64e61f24bbd9ac535531921 (patch) | |
tree | 529b6a5b4fd040fb54b7672b1a224ebd47445876 /drivers/scsi/osd | |
parent | 3860c97bd60a4525bb62eb90e3e7d2f02662ac59 (diff) | |
parent | 8ebf975608aaebd7feb33d77f07ba21a6380e086 (diff) |
[SCSI] Merge branch 'linus'
Conflicts:
drivers/message/fusion/mptsas.c
fixed up conflict between req->data_len accessors and mptsas driver updates.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/osd')
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 72 |
1 files changed, 25 insertions, 47 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index 71341ad32344..7a117c18114c 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -921,26 +921,6 @@ int osd_req_add_set_attr_list(struct osd_request *or, | |||
921 | } | 921 | } |
922 | EXPORT_SYMBOL(osd_req_add_set_attr_list); | 922 | EXPORT_SYMBOL(osd_req_add_set_attr_list); |
923 | 923 | ||
924 | static int _append_map_kern(struct request *req, | ||
925 | void *buff, unsigned len, gfp_t flags) | ||
926 | { | ||
927 | struct bio *bio; | ||
928 | int ret; | ||
929 | |||
930 | bio = bio_map_kern(req->q, buff, len, flags); | ||
931 | if (IS_ERR(bio)) { | ||
932 | OSD_ERR("Failed bio_map_kern(%p, %d) => %ld\n", buff, len, | ||
933 | PTR_ERR(bio)); | ||
934 | return PTR_ERR(bio); | ||
935 | } | ||
936 | ret = blk_rq_append_bio(req->q, req, bio); | ||
937 | if (ret) { | ||
938 | OSD_ERR("Failed blk_rq_append_bio(%p) => %d\n", bio, ret); | ||
939 | bio_put(bio); | ||
940 | } | ||
941 | return ret; | ||
942 | } | ||
943 | |||
944 | static int _req_append_segment(struct osd_request *or, | 924 | static int _req_append_segment(struct osd_request *or, |
945 | unsigned padding, struct _osd_req_data_segment *seg, | 925 | unsigned padding, struct _osd_req_data_segment *seg, |
946 | struct _osd_req_data_segment *last_seg, struct _osd_io_info *io) | 926 | struct _osd_req_data_segment *last_seg, struct _osd_io_info *io) |
@@ -956,14 +936,14 @@ static int _req_append_segment(struct osd_request *or, | |||
956 | else | 936 | else |
957 | pad_buff = io->pad_buff; | 937 | pad_buff = io->pad_buff; |
958 | 938 | ||
959 | ret = _append_map_kern(io->req, pad_buff, padding, | 939 | ret = blk_rq_map_kern(io->req->q, io->req, pad_buff, padding, |
960 | or->alloc_flags); | 940 | or->alloc_flags); |
961 | if (ret) | 941 | if (ret) |
962 | return ret; | 942 | return ret; |
963 | io->total_bytes += padding; | 943 | io->total_bytes += padding; |
964 | } | 944 | } |
965 | 945 | ||
966 | ret = _append_map_kern(io->req, seg->buff, seg->total_bytes, | 946 | ret = blk_rq_map_kern(io->req->q, io->req, seg->buff, seg->total_bytes, |
967 | or->alloc_flags); | 947 | or->alloc_flags); |
968 | if (ret) | 948 | if (ret) |
969 | return ret; | 949 | return ret; |
@@ -1324,6 +1304,21 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or, | |||
1324 | /* | 1304 | /* |
1325 | * osd_finalize_request and helpers | 1305 | * osd_finalize_request and helpers |
1326 | */ | 1306 | */ |
1307 | static struct request *_make_request(struct request_queue *q, bool has_write, | ||
1308 | struct _osd_io_info *oii, gfp_t flags) | ||
1309 | { | ||
1310 | if (oii->bio) | ||
1311 | return blk_make_request(q, oii->bio, flags); | ||
1312 | else { | ||
1313 | struct request *req; | ||
1314 | |||
1315 | req = blk_get_request(q, has_write ? WRITE : READ, flags); | ||
1316 | if (unlikely(!req)) | ||
1317 | return ERR_PTR(-ENOMEM); | ||
1318 | |||
1319 | return req; | ||
1320 | } | ||
1321 | } | ||
1327 | 1322 | ||
1328 | static int _init_blk_request(struct osd_request *or, | 1323 | static int _init_blk_request(struct osd_request *or, |
1329 | bool has_in, bool has_out) | 1324 | bool has_in, bool has_out) |
@@ -1332,11 +1327,13 @@ static int _init_blk_request(struct osd_request *or, | |||
1332 | struct scsi_device *scsi_device = or->osd_dev->scsi_device; | 1327 | struct scsi_device *scsi_device = or->osd_dev->scsi_device; |
1333 | struct request_queue *q = scsi_device->request_queue; | 1328 | struct request_queue *q = scsi_device->request_queue; |
1334 | struct request *req; | 1329 | struct request *req; |
1335 | int ret = -ENOMEM; | 1330 | int ret; |
1336 | 1331 | ||
1337 | req = blk_get_request(q, has_out, flags); | 1332 | req = _make_request(q, has_out, has_out ? &or->out : &or->in, flags); |
1338 | if (!req) | 1333 | if (IS_ERR(req)) { |
1334 | ret = PTR_ERR(req); | ||
1339 | goto out; | 1335 | goto out; |
1336 | } | ||
1340 | 1337 | ||
1341 | or->request = req; | 1338 | or->request = req; |
1342 | req->cmd_type = REQ_TYPE_BLOCK_PC; | 1339 | req->cmd_type = REQ_TYPE_BLOCK_PC; |
@@ -1351,9 +1348,10 @@ static int _init_blk_request(struct osd_request *or, | |||
1351 | or->out.req = req; | 1348 | or->out.req = req; |
1352 | if (has_in) { | 1349 | if (has_in) { |
1353 | /* allocate bidi request */ | 1350 | /* allocate bidi request */ |
1354 | req = blk_get_request(q, READ, flags); | 1351 | req = _make_request(q, false, &or->in, flags); |
1355 | if (!req) { | 1352 | if (IS_ERR(req)) { |
1356 | OSD_DEBUG("blk_get_request for bidi failed\n"); | 1353 | OSD_DEBUG("blk_get_request for bidi failed\n"); |
1354 | ret = PTR_ERR(req); | ||
1357 | goto out; | 1355 | goto out; |
1358 | } | 1356 | } |
1359 | req->cmd_type = REQ_TYPE_BLOCK_PC; | 1357 | req->cmd_type = REQ_TYPE_BLOCK_PC; |
@@ -1398,26 +1396,6 @@ int osd_finalize_request(struct osd_request *or, | |||
1398 | return ret; | 1396 | return ret; |
1399 | } | 1397 | } |
1400 | 1398 | ||
1401 | if (or->out.bio) { | ||
1402 | ret = blk_rq_append_bio(or->request->q, or->out.req, | ||
1403 | or->out.bio); | ||
1404 | if (ret) { | ||
1405 | OSD_DEBUG("blk_rq_append_bio out failed\n"); | ||
1406 | return ret; | ||
1407 | } | ||
1408 | OSD_DEBUG("out bytes=%llu (bytes_req=%u)\n", | ||
1409 | _LLU(or->out.total_bytes), or->out.req->data_len); | ||
1410 | } | ||
1411 | if (or->in.bio) { | ||
1412 | ret = blk_rq_append_bio(or->request->q, or->in.req, or->in.bio); | ||
1413 | if (ret) { | ||
1414 | OSD_DEBUG("blk_rq_append_bio in failed\n"); | ||
1415 | return ret; | ||
1416 | } | ||
1417 | OSD_DEBUG("in bytes=%llu (bytes_req=%u)\n", | ||
1418 | _LLU(or->in.total_bytes), or->in.req->data_len); | ||
1419 | } | ||
1420 | |||
1421 | or->out.pad_buff = sg_out_pad_buffer; | 1399 | or->out.pad_buff = sg_out_pad_buffer; |
1422 | or->in.pad_buff = sg_in_pad_buffer; | 1400 | or->in.pad_buff = sg_in_pad_buffer; |
1423 | 1401 | ||