Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758427AbYFGE7W (ORCPT ); Sat, 7 Jun 2008 00:59:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752625AbYFGE5r (ORCPT ); Sat, 7 Jun 2008 00:57:47 -0400 Received: from jaguar.mkp.net ([192.139.46.146]:38416 "EHLO jaguar.mkp.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751590AbYFGE5n (ORCPT ); Sat, 7 Jun 2008 00:57:43 -0400 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PATCH 2 of 7] block: Globalize bio_set and bio_vec_slab X-Mercurial-Node: 550d61001baa70aebab7c8a80aee9748f3138714 Message-Id: <550d61001baa70aebab7.1212814535@sermon.lab.mkp.net> In-Reply-To: Date: Sat, 07 Jun 2008 00:55:35 -0400 From: "Martin K. Petersen" To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3296 Lines: 119 2 files changed, 38 insertions(+), 28 deletions(-) fs/bio.c | 36 ++++++++---------------------------- include/linux/bio.h | 30 ++++++++++++++++++++++++++++++ Move struct bio_set and biovec_slab definitions to bio.h so they can be used outside of bio.c. Signed-off-by: Martin K. Petersen --- diff -r fb6f53e13ff3 -r 550d61001baa fs/bio.c --- a/fs/bio.c Sat Jun 07 00:45:14 2008 -0400 +++ b/fs/bio.c Sat Jun 07 00:45:14 2008 -0400 @@ -28,24 +28,9 @@ #include #include /* for struct sg_iovec */ -#define BIO_POOL_SIZE 2 - static struct kmem_cache *bio_slab __read_mostly; -#define BIOVEC_NR_POOLS 6 - -/* - * a small number of entries is fine, not going to be performance critical. - * basically we just need to survive - */ -#define BIO_SPLIT_ENTRIES 2 mempool_t *bio_split_pool __read_mostly; - -struct biovec_slab { - int nr_vecs; - char *name; - struct kmem_cache *slab; -}; /* * if you change this list, also change bvec_alloc or things will @@ -60,23 +45,18 @@ #undef BV /* - * bio_set is used to allow other portions of the IO system to - * allocate their own private memory pools for bio and iovec structures. - * These memory pools in turn all allocate from the bio_slab - * and the bvec_slabs[]. - */ -struct bio_set { - mempool_t *bio_pool; - mempool_t *bvec_pools[BIOVEC_NR_POOLS]; -}; - -/* * fs_bio_set is the bio_set containing bio and iovec memory pools used by * IO code that does not need private memory pools. */ -static struct bio_set *fs_bio_set; +struct bio_set *fs_bio_set; -static inline struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) +inline int bvec_nr_vecs(int idx) +{ + return bvec_slabs[idx].nr_vecs; +} +EXPORT_SYMBOL(bvec_nr_vecs); + +struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct bio_set *bs) { struct bio_vec *bvl; diff -r fb6f53e13ff3 -r 550d61001baa include/linux/bio.h --- a/include/linux/bio.h Sat Jun 07 00:45:14 2008 -0400 +++ b/include/linux/bio.h Sat Jun 07 00:45:14 2008 -0400 @@ -333,6 +333,36 @@ int, int); extern int bio_uncopy_user(struct bio *); void zero_fill_bio(struct bio *bio); +extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); +extern inline int bvec_nr_vecs(int idx); + +/* + * bio_set is used to allow other portions of the IO system to + * allocate their own private memory pools for bio and iovec structures. + * These memory pools in turn all allocate from the bio_slab + * and the bvec_slabs[]. + */ +#define BIO_POOL_SIZE 2 +#define BIOVEC_NR_POOLS 6 + +struct bio_set { + mempool_t *bio_pool; + mempool_t *bvec_pools[BIOVEC_NR_POOLS]; +}; + +struct biovec_slab { + int nr_vecs; + char *name; + struct kmem_cache *slab; +}; + +extern struct bio_set *fs_bio_set; + +/* + * a small number of entries is fine, not going to be performance critical. + * basically we just need to survive + */ +#define BIO_SPLIT_ENTRIES 2 #ifdef CONFIG_HIGHMEM /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/