All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: Alasdair Kergon <agk@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH 4/9] rqdm core: clean up request cloning
Date: Fri, 16 Oct 2009 13:59:53 +0900	[thread overview]
Message-ID: <4AD7FDC9.3020805@ct.jp.nec.com> (raw)
In-Reply-To: <4AD7FC11.7030009@ct.jp.nec.com>

This patch factors out the request cloning code in dm_prep_fn()
as clone_rq().  No functional change.

This patch is a preparation for PATCH 9, which needs to make clones
from an original barrier request.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Alasdair G Kergon <agk@redhat.com>
---
 drivers/md/dm.c |   45 ++++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 17 deletions(-)

Index: 2.6.32-rc4/drivers/md/dm.c
===================================================================
--- 2.6.32-rc4.orig/drivers/md/dm.c
+++ 2.6.32-rc4/drivers/md/dm.c
@@ -1443,6 +1443,32 @@ static int setup_clone(struct request *c
 	return 0;
 }
 
+static struct request *clone_rq(struct request *rq, struct mapped_device *md,
+				gfp_t gfp_mask)
+{
+	struct request *clone;
+	struct dm_rq_target_io *tio;
+
+	tio = alloc_rq_tio(md, gfp_mask);
+	if (!tio)
+		return NULL;
+
+	tio->md = md;
+	tio->ti = NULL;
+	tio->orig = rq;
+	tio->error = 0;
+	memset(&tio->info, 0, sizeof(tio->info));
+
+	clone = &tio->clone;
+	if (setup_clone(clone, rq, tio)) {
+		/* -ENOMEM */
+		free_rq_tio(tio);
+		return NULL;
+	}
+
+	return clone;
+}
+
 static int dm_rq_flush_suspending(struct mapped_device *md)
 {
 	return !md->suspend_rq.special;
@@ -1454,7 +1480,6 @@ static int dm_rq_flush_suspending(struct
 static int dm_prep_fn(struct request_queue *q, struct request *rq)
 {
 	struct mapped_device *md = q->queuedata;
-	struct dm_rq_target_io *tio;
 	struct request *clone;
 
 	if (unlikely(rq == &md->suspend_rq)) {
@@ -1470,24 +1495,10 @@ static int dm_prep_fn(struct request_que
 		return BLKPREP_KILL;
 	}
 
-	tio = alloc_rq_tio(md, GFP_ATOMIC);
-	if (!tio)
-		/* -ENOMEM */
+	clone = clone_rq(rq, md, GFP_ATOMIC);
+	if (!clone)
 		return BLKPREP_DEFER;
 
-	tio->md = md;
-	tio->ti = NULL;
-	tio->orig = rq;
-	tio->error = 0;
-	memset(&tio->info, 0, sizeof(tio->info));
-
-	clone = &tio->clone;
-	if (setup_clone(clone, rq, tio)) {
-		/* -ENOMEM */
-		free_rq_tio(tio);
-		return BLKPREP_DEFER;
-	}
-
 	rq->special = clone;
 	rq->cmd_flags |= REQ_DONTPREP;
 

  parent reply	other threads:[~2009-10-16  4:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16  4:52 [PATCH 0/9] barrier support for request-based dm Kiyoshi Ueda
2009-10-16  4:55 ` [PATCH 1/9] dm core: clean up in-flight checking Kiyoshi Ueda
2009-10-19 21:16   ` Alasdair G Kergon
2009-10-20  7:47     ` Kiyoshi Ueda
2009-10-16  4:57 ` [PATCH 2/9] rqdm core: map_request() takes clone instead of orig Kiyoshi Ueda
2009-10-16  4:58 ` [PATCH 3/9] rqdm core: alloc_rq_tio() takes gfp_mask Kiyoshi Ueda
2009-10-16  4:59 ` Kiyoshi Ueda [this message]
2009-10-16  5:01 ` [PATCH 5/9] rqdm core: simplify suspend code Kiyoshi Ueda
2009-10-28 16:21   ` Alasdair G Kergon
2009-10-28 17:39   ` Alasdair G Kergon
2009-10-16  5:02 ` [PATCH 6/9] rqdm core: use md->pending for in_flight I/O counting Kiyoshi Ueda
2009-10-16  5:03 ` [PATCH 7/9] rqdm core: refactor completion functions Kiyoshi Ueda
2009-10-16  5:05 ` [PATCH 8/9] rqdm core: move dm_end_request() Kiyoshi Ueda
2009-10-16  5:06 ` [PATCH 9/9] rqdm core: add barrier support Kiyoshi Ueda
2009-10-16  5:17 ` Kiyoshi Ueda

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=4AD7FDC9.3020805@ct.jp.nec.com \
    --to=k-ueda@ct.jp.nec.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.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.