bio_alloc never returns NULL when it can sleep.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Acked-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
 
        npg = min(npg, BIO_MAX_PAGES);
        bio = bio_alloc(GFP_NOIO, npg);
-       if (!bio && (current->flags & PF_MEMALLOC)) {
-               while (!bio && (npg /= 2))
-                       bio = bio_alloc(GFP_NOIO, npg);
-       }
-
        if (bio) {
                bio->bi_iter.bi_sector = disk_sector;
                bio_set_dev(bio, bdev);