From patchwork Thu Mar 3 11:18:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767331 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E502933C7 for ; Thu, 3 Mar 2022 11:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QVVaIqgGyDnx9ueY7z/hzj3O9uq8fALFMD1DXm83SrU=; b=OOGFiYRrrPZgXxgrDmd0Ot5+++ J2ACUC7ZfBTAnB/yKwzsccoWtvqn3jk9jM8Kxj+XQ7PpfC7zK79z8grscIPB9Q5JO2ik15NUcjXg+ koSBXepexshcqqANRhAoZNg/u8pu9oN6bTTVoEa/V7QCZBlUOSthPFdVPX8r6KsrPN+9nycK9X3NL ucbuggOoCDs+VbIj1t5Zq6H1tHDnNC+KXv/DqZQhNi7iMDGfBgh0+7ytTharPyxZj5+2SRjOBEdkh xgI0DBTGQMtLVqu2G8rNjnMPAZkZhZcP1l6n8gtl2M01qs78nSKfQYzl4difO/6jtf+vCzKM2xQcG 2IJ34mXg==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjUS-006Bum-TO; Thu, 03 Mar 2022 11:19:25 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Date: Thu, 3 Mar 2022 14:18:56 +0300 Message-Id: <20220303111905.321089-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny Acked-by: Max Filippov --- arch/xtensa/platforms/iss/simdisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c index 8eb6ad1a3a1de..0f0e0724397f4 100644 --- a/arch/xtensa/platforms/iss/simdisk.c +++ b/arch/xtensa/platforms/iss/simdisk.c @@ -108,13 +108,13 @@ static void simdisk_submit_bio(struct bio *bio) sector_t sector = bio->bi_iter.bi_sector; bio_for_each_segment(bvec, bio, iter) { - char *buffer = kmap_atomic(bvec.bv_page) + bvec.bv_offset; + char *buffer = bvec_kmap_local(&bvec); unsigned len = bvec.bv_len >> SECTOR_SHIFT; simdisk_transfer(dev, sector, len, buffer, bio_data_dir(bio) == WRITE); sector += len; - kunmap_atomic(buffer); + kunmap_local(buffer); } bio_endio(bio); From patchwork Thu Mar 3 11:18:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767332 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFF1233C7 for ; Thu, 3 Mar 2022 11:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=UaLkM9d2e/Rtz8iJbPdrKJftE3tucWBaeY/oAyYvKbs=; b=q17kpGrSmWHzWFrYFzz3RSj0Ma ACac794xzvKoWj1VmHSwiQJtBODXCLZsUG4TdYCMYOtZKaQ0VI4dAsqq62XKOU98kJpXZaXxwTFeC YWfrjfy3HhAAARtX9VfXEnq/fN7SQ2cGN1rLTyNYkTYDLzRuIIFkMPuFMR2V+EL1wbI1RxbkzkGv7 SLax6LCSra7cCIWU9nev7pADx/K3i9uvk28MABKSbMBVI/nIu6CH/FVEPHlyE06Rej0c9K9au8TFU ANUrN0F5Wj0Bb/BHwqgfA10nBUrawNqdngkWo4c1cAW5gW2GlJoup63gRdfA7vZ0vtXc29PQtvXb5 mdM1M/bw==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjUd-006Bvp-Ce; Thu, 03 Mar 2022 11:19:37 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 02/10] aoe: use bvec_kmap_local in bvcpy Date: Thu, 3 Mar 2022 14:18:57 +0300 Message-Id: <20220303111905.321089-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig --- drivers/block/aoe/aoecmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index cc11f89a0928f..384073ef2323c 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -1018,9 +1018,9 @@ bvcpy(struct sk_buff *skb, struct bio *bio, struct bvec_iter iter, long cnt) iter.bi_size = cnt; __bio_for_each_segment(bv, bio, iter, iter) { - char *p = kmap_atomic(bv.bv_page) + bv.bv_offset; + char *p = bvec_kmap_local(&bv); skb_copy_bits(skb, soff, p, bv.bv_len); - kunmap_atomic(p); + kunmap_local(p); soff += bv.bv_len; } } From patchwork Thu Mar 3 11:18:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767333 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 835D733C7 for ; Thu, 3 Mar 2022 11:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=qKDDkq38t5t7teFveRqUDl+Yuvf3JhSHyxCuJ9t8v8g=; b=DG0x3wQnJDoLnEP3ZXI5Rj92Wy 1c/RgTh2sGTQ/3qcyDclSbBNUrYHu4iuZ/sgRuA9+vdnmXXD61thl+4pNkxCiPrR9xDd/XYqvyHaI ABnccZRZz/xQV/fnefV3nR5jSrk6hT6juMO1bqfjmNeas9EqXDu5uKuTYiqBaUtuPRskHrBxq90E/ As8KtCk86/vodC95KzroV1ZUGWN1miGRPhJiEVwUikEyrxfBlIJlRbQ64InjmFz5X1LaxbyWmR3d6 hcLNmo3tnvf9DeBmMeDYtuFEfbpuDR5bYq6sUAJVjD1LehFHA+GOaLMbLX92SZYZoqReepBIp9eI9 0yEScKyA==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjUk-006ByU-9U; Thu, 03 Mar 2022 11:19:43 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 03/10] zram: use memcpy_to_bvec in zram_bvec_read Date: Thu, 3 Mar 2022 14:18:58 +0300 Message-Id: <20220303111905.321089-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Use the proper helper instead of open coding the copy. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/block/zram/zram_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index a3a5e1e713268..14becdf2815df 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1331,12 +1331,10 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, goto out; if (is_partial_io(bvec)) { - void *dst = kmap_atomic(bvec->bv_page); void *src = kmap_atomic(page); - memcpy(dst + bvec->bv_offset, src + offset, bvec->bv_len); + memcpy_to_bvec(bvec, src + offset); kunmap_atomic(src); - kunmap_atomic(dst); } out: if (is_partial_io(bvec)) From patchwork Thu Mar 3 11:18:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767334 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22A7433C7 for ; Thu, 3 Mar 2022 11:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=dqHSTa5nX0hxYK3KYYVcQs7zhdjSLCR3fiKudpXZiV4=; b=Pllje23oI7gKtOYg1/Im2uld14 YiK+VQQ83xUEpBKZhxadR55eyks86GETAhyuy2eReyxklCCnmTPEAcoR4JPImPzXobOxxBZsd/Rup uoVPrUQ9M4HId0fA6B8PrwP7ljDm3tCg+LZucJSavE0crc05wpe7mYT6yLv0gLpRBXSFBzIs1Mu6i N4GxNEmjxvNkfeLI0U7nbus0rZudT+ShhqrlKnuZkrx7D3v2KODNlYaKYFjZeZejbjc/67P6vEYqp /aMq7sfBA+CFFR2WItLpK7ci5WI21oNMZCqgkDJOrvp/wEeAUOnZ9F+hZBMZ571GNU87SlCFiTHoB G4btDG2Q==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjUq-006C0F-1x; Thu, 03 Mar 2022 11:19:48 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 04/10] zram: use memcpy_from_bvec in zram_bvec_write Date: Thu, 3 Mar 2022 14:18:59 +0300 Message-Id: <20220303111905.321089-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Use memcpy_from_bvec instead of open coding the logic. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/block/zram/zram_drv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 14becdf2815df..e9474b02012de 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1465,7 +1465,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, { int ret; struct page *page = NULL; - void *src; struct bio_vec vec; vec = *bvec; @@ -1483,11 +1482,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, if (ret) goto out; - src = kmap_atomic(bvec->bv_page); dst = kmap_atomic(page); - memcpy(dst + offset, src + bvec->bv_offset, bvec->bv_len); + memcpy_from_bvec(dst + offset, bvec); kunmap_atomic(dst); - kunmap_atomic(src); vec.bv_page = page; vec.bv_len = PAGE_SIZE; From patchwork Thu Mar 3 11:19:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767335 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BD1833C7 for ; Thu, 3 Mar 2022 11:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=tYmKkYIu7zmzEunNhXdDRfJJ/EwgH0W1E2S7/DDX3UA=; b=GzbwebO0Roewyzk83YwKk9DagD zeUBlwlV1NkIxBPGBcb9H+3xjAgUPwtWvrWAQrcZ7pDP7/0WsBSFP94U07wVtXBNVAZoo31JdUOuK wrnY1bO3fJrr6Qyojb57a3lSdNJSe1afocW5UiNmzZGRZMkhnmtxgZz/Fy/RHP2rwj9iviJfAEhJu TVq6pGMWjhGf9KLJDM3TYsXlNC0KLDY1d2980KLZOkECVZe9XYnu59UmljGI2x2vUzKcY7qY2YXy1 g99dwHsVeZXILZEYM1/IyAEhM9wqdKY7mnt/+Te5e6J+QI+EYavoK+8zlfTaYxkTsiJ6A+ofiAWP3 1CocIhVA==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjUt-006C1X-Ge; Thu, 03 Mar 2022 11:19:52 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 05/10] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Date: Thu, 3 Mar 2022 14:19:00 +0300 Message-Id: <20220303111905.321089-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/nvdimm/blk.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c index c1db43524d755..0a38738335941 100644 --- a/drivers/nvdimm/blk.c +++ b/drivers/nvdimm/blk.c @@ -88,10 +88,9 @@ static int nd_blk_rw_integrity(struct nd_namespace_blk *nsblk, */ cur_len = min(len, bv.bv_len); - iobuf = kmap_atomic(bv.bv_page); - err = ndbr->do_io(ndbr, dev_offset, iobuf + bv.bv_offset, - cur_len, rw); - kunmap_atomic(iobuf); + iobuf = bvec_kmap_local(&bv); + err = ndbr->do_io(ndbr, dev_offset, iobuf, cur_len, rw); + kunmap_local(iobuf); if (err) return err; From patchwork Thu Mar 3 11:19:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767336 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C636D33C7 for ; Thu, 3 Mar 2022 11:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=f0NF498hDCrz75r99TeO+EjHW8Kl3t4Al355uemFwlc=; b=RVOdlleVMmPeGVGcENHOikaH2i 7Mg7a3r5ZsNimKQNjNjUdz+dBEvY74g/2YuUfrhXXeY82u0nOJh5dqnSvZ7MjAkpeuzfafD4K8nrH nUhYYmYoW8+owYQfnl2namiS43Flj/gA7fD1HW2ssydHjwNvxfgQYFE9oh7yZzgr1yqUxVbFO1Qa4 QG4EdejeAkiXorKBxaeO0u0z7IesuDHtskS2ha5fI6q/sdOuUZ3H+A9Ag3/1UiGxFCz9KduewFgBz H5faGUBrRUw8xfeUWUdQlveadnRzGWgx688uz514t7O7ywyCkE44R+rL3Iq4E6fy3KjUbvP932vA7 vQ+9OTiw==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjV0-006C3h-15; Thu, 03 Mar 2022 11:19:58 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Date: Thu, 3 Mar 2022 14:19:01 +0300 Message-Id: <20220303111905.321089-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/nvdimm/btt.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index cbd994f7f1fe6..9613e54c7a675 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -1163,17 +1163,15 @@ static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip, */ cur_len = min(len, bv.bv_len); - mem = kmap_atomic(bv.bv_page); + mem = bvec_kmap_local(&bv); if (rw) - ret = arena_write_bytes(arena, meta_nsoff, - mem + bv.bv_offset, cur_len, + ret = arena_write_bytes(arena, meta_nsoff, mem, cur_len, NVDIMM_IO_ATOMIC); else - ret = arena_read_bytes(arena, meta_nsoff, - mem + bv.bv_offset, cur_len, + ret = arena_read_bytes(arena, meta_nsoff, mem, cur_len, NVDIMM_IO_ATOMIC); - kunmap_atomic(mem); + kunmap_local(mem); if (ret) return ret; From patchwork Thu Mar 3 11:19:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767337 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E33F33C7 for ; Thu, 3 Mar 2022 11:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=9LmFtcgb40JuUqIFxAg6N2ciwS2XlpmGEkX88V9dA/4=; b=cyEyOWbBSKHt7zZgnBMQeyhZmY GRrNUMR1Ail8shG/vV4JSi23yHq2lyquEbZa3SPOCsB11vdUeF0JniSn/v/jVfam3l9vq5t6WYS1b Jg9O9UUy+m5LWCQK3pNUY8Exr5MzS2lYG4CVlk3b5GiC17EA48ll7i1WqNZbzGdFdISliqac2Dg1w UNg2ATUjIcWikV/cyYq4GzjWCrPoe1JeTLIn9Oimp7ikGJHW0v5wV7TsYjDRj6cCpWGh73TqPAqK2 IqwIoF6ijPqaIx6tBZT6QmcfdOL2XpKIz3kPkxJnChwR4XF+f+O9z/pdzOMxoPqir44zpTM6aeahd yW6Tn8FQ==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjV7-006C6F-GQ; Thu, 03 Mar 2022 11:20:06 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum Date: Thu, 3 Mar 2022 14:19:02 +0300 Message-Id: <20220303111905.321089-8-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny Acked-by: Coly Li --- drivers/md/bcache/request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 6869e010475a3..fdd0194f84dd0 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k) uint64_t csum = 0; bio_for_each_segment(bv, bio, iter) { - void *d = kmap(bv.bv_page) + bv.bv_offset; + void *d = bvec_kmap_local(&bv); csum = crc64_be(csum, d, bv.bv_len); - kunmap(bv.bv_page); + kunmap_local(d); } k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1); From patchwork Thu Mar 3 11:19:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767338 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 107F433C7 for ; Thu, 3 Mar 2022 11:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=jwQ8EMek85Vv3Kxcg6RZE3A0yhPrWq7YuU+GB1UR/fc=; b=a0w5wMhnV2cAkl4jBAoeIc/lvE RM2lW8parEdSKE3bhF38pyGY1TAesz3WERdXg+/tbwDWKI24aMa3z4mLe7db7FQFF2V5HnN3ZKh4E VpezJuV3vAQC20v5kv17fpLTeYYWA2+Rt/AlcwGZsQ8MsW9MMsJUjIKPcks0BCC3gAIjZtj+sNKyL pRhllO7VZoDCVHscPgjWm2gyaIxVCxrby/j/UVqvhC5HMpmFRFAll9t7ejJJt/nlv+X6BCGw2Musx BAiaU1DI/JnZXbYu8cgvbAAo/zsJG2qihgIRU/Hnecjga3hynK2ki+1XN/sHc8FPIBviY4hN4Z5vX dqWuGtzA==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjVB-006C8B-MV; Thu, 03 Mar 2022 11:20:10 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 08/10] drbd: use bvec_kmap_local in drbd_csum_bio Date: Thu, 3 Mar 2022 14:19:03 +0300 Message-Id: <20220303111905.321089-9-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/block/drbd/drbd_worker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index a5e04b38006b6..1b48c8172a077 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c @@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest) bio_for_each_segment(bvec, bio, iter) { u8 *src; - src = kmap_atomic(bvec.bv_page); - crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len); - kunmap_atomic(src); + src = bvec_kmap_local(&bvec); + crypto_shash_update(desc, src, bvec.bv_len); + kunmap_local(src); /* REQ_OP_WRITE_SAME has only one segment, * checksum the payload only once. */ From patchwork Thu Mar 3 11:19:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767339 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 271B033C7 for ; Thu, 3 Mar 2022 11:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=1PbY60Phtoi1DvWprfMXBrYqK+NCzi4RENOw/dfI4PI=; b=YlO3RPX2kxJY+x+Lbkhkq34TO5 vNSwmSwgeA1zmVqwHGNWRG5ZkUrWsVXSJRWDyewx5UuerjaZzN8oTc+himKl/rMt9fkLcgz26QzTi TLxlOEPHS0DJrNEQqBMBu2THcaVI2KVDbu7ZnbRuo/LjHrifYGYlgOILJ6RdPfuePb3lDGvWKZCyX 7lRrrSbUg1yMMM3QUAgCNq9z25q7+z1KJ42BLqq+pEByEzjM5Tjkf2YxZPbxPXCuSFw1w6TOjZ5BG AyDd7NRKvhMrLRALcSZ8U2ccwAumBi8fCuDfaXx145syBhhbulouP3WDASaM9hIsx9VKVSmGV5+/q fgr+6LcA==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjVF-006C9Y-Me; Thu, 03 Mar 2022 11:20:14 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 09/10] drbd: use bvec_kmap_local in recv_dless_read Date: Thu, 3 Mar 2022 14:19:04 +0300 Message-Id: <20220303111905.321089-10-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/block/drbd/drbd_receiver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 04e3ec12d8b49..fa00cf2ea9529 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -2017,10 +2017,10 @@ static int recv_dless_read(struct drbd_peer_device *peer_device, struct drbd_req D_ASSERT(peer_device->device, sector == bio->bi_iter.bi_sector); bio_for_each_segment(bvec, bio, iter) { - void *mapped = kmap(bvec.bv_page) + bvec.bv_offset; + void *mapped = bvec_kmap_local(&bvec); expect = min_t(int, data_size, bvec.bv_len); err = drbd_recv_all_warn(peer_device->connection, mapped, expect); - kunmap(bvec.bv_page); + kunmap_local(mapped); if (err) return err; data_size -= expect; From patchwork Thu Mar 3 11:19:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12767340 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA2D233C7 for ; Thu, 3 Mar 2022 11:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Ss0aqO+LCHTJbh8lRYeCKR0T6gWpPWKe33M5LaRso80=; b=KQp48Ew8u2NsZnCrLX/iHBqpFy daDEOxZ2iyqjxtxGT8ctF47MZV9nd6quauQG6A+2v9x0jXgo7/z57eE/IoeiksJ8EevmXLprAFdM+ PiKIz/F0GQEMdQ6PKkBgE2BeIMrMNcXga9eaCw5NaiCus3OWsiM+na4feR9uVAYde0NmabEM5gfTN P7o2VkzNfn1IaNdKRFfxbESxWSW+H436TUOFTrWNVh77C7yW8p8iYV0poutCkdV1fsc9lIes31JHt kShVvs81GfeVlLvagBtC01Zkua8ly2L04xIVI/gZyJ5WgSFa8gYoaDcrv/zovlbC8L0AUGUmiDPTb 82BCAUYA==; Received: from [91.93.38.115] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPjVK-006CBG-P1; Thu, 03 Mar 2022 11:20:20 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Chris Zankel , Max Filippov , Justin Sanders , Philipp Reisner , Lars Ellenberg , Denis Efremov , Minchan Kim , Nitin Gupta , Coly Li , Dan Williams , Vishal Verma , Ira Weiny , linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev Subject: [PATCH 10/10] floppy: use memcpy_{to,from}_bvec Date: Thu, 3 Mar 2022 14:19:05 +0300 Message-Id: <20220303111905.321089-11-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220303111905.321089-1-hch@lst.de> References: <20220303111905.321089-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Use the helpers instead of open coding them. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- drivers/block/floppy.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 19c2d0327e157..8c647532e3ce9 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -2485,11 +2485,9 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) } if (CT(raw_cmd->cmd[COMMAND]) == FD_READ) - memcpy_to_page(bv.bv_page, bv.bv_offset, dma_buffer, - size); + memcpy_to_bvec(&bv, dma_buffer); else - memcpy_from_page(dma_buffer, bv.bv_page, bv.bv_offset, - size); + memcpy_from_bvec(dma_buffer, &bv); remaining -= size; dma_buffer += size;