From patchwork Mon Jan 30 09:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A23DC54EAA for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BD7A6B0072; Mon, 30 Jan 2023 04:24:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 56E346B0073; Mon, 30 Jan 2023 04:24:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40E906B0074; Mon, 30 Jan 2023 04:24:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 319016B0072 for ; Mon, 30 Jan 2023 04:24:00 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 046411A0311 for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) X-FDA: 80410928640.26.8C2F3F6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf25.hostedemail.com (Postfix) with ESMTP id D024FA000F for ; Mon, 30 Jan 2023 09:23:53 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xOHsjob9; spf=none (imf25.hostedemail.com: domain of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070634; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mraJ0dlvK0XwWYXGT0DcPLxhMI+ORe9CMkm05FoHT2s=; b=pgixGvzZT10KNhp3Rj6rUmTUXsfH5G0TAwRpSKhf4kx+Gg679nlxYwjmTrj7VPAW5UOn3T SwPMjQP7lkLfRzdPngRib7CoiC6Im6mut1Yeff/G+q4iUiQhck8wT+KMUrhnDx/zG9Y6Fl GwNK29uXKyEJRn7ZGdpN0Vwi60zBlTU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xOHsjob9; spf=none (imf25.hostedemail.com: domain of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070634; a=rsa-sha256; cv=none; b=WRk9LeJC0X/QPQqGSPErZsgsMXRJNPNTZBB5NEtG9QKZ4PekUIYT6jeaoWwVcohrAIUP+t WqvSFNA647MUuY1dvhJa3To6tCFTUK9wycCtFrDaA+bFqhLCq76DlCkBS7OZs0VncXS8YV pM/UG20TZsIybH4du84FZ/00LZyCULc= 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=mraJ0dlvK0XwWYXGT0DcPLxhMI+ORe9CMkm05FoHT2s=; b=xOHsjob9PMRyKJ4ILlqtTtT2a1 BSDOhN5jc440njcpUba2nJJn4oWzHKlh5DYh9s2DBTQtSytoXVfg4egryfmJiUwA01qRqHZMyDpJp k41/6F52tAyqKs8+FJOHLgI6idVUYxVWw63f6ikxbMTvsonHwp2rvU8xER17XbkQQKwuPuEorYONu lBoFR+e+It6xCOx7b04q0jrJemUo+IGk3r0FJ+y3wfCceEClP5rP1JfvxWkw6DvlJRuxLS8JZSWNH vd36DpSVg9AJW+qEayHR4sasRkMheP1AdnGvgFgKp2vugbGtPTxQCn4k0/VQoq9AZDuR9Q9Nfmonk fGtYvRqg==; Received: from [2001:4bb8:19a:272a:732e:e417:47d7:2f4a] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMQMo-002o3h-6D; Mon, 30 Jan 2023 09:22:22 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/23] target: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:39 +0100 Message-Id: <20230130092157.1759539-6-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130092157.1759539-1-hch@lst.de> References: <20230130092157.1759539-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Stat-Signature: jr3em9ngt8k6uni5txrtri6zkwpp5t53 X-Rspam-User: X-Rspamd-Queue-Id: D024FA000F X-Rspamd-Server: rspam06 X-HE-Tag: 1675070633-285642 X-HE-Meta: U2FsdGVkX1+yGGM9QaxmIL2doCTeaAufWG7ON57+Gj7OEDs3aSnJMDNXyaPLtRP/r8/m6ToJj+HKec9LCo088hPp31ezPuFrUQQfOTdHtlHHH5i5MY83y55HZIuSw8+d2EJe/FEe3DbK/WfgWAnsjzYMhr/uUj5X8EC1A05vMebjCQx/JTOP872RONBOX4T0bFC01w6JIAny12x8rg6FT1rahq9hoWLq+TJYEhg6sOzdgjh/qR6TUs44UXQARR/oyf587sE9H4B04WQNgSvBl/pLICvxu2LhzgRzWd2pG6MMu6fSTl4kkOcBcjzosvt4WnuOkWp2MaNLcUgvmMSQv2MMZvuNt5am34TsP8znJ8Zs6q8BiLzQDAaLf69vWV5BSrlNwk/LircXc3mSScfNlY0VOQmvxWN8bw8H5CpZcYP1cbNVWM3kH1mQjvQtJjLzng6Qz7M1GXhKnhAiMg2yMuxmgcWTC44s+vpgMkBChCVkJAUmqAcqJSZnGjXY1Tf04Ckh4+/96nmV0oPjSiuZomZN6fhaNNkCKOZm33FQ3IYqIZr3al/aS6z3T5kRC4BzcFtScWktlYhxmzfrXCHoBgPsHk1p0oH4P+4R+aehlLcBdCRfGeLBlG3PvkIoPOzJnNcKOM8qhfXtNfmLWEouiGsNeDVXKzun8ngYTnsFkguw8KNEy7ipXmOYMpQa7KdYwq2sRW/DwP1+NrXve4VifhcMeswacnTgZs4S1GuN0OPt2bXPUhyMObkQFeyD2yWxzwK20Btan3wk+3R/TFnvIi+XYZxsQ5zuqsqsTRexDQhO1RfBYmLs7rh632l7n3doRE1WPFCT4pfcx/qYn46KdGB32rwqaNz6UcZMl7UF5CX/x02tSkImp5e1/iSCw/LfZPwuo1iKzvqekNN158A/JApVHrimFhq5rXSmRFQnbt2o8V98Lsfrz6jdF515ariS0iFBm0OC2L47Uq0rdjN wVeusekE RLoo1c5D90CDvYmKp47a9Jaq861otuW7/pom97oZ3wuV+D4u3bYeSpBDvXkPNWthRRFSZsd7w2PSOAy1rg4vCcmx8lYnFC22C4JobHihU4Sh9KCNoumtmCKzyzkjtKOK9ZXl/Cq3ybZvGN/2gxo5frX5IPPyH6iv7Qxmf5wAt5y3NPWNV1PzhdMeuzZal70Z1AKL19W8Un3BmI7fufYzpa3EZwLNBD1fMKrOAgUT1pEthKD4PlBmDQVCulUxHU13z7O4Han5l66XO2uab7sOJUpAnYE/Xqc882s65lQ71OcP8tv68HrBH2wQV1sUyZSwVceihSdSlbhyzfjr9zZeiTzo7BZ3CXSrs5lyK8qy9nR0ufL5S0Ugd9LPNpJJZBDU9jiqn6UoJabJx9/BzdiX4pMhnbkUZCzQgZfeKXwygmeYkQDZ92FoQV3clXyvdhkXBQXekpDTxgc7fxdyA/2935RWHHgPHapppglFQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/target/target_core_file.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index fd584111da45c0..ce0e000b74fc39 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -281,10 +281,8 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; for_each_sg(sgl, sg, sgl_nents, i) { - aio_cmd->bvecs[i].bv_page = sg_page(sg); - aio_cmd->bvecs[i].bv_len = sg->length; - aio_cmd->bvecs[i].bv_offset = sg->offset; - + bvec_set_page(&aio_cmd->bvecs[i], sg_page(sg), sg->length, + sg->offset); len += sg->length; } @@ -329,10 +327,7 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd, } for_each_sg(sgl, sg, sgl_nents, i) { - bvec[i].bv_page = sg_page(sg); - bvec[i].bv_len = sg->length; - bvec[i].bv_offset = sg->offset; - + bvec_set_page(&bvec[i], sg_page(sg), sg->length, sg->offset); len += sg->length; } @@ -465,10 +460,9 @@ fd_execute_write_same(struct se_cmd *cmd) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; for (i = 0; i < nolb; i++) { - bvec[i].bv_page = sg_page(&cmd->t_data_sg[0]); - bvec[i].bv_len = cmd->t_data_sg[0].length; - bvec[i].bv_offset = cmd->t_data_sg[0].offset; - + bvec_set_page(&bvec[i], sg_page(&cmd->t_data_sg[0]), + cmd->t_data_sg[0].length, + cmd->t_data_sg[0].offset); len += se_dev->dev_attrib.block_size; }