LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> To: jens.axboe@oracle.com, agk@redhat.com, James.Bottomley@HansenPartnership.com Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, dm-devel@redhat.com, j-nomura@ce.jp.nec.com, k-ueda@ct.jp.nec.com Subject: [PATCH 08/13] dm: add kmem_cache for request-based dm Date: Fri, 12 Sep 2008 10:45:23 -0400 (EDT) [thread overview] Message-ID: <20080912.104523.07457895.k-ueda@ct.jp.nec.com> (raw) In-Reply-To: <20080912.103814.74754581.k-ueda@ct.jp.nec.com> This patch prepares some kmem_cache for request-based dm. 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 files changed, 44 insertions(+), 1 deletion(-) Index: 2.6.27-rc6/drivers/md/dm.c =================================================================== --- 2.6.27-rc6.orig/drivers/md/dm.c +++ 2.6.27-rc6/drivers/md/dm.c @@ -32,6 +32,7 @@ static unsigned int _major = 0; static DEFINE_SPINLOCK(_minor_lock); /* + * For bio based dm. * One of these is allocated per bio. */ struct dm_io { @@ -43,6 +44,7 @@ struct dm_io { }; /* + * For bio based dm. * One of these is allocated per target within a bio. Hopefully * this will be simplified out one day. */ @@ -52,6 +54,31 @@ struct dm_target_io { union map_info info; }; +/* + * For request based dm. + * One of these is allocated per request. + * + * Since assuming "original request : cloned request = 1 : 1" and + * a counter for number of clones like struct dm_io.io_count isn't needed, + * struct dm_io and struct target_io can be merged. + */ +struct dm_rq_target_io { + struct mapped_device *md; + struct dm_target *ti; + struct request *orig, clone; + int error; + union map_info info; +}; + +/* + * For request based dm. + * One of these is allocated per bio. + */ +struct dm_clone_bio_info { + struct bio *orig; + struct request *rq; +}; + union map_info *dm_get_mapinfo(struct bio *bio) { if (bio && bio->bi_private) @@ -147,6 +174,8 @@ struct mapped_device { #define MIN_IOS 256 static struct kmem_cache *_io_cache; static struct kmem_cache *_tio_cache; +static struct kmem_cache *_rq_tio_cache; +static struct kmem_cache *_bio_info_cache; static int __init local_init(void) { @@ -162,9 +191,17 @@ static int __init local_init(void) if (!_tio_cache) goto out_free_io_cache; + _rq_tio_cache = KMEM_CACHE(dm_rq_target_io, 0); + if (!_rq_tio_cache) + goto out_free_tio_cache; + + _bio_info_cache = KMEM_CACHE(dm_clone_bio_info, 0); + if (!_bio_info_cache) + goto out_free_rq_tio_cache; + r = dm_uevent_init(); if (r) - goto out_free_tio_cache; + goto out_free_bio_info_cache; _major = major; r = register_blkdev(_major, _name); @@ -178,6 +215,10 @@ static int __init local_init(void) out_uevent_exit: dm_uevent_exit(); +out_free_bio_info_cache: + kmem_cache_destroy(_bio_info_cache); +out_free_rq_tio_cache: + kmem_cache_destroy(_rq_tio_cache); out_free_tio_cache: kmem_cache_destroy(_tio_cache); out_free_io_cache: @@ -188,6 +229,8 @@ out_free_io_cache: static void local_exit(void) { + kmem_cache_destroy(_bio_info_cache); + kmem_cache_destroy(_rq_tio_cache); kmem_cache_destroy(_tio_cache); kmem_cache_destroy(_io_cache); unregister_blkdev(_major, _name);
next prev parent reply other threads:[~2008-09-12 14:44 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-09-12 14:38 [PATCH 00/13] request-based dm-multipath Kiyoshi Ueda 2008-09-12 14:40 ` [PATCH 01/13] block: add request update interface Kiyoshi Ueda 2008-09-12 14:41 ` [PATCH 02/13] block: add request submission interface Kiyoshi Ueda 2008-09-14 13:10 ` Boaz Harrosh 2008-09-16 16:06 ` Kiyoshi Ueda 2008-09-16 17:02 ` Jens Axboe 2008-09-16 18:12 ` Kiyoshi Ueda 2008-09-12 14:42 ` [PATCH 03/13] mm: lld busy status exporting interface Kiyoshi Ueda 2008-09-12 14:43 ` [PATCH 04/13] scsi: exports busy status Kiyoshi Ueda 2008-09-12 14:43 ` [PATCH 05/13] block: add a queue flag for request stacking support Kiyoshi Ueda 2008-09-12 14:44 ` [PATCH 06/13] dm: remove unused DM_WQ_FLUSH_ALL Kiyoshi Ueda 2008-09-12 14:44 ` [PATCH 07/13] dm: tidy local_init Kiyoshi Ueda 2008-09-12 14:45 ` Kiyoshi Ueda [this message] 2008-09-12 14:45 ` [PATCH 09/13] dm: add target interfaces for request-based dm Kiyoshi Ueda 2008-09-12 14:46 ` [PATCH 10/13] dm: add core functions " Kiyoshi Ueda 2008-10-24 7:44 ` [dm-devel] " Nikanth K 2008-10-28 16:00 ` Kiyoshi Ueda [not found] ` <490FB852.3FEE.00C5.1@novell.com> [not found] ` <49102C03020000C50002E257@victor.provo.novell.com> 2008-11-04 15:01 ` Kiyoshi Ueda 2008-09-12 14:46 ` [PATCH 11/13] dm: enable " Kiyoshi Ueda 2008-10-24 7:52 ` [dm-devel] " Nikanth K 2008-10-28 16:02 ` Kiyoshi Ueda 2008-09-12 14:46 ` [PATCH 12/13] dm: reject I/O violating new queue limits Kiyoshi Ueda 2008-09-12 14:47 ` [PATCH 13/13] dm-mpath: convert to request-based Kiyoshi Ueda 2008-10-24 7:55 ` [dm-devel] " Nikanth K 2008-10-28 16:03 ` Kiyoshi Ueda 2008-09-14 13:17 ` [PATCH 00/13] request-based dm-multipath Jens Axboe
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=20080912.104523.07457895.k-ueda@ct.jp.nec.com \ --to=k-ueda@ct.jp.nec.com \ --cc=James.Bottomley@HansenPartnership.com \ --cc=agk@redhat.com \ --cc=dm-devel@redhat.com \ --cc=j-nomura@ce.jp.nec.com \ --cc=jens.axboe@oracle.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.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: linkBe 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).