]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dm-integrity: allocate the recalculate buffer with kmalloc
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 17 Sep 2025 15:49:59 +0000 (17:49 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 23 Sep 2025 12:50:56 +0000 (14:50 +0200)
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>
drivers/md/dm-integrity.c

index b7bfcb79b19a4a405fd79e7d65e77b95e8bff4f7..ed119e3f574eb1a3074ff3d45db2319eab4c1100 100644 (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 @@ oom:
                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 @@ next_chunk:
                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 @@ unlock_ret:
        recalc_write_super(ic);
 
 free_ret:
-       vfree(recalc_buffer);
+       kfree(recalc_buffer);
        kvfree(recalc_tags);
 }