From patchwork Fri Feb 3 15:06:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127855 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 9AAA4C6FD1B for ; Fri, 3 Feb 2023 15:08:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D7A46B008A; Fri, 3 Feb 2023 10:08:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 762C46B008C; Fri, 3 Feb 2023 10:08:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 567E76B0092; Fri, 3 Feb 2023 10:08:18 -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 42F1D6B008A for ; Fri, 3 Feb 2023 10:08:18 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2575C14112C for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) X-FDA: 80426311476.06.AB9EC86 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf04.hostedemail.com (Postfix) with ESMTP id 4C3B840026 for ; Fri, 3 Feb 2023 15:08:15 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=JNPxVdH2; dmarc=none; spf=none (imf04.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=1675436895; 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=u+7OceYjciyVxpUOutUWaJMKfPv6hlEZIeFVlh2yS8g=; b=OyFr+21hGl7ZySjYnGPHQtemPIyY99vveJNe8sqq9bTLfJ0Qs+WIKCdeA/neg1ALRMQQyi xQoycdsGro9/64KNUYt98WKPunPU6OQQaVYJFNcO6IsJKkMjR2aHwkLtXPRGPlrSD8WLGE FGimFTCcZ9+w3Nko1FgKPdNIPp3Z1mM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=JNPxVdH2; dmarc=none; spf=none (imf04.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=1675436895; a=rsa-sha256; cv=none; b=BGcvQ13dwyR+Xj44C7zVt8ePq9ibhVv7kT6MvA0O8GaiCiD/UBK+zAVf0ZESSONI6DQx8w lxFteJBMoqrb9DTph7mhXpwZquPOs7+FCxizbBr6bPvnvV84YjSXxogXW5qzs+RvhguDr2 e62ohwHfbLp0YWcmeIyM8T6fJflHNaI= 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=u+7OceYjciyVxpUOutUWaJMKfPv6hlEZIeFVlh2yS8g=; b=JNPxVdH2tcwGNrPV5YwUFFuLjq QvzWtHd/iHdB7oZubhV2MCnK5KFckF9HQfUBdt8Jf9h/EhD9Bni/5TlQzZvz8lCklgNXUjJVrQxvD kBdeE1aG+yBVilJGU4q3Yoq2W3s/Bd3ZXJALBugfoKkkCRUHcrJ7zG/3PlQn1jkW9Cbo+y4n2Pomk K6wRY+IFtTxD67vsg2C4wIVX98uyYKtd1GgF2Xbw4gSjuNiEbQ3qT7I9J3Z9gCYb4iZmFSAiTYwww Ep9cYftT502Iba00ZDwnQ39cfvaR1FGZ/KYoCMVNlvBPBBNW04loIyOl9T/K3tqePCEWK/E+tU54t GWCszcTg==; 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 1pNxeq-002az4-8l; Fri, 03 Feb 2023 15:07:21 +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, Paulo Alcantara Subject: [PATCH 13/23] cifs: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:24 +0100 Message-Id: <20230203150634.3199647-14-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: 4C3B840026 X-Stat-Signature: rykd391swqnerdmp5tbay38g7i99pt9m X-HE-Tag: 1675436895-648552 X-HE-Meta: U2FsdGVkX1/vH1NQgU7BOZKXGP3kkL+7HOXcr6O57cdlyHnRDrbs7R1gqYE0CYXNGvXQpzBbhFFtVg4L1EMBg9mgL4jY7aRvhjtLU++Z+WOhrXaAvp7LA2zw2oroi6BuXqoNBocpJ2xulxyrohbNSuHwmFmqcARfNRRp+Wb1rUdZXC4nBz2CJ2Txmu6g68/eTUBGajiR8cR+yMYMBNK659QosYCmzOubtsytIVpl9HLnl4IzC66lJA9HkuUUROAoVQSpHdBjXEeGIbofgWT+IAHdNFgLaSZxZj2LJbN9DvIXse7TtvJQCfjAGb4kwjNaWHkRSA3t4MFvRQ/9DjC2eXWBvqoCX4iOrwCfYhy4uuGv1lpv4Lpy07hkoIbYoXNJExteRJE9WEY24uuqhcc5lHPm3n2hR7EkXJF4JRzbkhS6HdCEzpX0sNKvATx7jKTvYgoH2Y+x5elZ6jlZ8zLQlYLP6Pd1FHWyOYA0uCgL8YO+4wWJTyBIySol9vLZI9VhQxI60vtdShXguZgrwU+lt34AoyBhFL9uGAskI3x2UFfQ6krsSZegPBxjcbQVBFyfDvCriTMpvtRBSov5HrKLHcOYEK2a5IjVrWrAyw+tjwgKY4TgJkKXZrOJb8TSHOFSaqPADzx+uwjJ9v/HAa/JitnZp6LQN4z6aldq7HIarc/ScvWo024OvnJKhfTmLPxU5FJKVeSu46kYeWrW8IUoVOKvUdlyWwegiHCOebBv3Dq6UEW8Pt4QYbvGL4vRHZ3Qim1+5XWUy/cHjq+XfGSR9o3Ja5TFdnO4yjxmqmOluDGBDe92yZ1ut2Ne6WMOfFgKae4W4QSPQcjov9+lXxfHsyvIFWqGGWVj9OcqZNY7ZHI5znLSCXCwbYwn7lVOe7RAff9tD5ZjK0ZRlBWdijTcfwcJqmUKvMT4PnpDzqQsXuWHhFNoT5k6D01HO3dDbtGID7rT3jHVgazVoMNyRxT GNKHdxJk wjgZORVT1/3Sv9Ve5C6vjvBjfXUNCB/vv4HE6TDnZKYHwNUr15r77GaVNA3C07Qrgij/vLWLSCrz6P5ufNucxLhUxDyKKWydNHzTDekJS88VT5DvOeLnbdhSbOzrKsnJj80LWwBMAS4bQDGqYuhwU+Q6Ys26PkHUPTr6eqCy0G/KOupTHcjRem31MD0cvPmmiVapQSTASUBSSr9WN7mOvr/Tg0CRjMaoC0TUB7C6y1MbIWo2waHesv9kAWChxbnJ8JzUO25y0zAqlccLrkuwjNlqLxk6vdMD9po0B6nkd/N5+i2ljRMm/8spZTUl8sdYrEXbonoL9qKfRnBuy1Y/CkTFjhHo028qrg226Typ9RAkfAAfl7RV8ZxlfKSHGsfmpoyn1skJhpONV7Su2bMuTaUk7Z25dxB+kKER8MNIHIjNX3VEhEsZLq/RPuwwgxz/XlkXGdZZMWCwePXxepDWWqhmlSQHTilS9jKEP 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; }