summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2013-07-25 11:30:01 +0800
committerChanho Park <chanho61.park@samsung.com>2014-03-20 17:34:43 +0900
commitc5dc5adc4bbf4d02ca29c48502e4de9a7206bc73 (patch)
tree37e73437bbb0c40ecbfdbfb7d122aa8ac57df55d /fs
parent8e593235f62a9c6b7bf4a45a6871fcf56f00a039 (diff)
downloadlinux-3.10-c5dc5adc4bbf4d02ca29c48502e4de9a7206bc73.tar.gz
linux-3.10-c5dc5adc4bbf4d02ca29c48502e4de9a7206bc73.tar.bz2
linux-3.10-c5dc5adc4bbf4d02ca29c48502e4de9a7206bc73.zip
f2fs: move bio_private allocation out of f2fs_bio_alloc()
bio->bi_private is not always needed. As in the reading data path, end_read_io does not need bio_private for further using, so moving bio_private allocation out of f2fs_bio_alloc(). Alloc it in the submit_write_page(), and ignore it in the f2fs_readpage(). Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/data.c1
-rw-r--r--fs/f2fs/segment.c19
2 files changed, 11 insertions, 9 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index dc21f9e604a..317ef263cf7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -365,7 +365,6 @@ static void read_end_io(struct bio *bio, int err)
}
unlock_page(page);
} while (bvec >= bio->bi_io_vec);
- kfree(bio->bi_private);
bio_put(bio);
}
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index a86d125a988..9b74ae2137d 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -611,18 +611,12 @@ static void f2fs_end_io_write(struct bio *bio, int err)
struct bio *f2fs_bio_alloc(struct block_device *bdev, int npages)
{
struct bio *bio;
- struct bio_private *priv;
-retry:
- priv = kmalloc(sizeof(struct bio_private), GFP_NOFS);
- if (!priv) {
- cond_resched();
- goto retry;
- }
/* No failure on bio allocation */
bio = bio_alloc(GFP_NOIO, npages);
bio->bi_bdev = bdev;
- bio->bi_private = priv;
+ bio->bi_private = NULL;
+
return bio;
}
@@ -681,8 +675,17 @@ static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
do_submit_bio(sbi, type, false);
alloc_new:
if (sbi->bio[type] == NULL) {
+ struct bio_private *priv;
+retry:
+ priv = kmalloc(sizeof(struct bio_private), GFP_NOFS);
+ if (!priv) {
+ cond_resched();
+ goto retry;
+ }
+
sbi->bio[type] = f2fs_bio_alloc(bdev, max_hw_blocks(sbi));
sbi->bio[type]->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
+ sbi->bio[type]->bi_private = priv;
/*
* The end_io will be assigned at the sumbission phase.
* Until then, let bio_add_page() merge consecutive IOs as much