diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2013-07-24 23:30:01 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-07-30 02:17:03 -0400 |
commit | d8207f69589c74037128ff6c9e1a44223fad3b7c (patch) | |
tree | 12c968310ef5bb8a71ba68dd9d2bade99d06cc79 /fs/f2fs | |
parent | 60ed9a0f53c55d4be3882f7522e8349a5011a1d5 (diff) |
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/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 1 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 19 |
2 files changed, 11 insertions, 9 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c73c394c3d8c..19cd7c6e964c 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) | |||
365 | } | 365 | } |
366 | unlock_page(page); | 366 | unlock_page(page); |
367 | } while (bvec >= bio->bi_io_vec); | 367 | } while (bvec >= bio->bi_io_vec); |
368 | kfree(bio->bi_private); | ||
369 | bio_put(bio); | 368 | bio_put(bio); |
370 | } | 369 | } |
371 | 370 | ||
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a86d125a9885..9b74ae2137d1 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) | |||
611 | struct bio *f2fs_bio_alloc(struct block_device *bdev, int npages) | 611 | struct bio *f2fs_bio_alloc(struct block_device *bdev, int npages) |
612 | { | 612 | { |
613 | struct bio *bio; | 613 | struct bio *bio; |
614 | struct bio_private *priv; | ||
615 | retry: | ||
616 | priv = kmalloc(sizeof(struct bio_private), GFP_NOFS); | ||
617 | if (!priv) { | ||
618 | cond_resched(); | ||
619 | goto retry; | ||
620 | } | ||
621 | 614 | ||
622 | /* No failure on bio allocation */ | 615 | /* No failure on bio allocation */ |
623 | bio = bio_alloc(GFP_NOIO, npages); | 616 | bio = bio_alloc(GFP_NOIO, npages); |
624 | bio->bi_bdev = bdev; | 617 | bio->bi_bdev = bdev; |
625 | bio->bi_private = priv; | 618 | bio->bi_private = NULL; |
619 | |||
626 | return bio; | 620 | return bio; |
627 | } | 621 | } |
628 | 622 | ||
@@ -681,8 +675,17 @@ static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page, | |||
681 | do_submit_bio(sbi, type, false); | 675 | do_submit_bio(sbi, type, false); |
682 | alloc_new: | 676 | alloc_new: |
683 | if (sbi->bio[type] == NULL) { | 677 | if (sbi->bio[type] == NULL) { |
678 | struct bio_private *priv; | ||
679 | retry: | ||
680 | priv = kmalloc(sizeof(struct bio_private), GFP_NOFS); | ||
681 | if (!priv) { | ||
682 | cond_resched(); | ||
683 | goto retry; | ||
684 | } | ||
685 | |||
684 | sbi->bio[type] = f2fs_bio_alloc(bdev, max_hw_blocks(sbi)); | 686 | sbi->bio[type] = f2fs_bio_alloc(bdev, max_hw_blocks(sbi)); |
685 | sbi->bio[type]->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); | 687 | sbi->bio[type]->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); |
688 | sbi->bio[type]->bi_private = priv; | ||
686 | /* | 689 | /* |
687 | * The end_io will be assigned at the sumbission phase. | 690 | * The end_io will be assigned at the sumbission phase. |
688 | * Until then, let bio_add_page() merge consecutive IOs as much | 691 | * Until then, let bio_add_page() merge consecutive IOs as much |