aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/osd
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-05-17 11:58:41 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-19 06:14:56 -0400
commitc29b70f6ee4f2fa3ef07f55bc9082945861e5391 (patch)
tree5f030fe6468fbd9d6b5e95294aa7534effba4512 /drivers/scsi/osd
parent79eb63e9e5875b84341a3a05f8e6ae9cdb4bb6f6 (diff)
libosd: Use of new blk_make_request
Use new blk_make_request() to allocate a request from bio and avoid using deprecated blk_rq_append_bio(). This patch is dependent on a block layer patch titled: [BLOCK] New blk_make_request() takes bio returns request This is the last usage of blk_rq_append_bio in osd, it can now be un-exported. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> CC: Jeff Garzik <jeff@garzik.org> CC: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/osd')
-rw-r--r--drivers/scsi/osd/osd_initiator.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index bf66e301866f..865ec0f4aa80 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -1200,6 +1200,21 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or,
1200/* 1200/*
1201 * osd_finalize_request and helpers 1201 * osd_finalize_request and helpers
1202 */ 1202 */
1203static struct request *_make_request(struct request_queue *q, bool has_write,
1204 struct _osd_io_info *oii, gfp_t flags)
1205{
1206 if (oii->bio)
1207 return blk_make_request(q, oii->bio, flags);
1208 else {
1209 struct request *req;
1210
1211 req = blk_get_request(q, has_write ? WRITE : READ, flags);
1212 if (unlikely(!req))
1213 return ERR_PTR(-ENOMEM);
1214
1215 return req;
1216 }
1217}
1203 1218
1204static int _init_blk_request(struct osd_request *or, 1219static int _init_blk_request(struct osd_request *or,
1205 bool has_in, bool has_out) 1220 bool has_in, bool has_out)
@@ -1208,11 +1223,13 @@ static int _init_blk_request(struct osd_request *or,
1208 struct scsi_device *scsi_device = or->osd_dev->scsi_device; 1223 struct scsi_device *scsi_device = or->osd_dev->scsi_device;
1209 struct request_queue *q = scsi_device->request_queue; 1224 struct request_queue *q = scsi_device->request_queue;
1210 struct request *req; 1225 struct request *req;
1211 int ret = -ENOMEM; 1226 int ret;
1212 1227
1213 req = blk_get_request(q, has_out, flags); 1228 req = _make_request(q, has_out, has_out ? &or->out : &or->in, flags);
1214 if (!req) 1229 if (IS_ERR(req)) {
1230 ret = PTR_ERR(req);
1215 goto out; 1231 goto out;
1232 }
1216 1233
1217 or->request = req; 1234 or->request = req;
1218 req->cmd_type = REQ_TYPE_BLOCK_PC; 1235 req->cmd_type = REQ_TYPE_BLOCK_PC;
@@ -1225,9 +1242,10 @@ static int _init_blk_request(struct osd_request *or,
1225 or->out.req = req; 1242 or->out.req = req;
1226 if (has_in) { 1243 if (has_in) {
1227 /* allocate bidi request */ 1244 /* allocate bidi request */
1228 req = blk_get_request(q, READ, flags); 1245 req = _make_request(q, false, &or->in, flags);
1229 if (!req) { 1246 if (IS_ERR(req)) {
1230 OSD_DEBUG("blk_get_request for bidi failed\n"); 1247 OSD_DEBUG("blk_get_request for bidi failed\n");
1248 ret = PTR_ERR(req);
1231 goto out; 1249 goto out;
1232 } 1250 }
1233 req->cmd_type = REQ_TYPE_BLOCK_PC; 1251 req->cmd_type = REQ_TYPE_BLOCK_PC;
@@ -1271,26 +1289,6 @@ int osd_finalize_request(struct osd_request *or,
1271 return ret; 1289 return ret;
1272 } 1290 }
1273 1291
1274 if (or->out.bio) {
1275 ret = blk_rq_append_bio(or->request->q, or->out.req,
1276 or->out.bio);
1277 if (ret) {
1278 OSD_DEBUG("blk_rq_append_bio out failed\n");
1279 return ret;
1280 }
1281 OSD_DEBUG("out bytes=%llu (bytes_req=%u)\n",
1282 _LLU(or->out.total_bytes), blk_rq_bytes(or->out.req));
1283 }
1284 if (or->in.bio) {
1285 ret = blk_rq_append_bio(or->request->q, or->in.req, or->in.bio);
1286 if (ret) {
1287 OSD_DEBUG("blk_rq_append_bio in failed\n");
1288 return ret;
1289 }
1290 OSD_DEBUG("in bytes=%llu (bytes_req=%u)\n",
1291 _LLU(or->in.total_bytes), blk_rq_bytes(or->in.req));
1292 }
1293
1294 or->out.pad_buff = sg_out_pad_buffer; 1292 or->out.pad_buff = sg_out_pad_buffer;
1295 or->in.pad_buff = sg_in_pad_buffer; 1293 or->in.pad_buff = sg_in_pad_buffer;
1296 1294