diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2012-12-08 00:53:40 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-10 23:43:44 -0500 |
commit | c212991a6bc3ba120d41205a294c5b89f05f1535 (patch) | |
tree | 1078feaea977a2af0ea6da47c0aec342c2272207 /fs/f2fs | |
parent | d08ab08d140de247eb812ce2c3c4b323620e4609 (diff) |
f2fs: rewrite f2fs_bio_alloc to make it simpler
Since, GFP_NOFS(__GFP_WAIT) is used for allocation requests of bio in f2fs.
So, there is no chance of returning NULL from the BIO allocation.
Making the bio allocation routine for f2fs simpler.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/segment.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 969df1a30d1c..8894b399770d 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -647,28 +647,18 @@ struct bio *f2fs_bio_alloc(struct block_device *bdev, sector_t first_sector, | |||
647 | int nr_vecs, gfp_t gfp_flags) | 647 | int nr_vecs, gfp_t gfp_flags) |
648 | { | 648 | { |
649 | struct bio *bio; | 649 | struct bio *bio; |
650 | repeat: | 650 | |
651 | /* allocate new bio */ | 651 | /* allocate new bio */ |
652 | bio = bio_alloc(gfp_flags, nr_vecs); | 652 | bio = bio_alloc(gfp_flags, nr_vecs); |
653 | 653 | ||
654 | if (bio == NULL && (current->flags & PF_MEMALLOC)) { | 654 | bio->bi_bdev = bdev; |
655 | while (!bio && (nr_vecs /= 2)) | 655 | bio->bi_sector = first_sector; |
656 | bio = bio_alloc(gfp_flags, nr_vecs); | ||
657 | } | ||
658 | if (bio) { | ||
659 | bio->bi_bdev = bdev; | ||
660 | bio->bi_sector = first_sector; | ||
661 | retry: | 656 | retry: |
662 | bio->bi_private = kmalloc(sizeof(struct bio_private), | 657 | bio->bi_private = kmalloc(sizeof(struct bio_private), |
663 | GFP_NOFS | __GFP_HIGH); | 658 | GFP_NOFS | __GFP_HIGH); |
664 | if (!bio->bi_private) { | 659 | if (!bio->bi_private) { |
665 | cond_resched(); | ||
666 | goto retry; | ||
667 | } | ||
668 | } | ||
669 | if (bio == NULL) { | ||
670 | cond_resched(); | 660 | cond_resched(); |
671 | goto repeat; | 661 | goto retry; |
672 | } | 662 | } |
673 | return bio; | 663 | return bio; |
674 | } | 664 | } |