All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: dm-devel@redhat.com
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Mike Snitzer <snitzer@redhat.com>,
	Alasdair Kergon <agk@redhat.com>,
	Ignat Korchagin <ignat@cloudflare.com>
Subject: [dm-devel] [PATCH 3/6] dm crypt: Add 'atomic' argument to kcryptd_crypt_read_convert()
Date: Sat, 13 Feb 2021 12:11:43 +0100	[thread overview]
Message-ID: <20210213111146.3080152-4-bigeasy@linutronix.de> (raw)
In-Reply-To: <20210213111146.3080152-1-bigeasy@linutronix.de>

kcryptd_crypt_read_convert() can be invoked from atomic context
(softirq/tasklet) and preemptible context (the workqueue).

Add an argument `atomic' to kcryptd_crypt_read_convert().
This argument can be passed to crypt_convert() replacing the test for
DM_CRYPT_NO_READ_WORKQUEUE.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/md/dm-crypt.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index a498de3604a67..f5eafc32d32c5 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -2120,7 +2120,7 @@ static void kcryptd_crypt_read_continue(struct work_struct *work)
 	crypt_dec_pending(io);
 }
 
-static void kcryptd_crypt_read_convert(struct dm_crypt_io *io)
+static void kcryptd_crypt_read_convert(struct dm_crypt_io *io, bool atomic)
 {
 	struct crypt_config *cc = io->cc;
 	blk_status_t r;
@@ -2130,8 +2130,7 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io)
 	crypt_convert_init(cc, &io->ctx, io->base_bio, io->base_bio,
 			   io->sector);
 
-	r = crypt_convert(cc, &io->ctx,
-			  test_bit(DM_CRYPT_NO_READ_WORKQUEUE, &cc->flags), true);
+	r = crypt_convert(cc, &io->ctx, atomic, true);
 	/*
 	 * Crypto API backlogged the request, because its queue was full
 	 * and we're in softirq context, so continue from a workqueue
@@ -2206,7 +2205,7 @@ static void kcryptd_crypt(struct work_struct *work)
 	struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work);
 
 	if (bio_data_dir(io->base_bio) == READ)
-		kcryptd_crypt_read_convert(io);
+		kcryptd_crypt_read_convert(io, false);
 	else
 		kcryptd_crypt_write_convert(io);
 }
@@ -2215,7 +2214,7 @@ static void kcryptd_crypt_tasklet(struct tasklet_struct *t)
 {
 	struct dm_crypt_io *io = from_tasklet(io, t, tasklet);
 
-	kcryptd_crypt_read_convert(io);
+	kcryptd_crypt_read_convert(io, true);
 }
 
 static void kcryptd_queue_crypt(struct dm_crypt_io *io)
-- 
2.30.0


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2021-02-17 15:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13 11:11 [dm-devel] [PATCH 0/6] dm crypt: Replace the usage of in_interrupt() Sebastian Andrzej Siewior
2021-02-13 11:11 ` [dm-devel] [PATCH 1/6] dm crypt: Use tasklet_setup() Sebastian Andrzej Siewior
2021-02-13 11:11 ` [dm-devel] [PATCH 2/6] dm crypt: Handle DM_CRYPT_NO_*_WORKQUEUE more explicit Sebastian Andrzej Siewior
2021-02-13 14:31   ` Ignat Korchagin
2021-03-11 18:25     ` Mike Snitzer
2021-03-11 21:28       ` Ignat Korchagin
2021-02-13 11:11 ` Sebastian Andrzej Siewior [this message]
2021-02-13 11:11 ` [dm-devel] [PATCH 4/6] dm crypt: Revisit the atomic argument passed to crypt_convert() Sebastian Andrzej Siewior
2021-02-13 14:52   ` Ignat Korchagin
2021-02-13 11:11 ` [dm-devel] [PATCH 5/6] dm crypt: Replace the in_interrupt() usage in crypt_convert() Sebastian Andrzej Siewior
2021-02-13 11:11 ` [dm-devel] [PATCH 6/6] dm crypt: Use `atomic' argument for memory allocation Sebastian Andrzej Siewior

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=20210213111146.3080152-4-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ignat@cloudflare.com \
    --cc=snitzer@redhat.com \
    --cc=tglx@linutronix.de \
    /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.