From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, bharrosh@panasas.com, linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 4/8] bio: actually inline inline bvecs into bio
Date: Wed, 1 Apr 2009 20:04:40 +0900 [thread overview]
Message-ID: <1238583884-13517-5-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1238583884-13517-1-git-send-email-tj@kernel.org>
Impact: cleanup
BIO_INLINE_VECS bvecs are inlined into bio to avoid bvec allocation
for small transfers. This was achieved by declaring zero sized bvec
array at the end of bio and allocating bio with extra bytes at the
end. As BIO_INLINE_VECS is constant, there is no reason to do this
allocation trick. This patch simply defines BIO_INLINE_VECS sized
bvec array at the end. This will help fixing bio_kmalloc().
Signed-off-by: Tejun Heo <tj@kernel.org>
---
fs/bio.c | 9 +--------
include/linux/bio.h | 9 +++++----
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/fs/bio.c b/fs/bio.c
index a040cde..7574839 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -31,12 +31,6 @@
DEFINE_TRACE(block_split);
-/*
- * Test patch to inline a certain number of bi_io_vec's inside the bio
- * itself, to shrink a bio data allocation from two mempool calls to one
- */
-#define BIO_INLINE_VECS 4
-
static mempool_t *bio_split_pool __read_mostly;
/*
@@ -1550,7 +1544,6 @@ void bioset_free(struct bio_set *bs)
*/
struct bio_set *bioset_create(unsigned int pool_size, unsigned int front_pad)
{
- unsigned int back_pad = BIO_INLINE_VECS * sizeof(struct bio_vec);
struct bio_set *bs;
bs = kzalloc(sizeof(*bs), GFP_KERNEL);
@@ -1559,7 +1552,7 @@ struct bio_set *bioset_create(unsigned int pool_size, unsigned int front_pad)
bs->front_pad = front_pad;
- bs->bio_slab = bio_find_or_create_slab(front_pad + back_pad);
+ bs->bio_slab = bio_find_or_create_slab(front_pad);
if (!bs->bio_slab) {
kfree(bs);
return NULL;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b05b1d4..14e5f42 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -40,6 +40,8 @@
#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
+#define BIO_INLINE_VECS 4
+
/*
* was unsigned short, but we might as well be ready for > 64kB I/O pages
*/
@@ -104,11 +106,10 @@ struct bio {
bio_destructor_t *bi_destructor; /* destructor */
/*
- * We can inline a number of vecs at the end of the bio, to avoid
- * double allocations for a small number of bio_vecs. This member
- * MUST obviously be kept at the very end of the bio.
+ * Inline small number of vecs in the bio to avoid double
+ * allocations for a small number of bio_vecs.
*/
- struct bio_vec bi_inline_vecs[0];
+ struct bio_vec bi_inline_vecs[BIO_INLINE_VECS];
};
/*
--
1.6.0.2
next prev parent reply other threads:[~2009-04-01 11:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-01 11:04 [GIT PATCHSET block#for-linus] block: blk-map related fixes Tejun Heo
2009-04-01 11:04 ` [PATCH 1/8] scatterlist: make sure sg_miter_next() doesn't return 0 sized mappings Tejun Heo
2009-04-01 11:04 ` [PATCH 2/8] block: fix SG_IO vector request data length handling Tejun Heo
2009-04-01 11:47 ` FUJITA Tomonori
2009-04-01 11:50 ` Jens Axboe
2009-04-01 12:18 ` FUJITA Tomonori
2009-04-01 12:24 ` Jens Axboe
2009-04-01 12:27 ` Tejun Heo
2009-04-01 12:29 ` Jens Axboe
2009-04-01 11:04 ` [PATCH 3/8] block: fix queue bounce limit setting Tejun Heo
2009-04-01 11:04 ` Tejun Heo [this message]
2009-04-01 12:47 ` [PATCH 4/8] bio: actually inline inline bvecs into bio Jens Axboe
2009-04-01 12:55 ` Tejun Heo
2009-04-01 12:59 ` Jens Axboe
2009-04-01 11:04 ` [PATCH 5/8] bio: fix bio_kmalloc() Tejun Heo
2009-04-01 11:04 ` [PATCH 6/8] bio: remove size/segments limit on bio_{copy|map}_{user|kern}*() Tejun Heo
2009-04-01 11:04 ` [PATCH 7/8] blk-map: let blk_rq_map_user_iov() support null mapping Tejun Heo
2009-04-01 11:54 ` FUJITA Tomonori
2009-04-01 12:03 ` Tejun Heo
2009-04-01 11:04 ` [PATCH 8/8] blk-map: reimplement blk_rq_map_user() using blk_rq_map_user_iov() Tejun Heo
2009-04-01 12:44 ` FUJITA Tomonori
2009-04-01 12:50 ` Tejun Heo
2009-04-01 12:59 ` FUJITA Tomonori
2009-04-01 13:03 ` Tejun Heo
2009-04-01 13:10 ` FUJITA Tomonori
2009-04-01 13:17 ` Tejun Heo
2009-04-01 13:18 ` Tejun Heo
2009-04-01 13:22 ` FUJITA Tomonori
2009-04-01 13:28 ` Tejun Heo
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=1238583884-13517-5-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=bharrosh@panasas.com \
--cc=linux-kernel@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: link
Be 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