diff options
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 | } |