From patchwork Mon Jan 30 09:21:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120643 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 06E48C61DA4 for ; Mon, 30 Jan 2023 09:24:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF5576B0088; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E7BC66B0089; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C01946B008A; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9FF556B0088 for ; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 78EFCC0703 for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) X-FDA: 80410930530.17.BA59C2E Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 9F553100004 for ; Mon, 30 Jan 2023 09:24:43 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=0HizygZk; spf=temperror (imf05.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=1675070683; 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=ZX5vPLww1ieVBFlojDg1pRNZdS2tPELLb4SglpcQIZZDUSrkf5kwUrnFEI3NzUgXuL2YOy XWU4ccLoIs6xw/GmocrW8Zj80jhnCllmI59xgr1azewU1ZFhbzfm5du6CRtKzOeqen7fiC aqFSpCc/sFYsxAntvaARzLShNlyZM0c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=0HizygZk; spf=temperror (imf05.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=1675070683; a=rsa-sha256; cv=none; b=C+Gz++8ztIt/oUkx7DDK8CFPcuEfeAqCC1rZ623ae+TdAZjihdi8/ukB8WhSDTHQBBfbjY hjQLcBevXZWKNowjb4OxdQQIk1nHC8PXgznHQrq1K0XFRLlzS45+d+LvTLdbX4rdSkVUZ8 SSc6b+u9tLBmgE/TMGkXB/QyAGT1Vsk= 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=0HizygZk2nZjv0o2ajWsgJ6NxN HeRnnJ1D22tpfXLoTyq1RPwvhbr9Hiij2NkO9yjBgJPw0OncbMANB9niSSOrRVZ2N46LpusCcE0BB jppqbA+4ogA5vchuAFpwIfPib1H34fAqGiBc55ohmeWXo4V1xtSPW8b8UVdQPWfxnr0ojaeVAE8mW 5BG1gAx9dS/IpjC8HJj51SPaIhLswJAaTrcmg8S5HJj0ItA/7z4nEzsHIlF7fTEotoyWvhZ3wIenz pNMuCzbIVd5wch1ImTQQLdqp02J0HQI3Zz62oRWCvcMwzv7D5j4NXjlbmjtwNIkk6uFSzNM7w+c0R 43WrGivg==; 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 1pMQNQ-002oHi-98; Mon, 30 Jan 2023 09:23:00 +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: Mon, 30 Jan 2023 10:21:50 +0100 Message-Id: <20230130092157.1759539-17-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: qy3z75ak7dr7esa8tffxcu44p54h85n1 X-Rspam-User: X-Rspamd-Queue-Id: 9F553100004 X-Rspamd-Server: rspam06 X-HE-Tag: 1675070683-757226 X-HE-Meta: U2FsdGVkX1+izHtlXkuEFkalDuXxCTtPPupjG94F4PecnB+v+d5CdT3DD48hGbmguYPsHs36twwqAFuWiF6RpG1klwfFH9HegSmSWH4xWB++E2Gj3E2bpBuUk1NP4xEEkAilQ5NUw67xwg/20Xy60XCH0KrsENxfNuTxhAFEu7AOZ48Hy0KUNZ0A8STwjtpfFyNAwJKd2td4iv8YfEnzW2lNDW5OCk/2cLyoZbC4SEdENBqXLhhCSuJtFZVbcmoOZUxuNibtPNcm3faYUIj9o/Wuq3S6abJaF/08FA9waCvFiX8ntTZp0YRgRynknc2ehTc+iim3gB7ag36UXgGKqTuEsV6ZQgOtO4ESQoLmXP/D91MjT8RzqBfeJoFNe3qqMVl+5ta9kZlpxyYMdJENFgh6n+JwNV+0+QEQWjKjYIw79Mja8STnMREbNaSr36iGIei3FHoEdrepHCH/BhS4PcoyghQJs95tbdHVlw5f7e/q4myTNfJ+DKbuwNgpONVx0dIEyMRElS0+PstvBKgFsdmHDtpmNnbavAA9I7aZ47T4asr8K3oG3okNxkSL5NIx4cIJ+qYVzmcih2c5xJAmgJKj4BARBooaPON//y3YU6XE6SB5P8/UrU3141ZF3zEnpaLpKJqnE/ved+TIQn4LPMhOEkpPCXBrjaiiXtlOWCLSgtTbTo0CTJmSumaCfa/HtjcxIUYfA+9Umj6ZDBmqJcd0rrGAj/vEkY4qJ9CKBDWhSbYA59z3jJBY6S2jyUOL8MjcaELLqCfvemM5NXeYd2+S8ePqdBu8dnEXVL5pQ/AGeSa+sHF8x8dNkqNaXSUA2jzK/M3/vEebkcr6LFE1M6z20JjqerInho6Yp/HxjAAUxxGktmHlohRgUeRebmlUCkIz1JeIUSupUxJISbPMSEbpO4x9NfLudMRHIWMhKWbpzX7EeJneKerrxFN9BYrg+rmLMVpiS8Cwjg0OmRU 3lVa//3w 7O7DO4MviFF85BGN/AYnXAGRXu+lL6IcnRbwsSuW+T0ZgsSH6dDt81JE4P+vFnQonH9pIEJdyCTf7SHisiUsSsC57OXcSNMp4gXydn1sfWwyFiTWWnDLS2fME/QPm29FzFloBWXq6AKN+YG57uwwKO0Xi/hDrf/5G7HOtzopOC6D0SSFj7RfiuJiTTulMHEEiSUoYUrxomJ/Y0kCu2zfXGwPIWl4CL7/ZS91VUHb0S2actuTFLJFPvizogORNz7D3RivP9UkmhxN5nTNnPrjyX5gknnhkWX/rSZX2oLWQDdUyaLa1LhYwvNE8kEmhgtY8llnLc7hqZdYxR4kKHuDd+wI40873lznB+zu+bZNeI7D56Vz7p5Jg0PEVaGLJtnjxVoUIXUTATLEuKkyjbn1VcOILoSGVuqUIjOhhTHyPoZtK1MbdQT3kmT4/4TYDz8kWfPqzHLKLFj0KbFrJsGIhBL76Qn/6jmRN7HmKWz6FChfNaso= 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,