From patchwork Fri Feb 3 15:06:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127856 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 51B4EC678DB for ; Fri, 3 Feb 2023 15:08:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47F436B0093; Fri, 3 Feb 2023 10:08:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3732F6B0099; Fri, 3 Feb 2023 10:08:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDB1C6B0093; Fri, 3 Feb 2023 10:08:20 -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 D85576B0095 for ; Fri, 3 Feb 2023 10:08:20 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B44B8141118 for ; Fri, 3 Feb 2023 15:08:20 +0000 (UTC) X-FDA: 80426311560.04.0AB491A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf27.hostedemail.com (Postfix) with ESMTP id F344340017 for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=41bYhxy4; spf=none (imf27.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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436899; 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=kORmqO/9LhO3glrNFnQu4Hg9yMGINb4dC3Y3cN2SyCY=; b=TsGcSrqpUhG43x9n3iqc26LNyfcRyaFvl3fJoeEkwTx17+KGq/1G9PH7GT5CRhW6UtFXLs 5kXF5ryXzw51PUYiQSb9wuqmJEh0KGHEP701qkG6EM33jAUVda4med2c6BD/60WfhWexGB rhCON3Yy1kK8Wqc4qNnXUHOGKTywiLk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=41bYhxy4; spf=none (imf27.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; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436899; a=rsa-sha256; cv=none; b=HGG1GuSQm/NFRZHeKKF+XtHdJXK2zo+2s59F+Zc1QgPR46lUTje70d4w+sFH89RqY+o7jq O4QjNBO6Q9rPC9Iuve626T2kCDQE7ogLTodychJXojuPeMUQuXXfUSPgNVXnUiqsg3mrQK ikj2Aje4faXxMbgeSTehO90ogK0lBzo= 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=kORmqO/9LhO3glrNFnQu4Hg9yMGINb4dC3Y3cN2SyCY=; b=41bYhxy4j/IlMzxFEoHx+Uxb/Q AoA7/uGEehM9h47lmjn1p7wMCxt9YN2chQRTwM9T0U2R33+6P5uw3dFU034X2phyy1FaKZr6D6uZm Iyou7KFZCyjd3dhhg9p+jbvkL4Nxb6yurGLVKQNvr7SNXOMsbnNpwH65HvZRyfpPA1+nugxrw2oX8 3pBDdo50wrWXKZ0GhYhG/bn2vy2Q2l9fNSxBr73HSlVDIWqwtCuv2e6F0W3sVOzyMhe3c85OjeDqi nGFDVsH+onY5nUtibJnC/vm3UzB7E89Fvv+DR2t9yt7brPMGQYvg04XXc1+uC6uVfGrrzMou4bMyC 6VNrGmvQ==; 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 1pNxf1-002b5b-7k; Fri, 03 Feb 2023 15:07:31 +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 16/23] orangefs: use bvec_set_{page,folio} to initialize bvecs Date: Fri, 3 Feb 2023 16:06:27 +0100 Message-Id: <20230203150634.3199647-17-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-Stat-Signature: p36tej3h6uha6ciqdk6dgw1kzytm4kq1 X-Rspam-User: X-Rspamd-Queue-Id: F344340017 X-Rspamd-Server: rspam06 X-HE-Tag: 1675436898-460089 X-HE-Meta: U2FsdGVkX19LiY1QCluGz6ctyEluNzBUMvRKzfxEKt91mRU7FSVVRC/NgDnb2uYH1/g71b1q4NmPF8FZ+Ow2iE+KG4MQed6hefjIREsBPBJ79ju3LdgZl7soOmpbG7hBA+9PgExju10d5a2p2f8ZdAkBo4PNSRKYgr2vP5sj/jf93DZTF3Z4gSUAdtQojDlkLcvgygowV3uZNu6khfVtY0QBxjIEy7EHroDDvON0LbuVPnXUKHwAKklEf/1jN4wPEKvMayYIbQuvZlBtdWgw5ZgP3NFlDQCuJAHwpFb5OZlLtmTrlCb8LjOPYbhQLHaPTe4v8Z6ls+9eX5oXg5aMJPBTkF71Vnj3blCGdHU+hMDFCzzi9pChrJHz7irePUtdM+fdKoFleFVxqGeBtE7G9NahDmExu2h4drKJGjfM0HwnCYOofXoQ62ZLkgrwg4rkO9tfihbHruVup4CqWx9PECyRWaRJ3MVVNjC9XKoCBx/6Mr6yZgdOT1hxPdcpEtzAZScs8GDIWrJcp2lnr6B6kbR3m0OHlSenNOMeQ5u47c9Kp6cuBv7DvVsydzbBYJluxHgQjE+jgpQG6JaiE7f8XAGi+YAxplD6SakWg6Vgjzjcr27ew1CaoN1nErvxOME+QqS0WbI42hA8ui6lLawituyNpy8T89u/9lpk16r0Mbufwj1v1dDYg+uMvVSrXlTP3H3ur6YCPAl7E5s6OAmGpuHJAz5lPkwvTc+lf0adcAFQ7Z2K+jwR8XMNpFpP2zLclP/QcOQZja3gcPeEaZvXg3TfBBL+8EJjDo6rGK9jYMInBqy/7JihJjwXmk2c6iJPb8E8/3eW8HneYTyinbzcVDSALn50E1hr0TSYsZPzTAR8pE6WuHmHEDdQM3HmwPcEonf2zgvv//W/PyFqE+yfdg6kPI73r3MMPaTMxcS4L4cL393/DKa+eWQs95ZOKd+4QHYAOnMgyaUFUymuq2A jquPdlAH bK7p6JwQSZpHMGWIWbdcILpaue6z4560b6rO4P5KYSQ11aBlfsDwj2kxSKVppU6evhiSVlAXaYDkbIwi0RKOIPRR1SiJHixAQlXvx9AnSXaMfWzGZkoqx9+wBOpGvMakvnXutGli2LgfVLj1oqnY4LmYKH1M5NWTHvK9/ee/x4GfeEVE9p+UE0HGMFDKN+M+bERqYKOVN1al6HDB5zeQg5y48E4eKMd+B4JdnmiX7fdvTwIQWxzjVx66jzNljt6lHr8EEeqIaXndCGLUImSly4fOKgVpn9X6GHuQtKmE518W5s6um/Dw+7DIrzGqn6czPK8rk29ECG5Sik2B82QPcDlbHhvmPNljCeHOA0/pO9xH7xDhy3wmbfr0A7KX0Is4mVeLdNPc5UJhXot0pcOsZKhtj8l3hpKghh2t6YWDiFI99qjlTqmoahKG4komOLJNrrn5AAQcomJVQ/PN4nttilwnO8pAETKWywEre 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 and bvec_set_folio helpers to initialize bvecs. Signed-off-by: Christoph Hellwig --- fs/orangefs/inode.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 4df56089438664..215f6cb3dc4129 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -49,10 +49,8 @@ static int orangefs_writepage_locked(struct page *page, /* Should've been handled in orangefs_invalidate_folio. */ WARN_ON(off == len || off + wlen > len); - bv.bv_page = page; - bv.bv_len = wlen; - bv.bv_offset = off % PAGE_SIZE; WARN_ON(wlen == 0); + bvec_set_page(&bv, page, wlen, off % PAGE_SIZE); iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, wlen); ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen, @@ -102,15 +100,11 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow, for (i = 0; i < ow->npages; i++) { set_page_writeback(ow->pages[i]); - ow->bv[i].bv_page = ow->pages[i]; - ow->bv[i].bv_len = min(page_offset(ow->pages[i]) + PAGE_SIZE, - ow->off + ow->len) - - max(ow->off, page_offset(ow->pages[i])); - if (i == 0) - ow->bv[i].bv_offset = ow->off - - page_offset(ow->pages[i]); - else - ow->bv[i].bv_offset = 0; + bvec_set_page(&ow->bv[i], ow->pages[i], + min(page_offset(ow->pages[i]) + PAGE_SIZE, + ow->off + ow->len) - + max(ow->off, page_offset(ow->pages[i])), + i == 0 ? ow->off - page_offset(ow->pages[i]) : 0); } iov_iter_bvec(&iter, ITER_SOURCE, ow->bv, ow->npages, ow->len); @@ -300,9 +294,7 @@ static int orangefs_read_folio(struct file *file, struct folio *folio) orangefs_launder_folio(folio); off = folio_pos(folio); - bv.bv_page = &folio->page; - bv.bv_len = folio_size(folio); - bv.bv_offset = 0; + bvec_set_folio(&bv, folio, folio_size(folio), 0); iov_iter_bvec(&iter, ITER_DEST, &bv, 1, folio_size(folio)); ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter,