summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSubhash Peddamallu <subhash.peddamallu@gmail.com>2009-02-16 10:27:07 +0100
committerJens Axboe <jens.axboe@oracle.com>2009-02-18 10:32:01 +0100
commita60e78e57a17d55bbd5a96da16fe9649d364b987 (patch)
tree5b7a7c5977ee8862166f743d1aede56278c4971b /fs
parentblock: fix bad definition of BIO_RW_SYNC (diff)
downloadlinux-a60e78e57a17d55bbd5a96da16fe9649d364b987.tar.xz
linux-a60e78e57a17d55bbd5a96da16fe9649d364b987.zip
fs/bio: bio_alloc_bioset: pass right object ptr to mempool_free
When freeing from bio pool use right ptr to account for bs->front_pad, instead of bio ptr, Signed-off-by: Subhash Peddamallu <subhash.peddamallu@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 062299acbccd..72ab251cdb9c 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -302,9 +302,10 @@ void bio_init(struct bio *bio)
struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
{
struct bio *bio = NULL;
+ void *p;
if (bs) {
- void *p = mempool_alloc(bs->bio_pool, gfp_mask);
+ p = mempool_alloc(bs->bio_pool, gfp_mask);
if (p)
bio = p + bs->front_pad;
@@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
}
if (unlikely(!bvl)) {
if (bs)
- mempool_free(bio, bs->bio_pool);
+ mempool_free(p, bs->bio_pool);
else
kfree(bio);
bio = NULL;