From patchwork Mon Jan 30 09:21:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120640 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 76B6AC61DA4 for ; Mon, 30 Jan 2023 09:24:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F8456B0085; Mon, 30 Jan 2023 04:24:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A8156B0087; Mon, 30 Jan 2023 04:24:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AB5D6B0088; Mon, 30 Jan 2023 04:24:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 36F3F6B0085 for ; Mon, 30 Jan 2023 04:24:15 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F20E91A0444 for ; Mon, 30 Jan 2023 09:24:14 +0000 (UTC) X-FDA: 80410929228.12.2218043 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf26.hostedemail.com (Postfix) with ESMTP id 5791514000F for ; Mon, 30 Jan 2023 09:24:13 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=AeyW2dv3; spf=temperror (imf26.hostedemail.com: error in processing during lookup of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org: DNS error) 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=1675070653; 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=mjnWElruolPujfuaQzrOj/G3l/fBXPdeJ5vitS9FjeU=; b=vmqBIADaDSVoJHrZ1Koa1kk9lbja89giz2pHcOElhtvjJ3ZSvmaI+o9lco/S/nGslgXdT1 PzalOuTzX+7sfys4zXb+VuJYlFIoblngKIH6dq0Ag4xjnCGTcuFioIqISL+7wfeyEzCLto mt2+gNHBoZddtz2LLGk8aJwtMYV03Jo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=AeyW2dv3; spf=temperror (imf26.hostedemail.com: error in processing during lookup of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org: DNS error) 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=1675070653; a=rsa-sha256; cv=none; b=0nK8OQpqDgJdxRJv9WP53du4KcJtAWCnyzm2sgMYNY+S8PLaIYx7YYYKDh8XXb9y+024aE wjxV9lRzGghZUtQh7ZS00gxSG0AG8Vyw9iHBGFigr/haNNUFwuUMEE3OvJiIYBaqnTC9HB HXpM3WoieIvJ49rEfROByb7w9jKO6Kw= 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=mjnWElruolPujfuaQzrOj/G3l/fBXPdeJ5vitS9FjeU=; b=AeyW2dv3VrGmqK7xN2Y68HgAm3 hh9AIAEzh5xupy5qbYXDao4MBJwRufhB0+Rklw61vqXEW59/3AXrMstXD9HpUj8whRVjKMJMKksw1 F+HACTpk2HZv02EVd+1E0anoDOOXkPMYnyhx3OQfOs0Zs7+JgAAEM+EH4MnpToE5nbZD+gcW+Kxv5 RRxGRvZ2U9vPF0VLvrfw4LaDLWjqfEbUdZown/DhIpBYN4rw26Fc1VzlYANaDoyFe1h++X6lxoqnh grGLHQ4m5s5Wx2rR8JgELRiQ++/ofjeYfF3YV1iR1Fe4G73jICcylJu1POXGqzsk8qRrUHOsuhAnx Kya4Yu+g==; 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 1pMQNC-002oES-K9; Mon, 30 Jan 2023 09:22:47 +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 13/23] cifs: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:47 +0100 Message-Id: <20230130092157.1759539-14-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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5791514000F X-Stat-Signature: yck9uffxqbtzojgpk93hscagagfkbcfc X-Rspam-User: X-HE-Tag: 1675070653-610958 X-HE-Meta: U2FsdGVkX1/u61mAdKqdjrRTJ+D+/YBTjS+MhbuvZoY3x+gg1xhajTUmiqDG8i9JX+4bm5MjfXXjuNBcrD9A2XPX0Ce1NbBYFks+5h/TTUzC6zWjvAvve+0Es0kxpYUIiW/64vx+DmV+erk2UY1Slpn+iDNxLJ+HefukIQ+E4jxpSRYhDeaOSl8YQ8McKulb/sQDxeT47AY9l1fDrRDQTiUcPcNEIbT/Qet4apSYtGAeBs1Ocn+raW2C2hLry923hMEYdPjz+zckvxHfbog8Glw053snDR4qfQK1MmFXMMfEon8WGmzr7WhYuMllogJgRQWMJDmyRjYN+S8YUx12MnYZMoWEPsehnqtrTLswZr4dBpJ/3HuVgjtkG1K4f1x9+A1nJ56cE1LQ7CqBxWtboWe5eDQfTUcO/Kut+AhOx0sOzqVj63P4OMH2ADbCBEDQPjcPqHUAFpzTNYhDv8uxPWRsPv93Kvkudbt1rO8W8Cu5yVy7lVVHMoztK58J2C3kvKllV44y0NeYn41Se1n54nDsn9I5dKHu+KWwVPuN/sb5j+zq7pHUOI/Gs/tHuBYkiHFrMAmgDPL8WrclJ7hzXDSDUAm73esz7BwMCVSONI4O8XeE2UldeVfqTovxX6TA/KnUW661KVK1JvcoaP+HIEcOBzGR6K8sLWahglSU6oYjy1Jb0YPlPZyvsY2NO+QlzhJQgEv2wjBa8yFmPoKQAlux2cY19VcTfsWC1jxMFBQsJxJSfH7XVqDEluoiacAzj3h3ql0A2E8rkeVcTF7uawo+KV1PIaJOrPswMMivUk0BRlz1NxtiT7jToTcJBtL1LlYg1Tqpu1rJ3Veok3mMYzlvXFypC0HHvIKwXvyb6ef2o6CRnn2Fn6/sSv3tbA47KnpdBiIQQm4g7yFVNLIA63VHvPoIi5oX/BDhkKbfFtRpRQmEC4y0fWbJNwMPWBT38ABkk4Ed0SbjpsH9Wkx yogsonst UQ0drpvFLg+uHgUIgzXYJabJopZMtII5nKBBrKWV58ErjkE3LxkSHiPd9p/seD+zdhfRgX0ItAA1Df0MMM6BOZikz+3ODE0dcpqNJ6FOH323AsdlTzUIdzGLrGQY+QupGKqDcL95lRl3YSxTtSIeUKGNm4RtdtqARCljBpno6nQyFvRhNN1WBj5szGw7F22H2qkYStnFpiqvh4bCgqnHiYUvnqgR0nKQDGdanXAo81Y0AETlxL2G00T2eq4/YZKE2a7d9G7eQur/QWrUX2h0o7mk9MYRa09hqqeORal4gSgWRGiXNRsQX5jAh+F+siWNSa1+vwSwAMBuXvmyG9aHRAGE85jzyyZQzmaew+aKgpGknn/eXvGlMurIsmsEyV6+MnK1X+HXLYAHwGW0g6HnUR/qBQ18DM2qvvcKOcT8rvS/CoW4kipW1wa+HOXppxQxdllfpvX7RW4b3GUqOOs7rSGSfUQxC4uJHeZWvMqNyjMrukKEig+2EYBz0Bg== 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 Acked-by: Paulo Alcantara (SUSE) --- fs/cifs/connect.c | 5 +++-- fs/cifs/fscache.c | 16 ++++++---------- fs/cifs/misc.c | 5 ++--- fs/cifs/smb2ops.c | 6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b2a04b4e89a5e7..e6088d96eb04d2 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -759,8 +759,9 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, unsigned int page_offset, unsigned int to_read) { struct msghdr smb_msg = {}; - struct bio_vec bv = { - .bv_page = page, .bv_len = to_read, .bv_offset = page_offset}; + struct bio_vec bv; + + bvec_set_page(&bv, page, to_read, page_offset); iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read); return cifs_readv_from_socket(server, &smb_msg); } diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c index f6f3a6b75601be..0911327ebfdeb4 100644 --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c @@ -143,14 +143,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page) struct netfs_cache_resources cres; struct fscache_cookie *cookie = cifs_inode_cookie(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE); ret = fscache_begin_read_operation(&cres, cookie); if (ret < 0) @@ -171,16 +169,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page, struct netfs_cache_resources cres; struct fscache_cookie *cookie = cifs_inode_cookie(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; loff_t start = page_offset(page); size_t len = PAGE_SIZE; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); ret = fscache_begin_write_operation(&cres, cookie); if (ret < 0) diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2a19c7987c5bd8..95cc4d7dd806d7 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -1054,9 +1054,8 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) for (i = 0; i < cur_npages; i++) { len = rc > PAGE_SIZE ? PAGE_SIZE : rc; - bv[npages + i].bv_page = pages[i]; - bv[npages + i].bv_offset = start; - bv[npages + i].bv_len = len - start; + bvec_set_page(&bv[npages + i], pages[i], len - start, + start); rc -= len; start = 0; } diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index e6bcd2baf446a9..cb2deac6b2d70e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -4598,9 +4598,9 @@ init_read_bvec(struct page **pages, unsigned int npages, unsigned int data_size, return -ENOMEM; for (i = 0; i < npages; i++) { - bvec[i].bv_page = pages[i]; - bvec[i].bv_offset = (i == 0) ? cur_off : 0; - bvec[i].bv_len = min_t(unsigned int, PAGE_SIZE, data_size); + bvec_set_page(&bvec[i], pages[i], + min_t(unsigned int, PAGE_SIZE, data_size), + i == 0 ? cur_off : 0); data_size -= bvec[i].bv_len; }