mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-28 06:44:36 -05:00
dm-integrity: use bio_add_virt_nofail
Convert the __bio_add_page(..., virt_to_page(), ...) pattern to the bio_add_virt_nofail helper implementing it, and do the same for the similar pattern using bio_add_page for adding the first segment after a bio allocation as that can't fail either. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Link: https://lore.kernel.org/r/20250507120451.4000627-15-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
9134124ce1
commit
bd4e709b32
@@ -2557,14 +2557,8 @@ static void dm_integrity_inline_recheck(struct work_struct *w)
|
||||
char *mem;
|
||||
|
||||
outgoing_bio = bio_alloc_bioset(ic->dev->bdev, 1, REQ_OP_READ, GFP_NOIO, &ic->recheck_bios);
|
||||
|
||||
r = bio_add_page(outgoing_bio, virt_to_page(outgoing_data), ic->sectors_per_block << SECTOR_SHIFT, 0);
|
||||
if (unlikely(r != (ic->sectors_per_block << SECTOR_SHIFT))) {
|
||||
bio_put(outgoing_bio);
|
||||
bio->bi_status = BLK_STS_RESOURCE;
|
||||
bio_endio(bio);
|
||||
return;
|
||||
}
|
||||
bio_add_virt_nofail(outgoing_bio, outgoing_data,
|
||||
ic->sectors_per_block << SECTOR_SHIFT);
|
||||
|
||||
bip = bio_integrity_alloc(outgoing_bio, GFP_NOIO, 1);
|
||||
if (IS_ERR(bip)) {
|
||||
@@ -3211,7 +3205,8 @@ static void integrity_recalc_inline(struct work_struct *w)
|
||||
|
||||
bio = bio_alloc_bioset(ic->dev->bdev, 1, REQ_OP_READ, GFP_NOIO, &ic->recalc_bios);
|
||||
bio->bi_iter.bi_sector = ic->start + SB_SECTORS + range.logical_sector;
|
||||
__bio_add_page(bio, virt_to_page(recalc_buffer), range.n_sectors << SECTOR_SHIFT, offset_in_page(recalc_buffer));
|
||||
bio_add_virt_nofail(bio, recalc_buffer,
|
||||
range.n_sectors << SECTOR_SHIFT);
|
||||
r = submit_bio_wait(bio);
|
||||
bio_put(bio);
|
||||
if (unlikely(r)) {
|
||||
@@ -3228,7 +3223,8 @@ static void integrity_recalc_inline(struct work_struct *w)
|
||||
|
||||
bio = bio_alloc_bioset(ic->dev->bdev, 1, REQ_OP_WRITE, GFP_NOIO, &ic->recalc_bios);
|
||||
bio->bi_iter.bi_sector = ic->start + SB_SECTORS + range.logical_sector;
|
||||
__bio_add_page(bio, virt_to_page(recalc_buffer), range.n_sectors << SECTOR_SHIFT, offset_in_page(recalc_buffer));
|
||||
bio_add_virt_nofail(bio, recalc_buffer,
|
||||
range.n_sectors << SECTOR_SHIFT);
|
||||
|
||||
bip = bio_integrity_alloc(bio, GFP_NOIO, 1);
|
||||
if (unlikely(IS_ERR(bip))) {
|
||||
|
||||
Reference in New Issue
Block a user