Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176545
b: refs/heads/master
c: 6facdaf
h: refs/heads/master
i:
  176543: b941878
v: v3
  • Loading branch information
Kiyoshi Ueda authored and Alasdair G Kergon committed Dec 10, 2009
1 parent 72bfaca commit cb0eaac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0888564393a1277ce2d0564d819e1bcff1120343
refs/heads/master: 6facdaff229f2b25d0de82be9be99b9f562e72ba
45 changes: 28 additions & 17 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,32 @@ static int setup_clone(struct request *clone, struct request *rq,
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;
Expand All @@ -1456,7 +1482,6 @@ static int dm_rq_flush_suspending(struct mapped_device *md)
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)) {
Expand All @@ -1472,24 +1497,10 @@ static int dm_prep_fn(struct request_queue *q, struct request *rq)
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;

Expand Down

0 comments on commit cb0eaac

Please sign in to comment.