From patchwork Fri Feb 3 15:06:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127844 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 28C21C61DA4 for ; Fri, 3 Feb 2023 15:07:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF2AB6B0078; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 89FF36B007E; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47B7D6B0074; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DC7F76B0081 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8EB24C1156 for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.22.C212CC3 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id AE35B14001F for ; Fri, 3 Feb 2023 15:07:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=U7gHGI4+; dmarc=none; spf=none (imf23.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; 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=yYE/od14GoUSfS3SrqxEgI5AwVsNpiRxxWihLgbj1lM=; b=E8tQDHVJ267wcN3vmaa5WOG2hnYyq0WkKrxhCJaAO4Dc9VPaJ+rPkd5mA1Vu4Y3nM7aQ8A aBikpf2Ziqi0wUFcMd3PSIsZ5Zf6etbv3L2KvFgkzw0WktiOlXpKW/1Wgeg1/cQ6kDyDz0 Sq12NvuKVUB2csKK5PaR9wnE+OhWY54= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=U7gHGI4+; dmarc=none; spf=none (imf23.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=OqXuR51xN5OqJvCnoqiA7ICqvcdF+f58mV8u5qjqkd41vF3Argq4B/oqkY8i6Zo1nBJzek C+NC9+ibkyydhUlfhxcUDJQHeRscoRd05tFF0eGE79O/CqmiAhTadoYEk0dDBBSwbx/+zL HkhV9p2nEESzaY3PxiF1UGorJykTOS0= 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=yYE/od14GoUSfS3SrqxEgI5AwVsNpiRxxWihLgbj1lM=; b=U7gHGI4+jFww+bLgY2qB+UJ4Eb YA2OMvfnZAc5GIuqbs0dC0b5/ypXraaHVc3zXOzYoz92nlDl6cc9tfrbD8QiR5RuddFZ/24vxgEs3 tAQvsBOWvRR4DnM/Ts7iPycHDqB8SLxXBlwRo2qrTh3FfGjdSgSWlLXk/MAT7/txciVBFyq66zTF6 7jbBNwJc5NB1VF8aIBvk7ciGc/6w/kjvXfgX7GT/MIdD5VzKXBo9WHkJeCcWHzlVRUL3orKCIcveH k3IsETytcOcYa4M7MebhZowmCK48eVnfXowJXtyuxT4UQQZueio9wZREhVWDQtXDqeIGzpsaH3iWh VhCYEFnw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeO-002aht-77; Fri, 03 Feb 2023 15:06:52 +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: Fri, 3 Feb 2023 16:06:16 +0100 Message-Id: <20230203150634.3199647-6-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AE35B14001F X-Stat-Signature: hwmx5k8tjh8jq5q9ugfmeh6zazo6bq4t X-HE-Tag: 1675436866-926769 X-HE-Meta: U2FsdGVkX1/Jr0ziruTAThNWg+BBSjPQneWuu5ktQm1jxlaCNwvg6La/TXoK4R5XdmyT9o4HeSf695rhgwc3pobuy8X2S50UcSLC0ySi9BxFDCGZVxbfVuxBe6nUSaZyNsmigqIDCWOCzxl2rpAgRXZytHQqEHZbtCBM5lzV/y924EUZTLV922DoPgzreA0GlrGIy0NHfbmWwr8k0HGi4IsCpzGFdVkwZY1SbVjttUTK1Z1d4P1+hLlRXBru3NFDjRhLjP6JUYAQu0W59tDYi7Hb6qTDpgzsAdKKX+74WYgm7Esnwgfl0ToezvdGYhFjUChMu8sHmHNermB6e4NM0oTaGnVS0ffguaqi5IhVWBsWSS2LdW524kPsB7k6BjlAv7a+PQy3Md239d6cYDxyGg5tEMcFLezmyuPYLTQsoBSwuQASqiu6NGPpTix62JkXcBDAkoYWmsmxbqwPNQgAGanoSn62CBzBno8K/7aZGnlIv55bYI6LV/tfJfpy5rFs2OWs5vrv12DVaR0NvJokVn9dwa6sQhWNvx+jcIpxKrHdJ/j1LRb1t7LDjntMuU59IvBx9mz1yKhUSH4qqWDyj9ge0QcBTwi/a5Fxt01CrQatx0G96Uu0ekWA2gDaWx6O9gvoBCPOZNPt2rySNQ8zTrcNBOrWczKsY0J5bntQxKOL009optXpZSFdPVjwpXBtWxL/2VH0ESPh+NyqQVG9PN1uAqb59L5B9ko9n7MpYPr7G3x+VqjlGbGpNpuH3TgwPvKOxe8qbCpqHk6xFCM8YIk7a47KPfY/skqgPFA/NCSDv7YkieqK/PL8F4C/Ano68Kr1RqK7nk7HKPPYL5Jo6otonAMrIkpPlB9GNqBomIlRh56c0hMsPyvuY2sRhz47Gl+YgeqNC9q2Dh7ydNPatKYx1DNlkuetSfE0kw5TszD4xcxPiSyt8lio2NF2CWof0WQcMAfCy2lZsUeri9J 6Ki1c0Pu lNNnaCDn4oZDiTh7tG8ShWBzwfy71x4iYlP6y7oaNRMifbz4SltxMFvSwtwEzvIY3bpa/HEr6FFHXHNUHwdJ2arZ6dFUAWgxm2bXMo3a6PSADULof1ZThFPUI66UdO1f8VitL9fEaDwCYB9CRjmABabXGM0/LncWUQt1hf5sJt5zOHClQolD29k9TuUEubEuGmXi//FTxLmTkF9Psj40xV9BXPBfm3lVfKwo/b2rqEWtAi282fCAIYe7dLLdjzZLv6sy73fThoMUpy0d+LFzcwW3X1wP1KP0fhnJKe1H/6wl6B2Yk/XoJk83i+idIMT+6/+rWcgeXLiaL0tt6vYKRWV3NQVQUdKXQSSbphPhAT87MDdJL88g2u+mdbhMg9N02UnVGMoLachgR4HZ6WROPKweeNs+b4uw6nQtfDoHARks2W9EKSKenoP14EQ2SwpsPzWrQ5vjd+odzWk3SpnzuVXHPEzkSDPxGLeKtGJsEox2NC1Qr5sNc9rtlhbnfRk0fbSuK 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; }