From: Yang Shi <shy828301@gmail.com>
To: mgorman@techsingularity.net, agk@redhat.com, snitzer@kernel.org,
dm-devel@redhat.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [v2 PATCH 4/5] md: dm-crypt: move crypt_free_buffer_pages ahead
Date: Tue, 14 Feb 2023 11:02:20 -0800 [thread overview]
Message-ID: <20230214190221.1156876-5-shy828301@gmail.com> (raw)
In-Reply-To: <20230214190221.1156876-1-shy828301@gmail.com>
With moving crypt_free_buffer_pages() before crypt_alloc_buffer(), we
don't need an extra declaration anymore.
Signed-off-by: Yang Shi <shy828301@gmail.com>
---
drivers/md/dm-crypt.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 2653516bcdef..73069f200cc5 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1639,7 +1639,17 @@ static blk_status_t crypt_convert(struct crypt_config *cc,
return 0;
}
-static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone);
+
+static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone)
+{
+ struct bio_vec *bv;
+ struct bvec_iter_all iter_all;
+
+ bio_for_each_segment_all(bv, clone, iter_all) {
+ BUG_ON(!bv->bv_page);
+ mempool_free(bv->bv_page, &cc->page_pool);
+ }
+}
/*
* Generate a new unfragmented bio with the given size
@@ -1707,17 +1717,6 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
return clone;
}
-static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone)
-{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
-
- bio_for_each_segment_all(bv, clone, iter_all) {
- BUG_ON(!bv->bv_page);
- mempool_free(bv->bv_page, &cc->page_pool);
- }
-}
-
static void crypt_io_init(struct dm_crypt_io *io, struct crypt_config *cc,
struct bio *bio, sector_t sector)
{
--
2.39.0
next prev parent reply other threads:[~2023-02-14 19:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 19:02 [v2 PATCH 0/5] Introduce mempool pages bulk allocator and use it in dm-crypt Yang Shi
2023-02-14 19:02 ` [v2 PATCH 1/5] mm: page_alloc: add API for bulk allocator with callback Yang Shi
2023-02-14 19:02 ` [v2 PATCH 2/5] mm: mempool: extract the common initialization and alloc code Yang Shi
2023-02-14 19:02 ` [v2 PATCH 3/5] mm: mempool: introduce page bulk allocator Yang Shi
2023-02-15 3:16 ` kernel test robot
2023-02-14 19:02 ` Yang Shi [this message]
2023-02-14 19:02 ` [v2 PATCH 5/5] md: dm-crypt: use mempool " Yang Shi
2023-02-15 12:23 ` [dm-devel] [v2 PATCH 0/5] Introduce mempool pages bulk allocator and use it in dm-crypt Mikulas Patocka
2023-02-15 20:00 ` Yang Shi
2023-02-16 17:45 ` Mikulas Patocka
2023-02-16 21:49 ` Yang Shi
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=20230214190221.1156876-5-shy828301@gmail.com \
--to=shy828301@gmail.com \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dm-devel@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox