From: Boaz Harrosh <bharrosh@panasas.com>
To: Jens Axboe <Jens.Axboe@oracle.com>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
linux-scsi <linux-scsi@vger.kernel.org>,
open-osd mailing-list <osd-dev@open-osd.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jeff Garzik <jeff@garzik.org>, Tejun Heo <tj@kernel.org>,
"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Subject: [PATCH 4/5] libosd: Use of new blk_make_request
Date: Sun, 17 May 2009 18:58:41 +0300 [thread overview]
Message-ID: <4A103431.908@panasas.com> (raw)
In-Reply-To: <4A1032B0.5000003@panasas.com>
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>
---
drivers/scsi/osd/osd_initiator.c | 48 ++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index bf66e30..865ec0f 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,
/*
* osd_finalize_request and helpers
*/
+static struct request *_make_request(struct request_queue *q, bool has_write,
+ struct _osd_io_info *oii, gfp_t flags)
+{
+ if (oii->bio)
+ return blk_make_request(q, oii->bio, flags);
+ else {
+ struct request *req;
+
+ req = blk_get_request(q, has_write ? WRITE : READ, flags);
+ if (unlikely(!req))
+ return ERR_PTR(-ENOMEM);
+
+ return req;
+ }
+}
static int _init_blk_request(struct osd_request *or,
bool has_in, bool has_out)
@@ -1208,11 +1223,13 @@ static int _init_blk_request(struct osd_request *or,
struct scsi_device *scsi_device = or->osd_dev->scsi_device;
struct request_queue *q = scsi_device->request_queue;
struct request *req;
- int ret = -ENOMEM;
+ int ret;
- req = blk_get_request(q, has_out, flags);
- if (!req)
+ req = _make_request(q, has_out, has_out ? &or->out : &or->in, flags);
+ if (IS_ERR(req)) {
+ ret = PTR_ERR(req);
goto out;
+ }
or->request = req;
req->cmd_type = REQ_TYPE_BLOCK_PC;
@@ -1225,9 +1242,10 @@ static int _init_blk_request(struct osd_request *or,
or->out.req = req;
if (has_in) {
/* allocate bidi request */
- req = blk_get_request(q, READ, flags);
- if (!req) {
+ req = _make_request(q, false, &or->in, flags);
+ if (IS_ERR(req)) {
OSD_DEBUG("blk_get_request for bidi failed\n");
+ ret = PTR_ERR(req);
goto out;
}
req->cmd_type = REQ_TYPE_BLOCK_PC;
@@ -1271,26 +1289,6 @@ int osd_finalize_request(struct osd_request *or,
return ret;
}
- if (or->out.bio) {
- ret = blk_rq_append_bio(or->request->q, or->out.req,
- or->out.bio);
- if (ret) {
- OSD_DEBUG("blk_rq_append_bio out failed\n");
- return ret;
- }
- OSD_DEBUG("out bytes=%llu (bytes_req=%u)\n",
- _LLU(or->out.total_bytes), blk_rq_bytes(or->out.req));
- }
- if (or->in.bio) {
- ret = blk_rq_append_bio(or->request->q, or->in.req, or->in.bio);
- if (ret) {
- OSD_DEBUG("blk_rq_append_bio in failed\n");
- return ret;
- }
- OSD_DEBUG("in bytes=%llu (bytes_req=%u)\n",
- _LLU(or->in.total_bytes), blk_rq_bytes(or->in.req));
- }
-
or->out.pad_buff = sg_out_pad_buffer;
or->in.pad_buff = sg_in_pad_buffer;
--
1.6.2.1
next prev parent reply other threads:[~2009-05-17 15:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-17 15:52 [patchset 0/5 version 2] osd: Stop usage of blk_rq_append_bio Boaz Harrosh
2009-05-17 15:55 ` [PATCH 1/5] allow blk_rq_map_kern to append to requests Boaz Harrosh
2009-05-17 15:56 ` [PATCH 2/5] libosd: Use new blk_rq_map_kern Boaz Harrosh
2009-05-17 15:57 ` [PATCH 3/5] New blk_make_request(), takes bio, returns a request Boaz Harrosh
2009-05-19 9:41 ` Jens Axboe
2009-05-19 10:07 ` Boaz Harrosh
2009-05-19 10:13 ` Jens Axboe
2009-05-19 12:27 ` Boaz Harrosh
2009-05-19 12:49 ` Jens Axboe
2009-05-19 13:33 ` Boaz Harrosh
2009-05-19 13:35 ` [PATCH version 2] " Boaz Harrosh
2009-05-19 17:53 ` Jens Axboe
2009-05-17 15:58 ` Boaz Harrosh [this message]
2009-05-17 16:00 ` [PATCH 5/5] Un-export blk_rq_append_bio Boaz Harrosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A103431.908@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=Jens.Axboe@oracle.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=jeff@garzik.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=osd-dev@open-osd.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).