Skip to content

Commit 8da8df4

Browse files
Yang Xiuweiaxboe
authored andcommitted
block: use __bio_add_page in bio_copy_kern
Since the bio is allocated with the exact number of pages needed via blk_rq_map_bio_alloc(), and the loop iterates exactly that many times, bio_add_page() cannot fail due to insufficient space. Switch to __bio_add_page() and remove the dead error handling code. Suggested-by: Christoph Hellwig <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Yang Xiuwei <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 539d1b4 commit 8da8df4

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

block/blk-map.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ static struct bio *bio_copy_kern(struct request *rq, void *data, unsigned int le
398398
if (op_is_write(op))
399399
memcpy(page_address(page), p, bytes);
400400

401-
if (bio_add_page(bio, page, bytes, 0) < bytes)
402-
break;
401+
__bio_add_page(bio, page, bytes, 0);
403402

404403
len -= bytes;
405404
p += bytes;

0 commit comments

Comments
 (0)