All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Harald Freudenberger <freude@linux.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Biggers <ebiggers@kernel.org>,
	dengler@linux.ibm.com, linux-s390@vger.kernel.org,
	dm-devel@lists.linux.dev, ifranzki@linux.ibm.com, agk@redhat.com,
	snitzer@kernel.org, gmazyland@gmail.com,
	Mikulas Patocka <mpatocka@redhat.com>
Subject: [PATCH 4/7] dm-integrity: allocate the recalculate buffer with kmalloc
Date: Tue, 26 Aug 2025 16:36:50 +0200	[thread overview]
Message-ID: <20250826143946.002151840@debian4.vm> (raw)
In-Reply-To: 20250826143646.570314717@debian4.vm

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 |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c	2025-08-21 18:22:55.000000000 +0200
+++ linux-2.6/drivers/md/dm-integrity.c	2025-08-21 18:22:55.000000000 +0200
@@ -2998,7 +2998,7 @@ static void integrity_recalc(struct work
 	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);
 }
 


  parent reply	other threads:[~2025-08-26 14:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 14:36 [PATCH 0/7] dm-integrity asynchronous hash patches Mikulas Patocka
2025-08-26 14:36 ` [PATCH 1/7] dm-integrity: use internal variable for digestsize Mikulas Patocka
2025-08-26 14:36 ` [PATCH 2/7] dm-integrity: replace bvec_kmap_local with kmap_local_page Mikulas Patocka
2025-08-26 14:36 ` [PATCH 3/7] dm-integrity: introduce integrity_kmap and integrity_kunmap Mikulas Patocka
2025-08-26 14:36 ` Mikulas Patocka [this message]
2025-08-26 14:36 ` [PATCH 5/7] dm-integrity: add the "offset" argument Mikulas Patocka
2025-08-26 14:36 ` [PATCH 6/7] dm-integrity: rename internal_hash Mikulas Patocka
2025-08-26 14:36 ` [PATCH 7/7] dm-integrity: enable asynchronous hash interface Mikulas Patocka
  -- strict thread matches above, loose matches on Subject: below --
2025-08-26 13:54 [PATCH 0/7] dm-integrity asynchronous hash patches Mikulas Patocka
2025-08-26 13:54 ` [PATCH 4/7] dm-integrity: allocate the recalculate buffer with kmalloc Mikulas Patocka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250826143946.002151840@debian4.vm \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dengler@linux.ibm.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=freude@linux.ibm.com \
    --cc=gmazyland@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ifranzki@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.