dm-integrity: allocate the recalculate buffer with kmalloc

Allocate the recalculate buffer with kmalloc rather than vmalloc. This
will be needed later, for the simplification of the asynchronous hash
interface.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
Mikulas Patocka 2025-09-17 17:49:59 +02:00
parent 4b9197ed60
commit e7151e225c

View File

@ -2998,7 +2998,7 @@ static void integrity_recalc(struct work_struct *w)
unsigned recalc_sectors = RECALC_SECTORS;
retry:
recalc_buffer = __vmalloc(recalc_sectors << SECTOR_SHIFT, GFP_NOIO);
recalc_buffer = kmalloc(recalc_sectors << SECTOR_SHIFT, GFP_NOIO | __GFP_NOWARN);
if (!recalc_buffer) {
oom:
recalc_sectors >>= 1;
@ -3012,7 +3012,7 @@ static void integrity_recalc(struct work_struct *w)
recalc_tags_size += ic->internal_hash_digestsize - ic->tag_size;
recalc_tags = kvmalloc(recalc_tags_size, GFP_NOIO);
if (!recalc_tags) {
vfree(recalc_buffer);
kfree(recalc_buffer);
recalc_buffer = NULL;
goto oom;
}
@ -3078,7 +3078,7 @@ static void integrity_recalc(struct work_struct *w)
goto err;
io_req.bi_opf = REQ_OP_READ;
io_req.mem.type = DM_IO_VMA;
io_req.mem.type = DM_IO_KMEM;
io_req.mem.ptr.addr = recalc_buffer;
io_req.notify.fn = NULL;
io_req.client = ic->io;
@ -3136,7 +3136,7 @@ static void integrity_recalc(struct work_struct *w)
recalc_write_super(ic);
free_ret:
vfree(recalc_buffer);
kfree(recalc_buffer);
kvfree(recalc_tags);
}