linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 4/4] fs/btrfs: Convert block context kmap's to kmap_local_page()
Date: Tue, 16 Feb 2021 18:48:26 -0800	[thread overview]
Message-ID: <20210217024826.3466046-5-ira.weiny@intel.com> (raw)
In-Reply-To: <20210217024826.3466046-1-ira.weiny@intel.com>

From: Ira Weiny <ira.weiny@intel.com>

btrfsic_read_block() (which calls kmap()) and
btrfsic_release_block_ctx() (which calls kunmap()) are always called
within a single thread of execution.

Therefore the mappings created within these calls can be a thread local
mapping.

Convert the kmap() of bloc_ctx->pagev to kmap_local_page().  Luckily the
unmap loops backwards through the array pointer so no adjustment needs
to be made to the unmapping order.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 fs/btrfs/check-integrity.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 726eb894be8b..1ff9e19508a7 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -1558,7 +1558,7 @@ static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx)
 		while (num_pages > 0) {
 			num_pages--;
 			if (block_ctx->datav[num_pages]) {
-				kunmap(block_ctx->pagev[num_pages]);
+				kunmap_local(block_ctx->datav[num_pages]);
 				block_ctx->datav[num_pages] = NULL;
 			}
 			if (block_ctx->pagev[num_pages]) {
@@ -1637,7 +1637,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
 		i = j;
 	}
 	for (i = 0; i < num_pages; i++)
-		block_ctx->datav[i] = kmap(block_ctx->pagev[i]);
+		block_ctx->datav[i] = kmap_local_page(block_ctx->pagev[i]);
 
 	return block_ctx->len;
 }
-- 
2.28.0.rc0.12.gb6a658bd00c9


  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 " 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 ` [PATCH 3/4] fs/btrfs: Use kmap_local_page() in __btrfsic_submit_bio() ira.weiny
2021-02-17  2:48 ` ira.weiny [this message]
2021-03-11 21:30 ` [PATCH 0/4] btrfs: Convert more kmaps to kmap_local_page() 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-5-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 \
    --subject='Re: [PATCH 4/4] fs/btrfs: Convert block context kmap'\''s to kmap_local_page()' \
    /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

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).