From: ira.weiny@intel.com
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Ira Weiny" <ira.weiny@intel.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Dave Hansen" <dave.hansen@intel.com>,
"Matthew Wilcox" <willy@infradead.org>,
"Christoph Hellwig" <hch@infradead.org>,
"Dan Williams" <dan.j.williams@intel.com>,
"Al Viro" <viro@zeniv.linux.org.uk>,
"Eric Biggers" <ebiggers@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Patrik Jakobsson" <patrik.r.jakobsson@gmail.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"David Howells" <dhowells@redhat.com>, "Chris Mason" <clm@fb.com>,
"Josef Bacik" <josef@toxicpanda.com>,
"David Sterba" <dsterba@suse.com>,
"Steve French" <sfrench@samba.org>,
"Jaegeuk Kim" <jaegeuk@kernel.org>,
"Chao Yu" <yuchao0@huawei.com>,
"Nicolas Pitre" <nico@fluxnic.net>,
"Brian King" <brking@us.ibm.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Kirti Wankhede" <kwankhede@nvidia.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 13/17] drivers/target: Convert to mem*_page()
Date: Mon, 23 Nov 2020 22:07:51 -0800 [thread overview]
Message-ID: <20201124060755.1405602-14-ira.weiny@intel.com> (raw)
In-Reply-To: <20201124060755.1405602-1-ira.weiny@intel.com>
From: Ira Weiny <ira.weiny@intel.com>
Remove the kmap/mem*()/kunmap patter and use the new mem*_page()
functions.
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/target/target_core_rd.c | 6 ++----
drivers/target/target_core_transport.c | 10 +++-------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index bf936bbeccfe..30bf0fcae519 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -18,6 +18,7 @@
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/pagemap.h>
#include <scsi/scsi_proto.h>
#include <target/target_core_base.h>
@@ -117,7 +118,6 @@ static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *
sizeof(struct scatterlist));
struct page *pg;
struct scatterlist *sg;
- unsigned char *p;
while (total_sg_needed) {
unsigned int chain_entry = 0;
@@ -159,9 +159,7 @@ static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *
sg_assign_page(&sg[j], pg);
sg[j].length = PAGE_SIZE;
- p = kmap(pg);
- memset(p, init_payload, PAGE_SIZE);
- kunmap(pg);
+ memset_page(pg, init_payload, 0, PAGE_SIZE);
}
page_offset += sg_per_table;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index ff26ab0a5f60..4fec5c728344 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/ratelimit.h>
#include <linux/vmalloc.h>
+#include <linux/pagemap.h>
#include <asm/unaligned.h>
#include <net/sock.h>
#include <net/tcp.h>
@@ -1689,15 +1690,10 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
*/
if (!(se_cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) &&
se_cmd->data_direction == DMA_FROM_DEVICE) {
- unsigned char *buf = NULL;
if (sgl)
- buf = kmap(sg_page(sgl)) + sgl->offset;
-
- if (buf) {
- memset(buf, 0, sgl->length);
- kunmap(sg_page(sgl));
- }
+ memzero_page(sg_page(sgl), sgl->offset,
+ sgl->length);
}
rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count,
--
2.28.0.rc0.12.gb6a658bd00c9
next prev parent reply other threads:[~2020-11-24 6:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 6:07 [PATCH 00/17] kmap: Create mem*_page interfaces ira.weiny
2020-11-24 6:07 ` [PATCH 01/17] mm/highmem: Lift memcpy_[to|from]_page and memset_page to core ira.weiny
2020-11-24 14:19 ` Matthew Wilcox
2020-11-24 19:21 ` Ira Weiny
2020-11-24 20:20 ` Matthew Wilcox
[not found] ` <160648238432.10416.12405581766428273347@jlahtine-mobl.ger.corp.intel.com>
2020-11-27 13:20 ` Matthew Wilcox
[not found] ` <160672815223.3453.2374529656870007787@jlahtine-mobl.ger.corp.intel.com>
2020-12-03 18:25 ` Ira Weiny
2020-11-24 6:07 ` [PATCH 02/17] drivers/firmware_loader: Use new memcpy_[to|from]_page() ira.weiny
2020-11-24 6:07 ` [PATCH 03/17] drivers/gpu: Convert to mem*_page() ira.weiny
[not found] ` <160648211578.10416.3269409785516897908@jlahtine-mobl.ger.corp.intel.com>
2020-12-04 16:05 ` Ira Weiny
2020-12-04 22:33 ` Thomas Gleixner
2020-12-07 6:46 ` Ira Weiny
2020-12-07 16:19 ` Thomas Gleixner
2020-11-24 6:07 ` [PATCH 04/17] fs/afs: Convert to memzero_page() ira.weiny
2020-11-24 6:07 ` [PATCH 05/17] fs/btrfs: " ira.weiny
2020-11-24 14:12 ` David Sterba
2020-11-24 19:25 ` Ira Weiny
2020-11-24 6:07 ` [PATCH 06/17] fs/hfs: Convert to mem*_page() interface ira.weiny
2020-11-24 6:07 ` [PATCH 07/17] fs/cifs: Convert to memcpy_page() ira.weiny
2020-11-24 6:07 ` [PATCH 08/17] fs/hfsplus: Convert to mem*_page() ira.weiny
2020-11-24 6:07 ` [PATCH 09/17] fs/f2fs: Remove f2fs_copy_page() ira.weiny
2020-11-25 3:27 ` Chao Yu
2020-11-24 6:07 ` [PATCH 10/17] fs/freevxfs: Use memcpy_to_page() ira.weiny
2020-11-24 6:07 ` [PATCH 11/17] fs/reiserfs: Use memcpy_from_page() ira.weiny
2020-11-24 6:07 ` [PATCH 12/17] fs/cramfs: " ira.weiny
2020-11-24 15:20 ` Nicolas Pitre
2020-11-24 6:07 ` ira.weiny [this message]
2020-11-24 6:07 ` [PATCH 14/17] drivers/scsi: Use memcpy_to_page() ira.weiny
2020-11-24 6:07 ` [PATCH 15/17] drivers/staging: Use memcpy_to/from_page() ira.weiny
2020-11-24 6:07 ` [PATCH 16/17] lib: Use mempcy_to/from_page() ira.weiny
2020-11-24 6:07 ` [PATCH 17/17] samples: Use memcpy_to/from_page() ira.weiny
2020-12-04 10:18 ` [PATCH 04/17] fs/afs: Convert to memzero_page() David Howells
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=20201124060755.1405602-14-ira.weiny@intel.com \
--to=ira.weiny@intel.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=brking@us.ibm.com \
--cc=clm@fb.com \
--cc=dan.j.williams@intel.com \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@intel.com \
--cc=dhowells@redhat.com \
--cc=dsterba@suse.com \
--cc=ebiggers@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jaegeuk@kernel.org \
--cc=jani.nikula@linux.intel.com \
--cc=jglisse@redhat.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=josef@toxicpanda.com \
--cc=kwankhede@nvidia.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mcgrof@kernel.org \
--cc=nico@fluxnic.net \
--cc=patrik.r.jakobsson@gmail.com \
--cc=rodrigo.vivi@intel.com \
--cc=sfrench@samba.org \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=yuchao0@huawei.com \
/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).