Skip to content

Commit 7d8d0c6

Browse files
Christoph Hellwigaxboe
authored andcommitted
xen-blkback: bio_alloc can't fail if it is allow to sleep
Remove handling of NULL returns from sleeping bio_alloc calls given that those can't fail. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d7b78de commit 7d8d0c6

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

drivers/block/xen-blkback/blkback.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,6 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13271327
seg[i].nsec << 9,
13281328
seg[i].offset) == 0)) {
13291329
bio = bio_alloc(GFP_KERNEL, bio_max_segs(nseg - i));
1330-
if (unlikely(bio == NULL))
1331-
goto fail_put_bio;
1332-
13331330
biolist[nbio++] = bio;
13341331
bio_set_dev(bio, preq.bdev);
13351332
bio->bi_private = pending_req;
@@ -1346,9 +1343,6 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13461343
BUG_ON(operation_flags != REQ_PREFLUSH);
13471344

13481345
bio = bio_alloc(GFP_KERNEL, 0);
1349-
if (unlikely(bio == NULL))
1350-
goto fail_put_bio;
1351-
13521346
biolist[nbio++] = bio;
13531347
bio_set_dev(bio, preq.bdev);
13541348
bio->bi_private = pending_req;
@@ -1381,14 +1375,6 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13811375
free_req(ring, pending_req);
13821376
msleep(1); /* back off a bit */
13831377
return -EIO;
1384-
1385-
fail_put_bio:
1386-
for (i = 0; i < nbio; i++)
1387-
bio_put(biolist[i]);
1388-
atomic_set(&pending_req->pendcnt, 1);
1389-
__end_block_io_op(pending_req, BLK_STS_RESOURCE);
1390-
msleep(1); /* back off a bit */
1391-
return -EIO;
13921378
}
13931379

13941380

0 commit comments

Comments
 (0)