Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <hch@infradead.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Yang Xiuwei and committed by
Jens Axboe
8da8df43 539d1b47

+1 -2
+1 -2
block/blk-map.c
··· 398 398 if (op_is_write(op)) 399 399 memcpy(page_address(page), p, bytes); 400 400 401 - if (bio_add_page(bio, page, bytes, 0) < bytes) 402 - break; 401 + __bio_add_page(bio, page, bytes, 0); 403 402 404 403 len -= bytes; 405 404 p += bytes;