All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Jeff Garzik <jeff@garzik.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Jens Axboe <jens.axboe@oracle.com>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-scs
Subject: [RFC B 2/2] libosd: Use of new blk_make_request
Date: Thu, 19 Mar 2009 16:31:41 +0200	[thread overview]
Message-ID: <49C2574D.6090401@panasas.com> (raw)
In-Reply-To: <49C254FD.7020202@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] Export new blk_make_request() which takes bio \
            and returns request

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 drivers/scsi/osd/osd_initiator.c |   33 +++++++++++----------------------
 1 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index ccfd347..66c3e92 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -1208,6 +1208,14 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or,
 /*
  * osd_finalize_request and helpers
  */
+struct request *_make_request(struct request_queue *q, bool has_write,
+			      struct bio *bio, gfp_t flags)
+{
+	if (bio)
+		return blk_make_request(q, bio, flags);
+	else
+		return blk_get_request(q, has_write ? WRITE : READ, flags);
+}
 
 static int _init_blk_request(struct osd_request *or,
 	bool has_in, bool has_out)
@@ -1218,7 +1226,8 @@ static int _init_blk_request(struct osd_request *or,
 	struct request *req;
 	int ret = -ENOMEM;
 
-	req = blk_get_request(q, has_out, flags);
+	req = _make_request(q, has_out, has_out ? or->out.bio : or->in.bio,
+			    flags);
 	if (!req)
 		goto out;
 
@@ -1233,7 +1242,7 @@ 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);
+			req = _make_request(q, false, or->in.bio, flags);
 			if (!req) {
 				OSD_DEBUG("blk_get_request for bidi failed\n");
 				goto out;
@@ -1279,26 +1288,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), or->out.req->data_len);
-	}
-	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), or->in.req->data_len);
-	}
-
 	or->out.pad_buff = sg_out_pad_buffer;
 	or->in.pad_buff = sg_in_pad_buffer;
 
-- 
1.6.2.1



  parent reply	other threads:[~2009-03-19 14:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19 14:21 [RFD] [PATCHSETS 0/2 0/2 0/5] Remove of blk_rq_append_bio usage Boaz Harrosh
2009-03-19 14:24 ` [PATCH A 1/2] allow blk_rq_map_kern to append to requests Boaz Harrosh
2009-03-19 14:27 ` [PATCH A 2/2] libosd: Use new blk_rq_map_kern Boaz Harrosh
2009-03-19 14:30 ` [RFC B 1/2] Export new blk_make_request() which takes bio and returns request Boaz Harrosh
2009-03-19 14:31 ` Boaz Harrosh [this message]
2009-03-19 14:33 ` [RFC C 1/5] blk_rq_map_pages() new API Boaz Harrosh
2009-03-19 14:34 ` [RFC C 2/5] libosd: Rename osd_req_write/read to osd_req_write/read_old Boaz Harrosh
2009-03-19 14:35 ` [RFC C 3/5] libosd: No bio for you Boaz Harrosh
2009-03-19 14:37 ` [RFC C 4/5] exofs: " Boaz Harrosh
2009-03-19 14:38 ` [RFC C 5/5] libosd: Remove deprecated bio based API 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=49C2574D.6090401@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jeff@garzik.org \
    --cc=jens.axboe@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.