Commit 5d2ca213 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

nfs/blocklayout: remove bl_alloc_init_bio

bio_alloc will never fail when it can sleep.  Remove the now simple
bl_alloc_init_bio helper and open code it in the only caller.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220124091107.642561-4-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f0d91192
......@@ -115,23 +115,6 @@ bl_submit_bio(struct bio *bio)
return NULL;
}
static struct bio *bl_alloc_init_bio(unsigned int npg,
struct block_device *bdev, sector_t disk_sector,
bio_end_io_t end_io, struct parallel_io *par)
{
struct bio *bio;
npg = bio_max_segs(npg);
bio = bio_alloc(GFP_NOIO, npg);
if (bio) {
bio->bi_iter.bi_sector = disk_sector;
bio_set_dev(bio, bdev);
bio->bi_end_io = end_io;
bio->bi_private = par;
}
return bio;
}
static bool offset_in_map(u64 offset, struct pnfs_block_dev_map *map)
{
return offset >= map->start && offset < map->start + map->len;
......@@ -171,10 +154,11 @@ do_add_page_to_bio(struct bio *bio, int npg, int rw, sector_t isect,
retry:
if (!bio) {
bio = bl_alloc_init_bio(npg, map->bdev,
disk_addr >> SECTOR_SHIFT, end_io, par);
if (!bio)
return ERR_PTR(-ENOMEM);
bio = bio_alloc(GFP_NOIO, bio_max_segs(npg));
bio->bi_iter.bi_sector = disk_addr >> SECTOR_SHIFT;
bio_set_dev(bio, map->bdev);
bio->bi_end_io = end_io;
bio->bi_private = par;
bio_set_op_attrs(bio, rw, 0);
}
if (bio_add_page(bio, page, *len, offset) < *len) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment