[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080422.225907.116124009.taka@valinux.co.jp>
Date: Tue, 22 Apr 2008 22:59:07 +0900 (JST)
From: Hirokazu Takahashi <taka@...inux.co.jp>
To: jens.axboe@...cle.com, agk@...rceware.org
Cc: dm-devel@...hat.com, linux-kernel@...r.kernel.org
Subject: [RFC][PATCH 9/10] I/O context inheritance
The packet writing module creates a bio in its own way, so its iocontext
should be set here.
This code hasn't been tested yet.
Signed-off-by: Hirokazu Takahashi <taka@...inux.co.jp>
--- linux-2.6.25.bio0/drivers/block/pktcdvd.c 2008-04-22 15:48:36.000000000 +0900
+++ linux-2.6.25/drivers/block/pktcdvd.c 2008-04-22 15:53:41.000000000 +0900
@@ -514,6 +514,7 @@ static void pkt_bio_finished(struct pktc
static void pkt_bio_destructor(struct bio *bio)
{
+ put_io_context(bio->bi_io_context);
kfree(bio->bi_io_vec);
kfree(bio);
}
@@ -522,6 +523,11 @@ static struct bio *pkt_bio_alloc(int nr_
{
struct bio_vec *bvl = NULL;
struct bio *bio;
+ struct io_context *ioc;
+
+ ioc = get_io_context(GFP_KERNEL, -1);
+ if (!ioc)
+ goto no_ioc;
bio = kmalloc(sizeof(struct bio), GFP_KERNEL);
if (!bio)
@@ -535,12 +541,15 @@ static struct bio *pkt_bio_alloc(int nr_
bio->bi_max_vecs = nr_iovecs;
bio->bi_io_vec = bvl;
bio->bi_destructor = pkt_bio_destructor;
+ bio->bi_io_context = ioc;
return bio;
no_bvl:
kfree(bio);
no_bio:
+ put_io_context(ioc);
+ no_ioc:
return NULL;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists