From: ira.weiny@intel.com
To: David Sterba <dsterba@suse.cz>
Cc: Ira Weiny <ira.weiny@intel.com>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 3/4] fs/btrfs: Use kmap_local_page() in __btrfsic_submit_bio()
Date: Tue, 16 Feb 2021 18:48:25 -0800 [thread overview]
Message-ID: <20210217024826.3466046-4-ira.weiny@intel.com> (raw)
In-Reply-To: <20210217024826.3466046-1-ira.weiny@intel.com>
From: Ira Weiny <ira.weiny@intel.com>
Again there is an array of pointers which must be unmapped in the correct
order.
Convert the kmap()'s to kmap_local_page() and adjust the unmapping
to work backwards through the unmapping loop.
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
fs/btrfs/check-integrity.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 6ff44e53814c..726eb894be8b 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2677,7 +2677,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
dev_state = btrfsic_dev_state_lookup(bio_dev(bio) + bio->bi_partno);
if (NULL != dev_state &&
(bio_op(bio) == REQ_OP_WRITE) && bio_has_data(bio)) {
- unsigned int i = 0;
+ int i = 0;
u64 dev_bytenr;
u64 cur_bytenr;
struct bio_vec bvec;
@@ -2702,7 +2702,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
bio_for_each_segment(bvec, bio, iter) {
BUG_ON(bvec.bv_len != PAGE_SIZE);
- mapped_datav[i] = kmap(bvec.bv_page);
+ mapped_datav[i] = kmap_local_page(bvec.bv_page);
i++;
if (dev_state->state->print_mask &
@@ -2715,8 +2715,8 @@ static void __btrfsic_submit_bio(struct bio *bio)
mapped_datav, segs,
bio, &bio_is_patched,
bio->bi_opf);
- bio_for_each_segment(bvec, bio, iter)
- kunmap(bvec.bv_page);
+ for (--i; i >= 0; i--)
+ kunmap_local(mapped_datav[i]);
kfree(mapped_datav);
} else if (NULL != dev_state && (bio->bi_opf & REQ_PREFLUSH)) {
if (dev_state->state->print_mask &
--
2.28.0.rc0.12.gb6a658bd00c9
next prev parent reply other threads:[~2021-02-17 2:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 2:48 [PATCH 0/4] btrfs: Convert more kmaps to kmap_local_page() ira.weiny
2021-02-17 2:48 ` [PATCH 1/4] fs/btrfs: Convert kmap to kmap_local_page() using coccinelle ira.weiny
2021-03-12 18:58 ` David Sterba
2021-03-12 20:03 ` Ira Weiny
2021-03-16 11:04 ` David Sterba
2021-02-17 2:48 ` [PATCH 2/4] fs/btrfs: Convert raid5/6 kmaps to kmap_local_page() ira.weiny
2021-03-12 19:26 ` David Sterba
2021-02-17 2:48 ` ira.weiny [this message]
2021-02-17 2:48 ` [PATCH 4/4] fs/btrfs: Convert block context kmap's " ira.weiny
2021-03-11 21:30 ` [PATCH 0/4] btrfs: Convert more kmaps " Ira Weiny
2021-03-12 19:41 ` David Sterba
2021-03-12 20:05 ` Ira Weiny
2021-03-16 11:07 ` David Sterba
2021-03-16 16:56 ` Ira Weiny
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=20210217024826.3466046-4-ira.weiny@intel.com \
--to=ira.weiny@intel.com \
--cc=clm@fb.com \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).