From patchwork Mon Jan 30 09:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120632 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 AA6E7C54EED for ; Mon, 30 Jan 2023 09:24:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 831126B0080; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B9336B0078; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AC516B007B; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1700D6B007E for ; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E430480698 for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) X-FDA: 80410928682.13.9A60330 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf28.hostedemail.com (Postfix) with ESMTP id 31C59C0007 for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ODubD1C2; dmarc=none; spf=temperror (imf28.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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070640; 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=qHieNPI7z3sFtodokWVnoougmLvZVnqE3Y/VparMyFY=; b=1S28ADC1T/LrxMG+gJMXRVQHN5BITrcjc6PwySAPNDlo3S3fvOwJd0kZ6caEliYQGsQLsz c0IwSUjeIh4WRmIE1+bH4X8HyMlEdMbhoJ4HU9n+XqmUckjmzroAgNo5ZihFdS6FmZCSEd Dn5450Q3TYWvdHKXheKesEOZmDrR0uo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ODubD1C2; dmarc=none; spf=temperror (imf28.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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070640; a=rsa-sha256; cv=none; b=CMab89zv13N3FbI6qn2W6tdfUmniP5WJtB10Qf+7PiSS438cuz5eAE9wbQV7Itk3LWvVIV dh2WbZwdapLBCg2m6d37mXrv2t8xfDAlIaouTiJ69elYtIpVYVZdinYFU7+pZJHkMeWYgU mO0Ovd5qv5QdI//PNB4GPPEdOlfDbaw= 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=qHieNPI7z3sFtodokWVnoougmLvZVnqE3Y/VparMyFY=; b=ODubD1C2BRMqrFChW7fD2/w9bG Bek9dBQcKN5N+ru2staBvvFXiwAiWim7hYwhHUZGSLXX24jbnEbAqdmS5Ajj9+NlnFCavBXfsfhs3 XI6lzCu2GeqKtRgevITrArS3zGcwLMRZMxlr4utu1juNhvass81bDd906uTcf5xiZsb6cCOqyl8nK m98KeGJ9SE/V3c3ZRyUJeGtRoQ5nsh6i4jGrfSPRpVbUu4hyqMBJxi9JGDZJNhoGK0a94aCuKbtu8 rmmcphUXaeiu9gmh/7++19/XF9wkSuRyP7q7ZgI/exYaX7pXYil/gd10qOnCgTC3hp+S0hEq97BKO qjR+Sy/Q==; 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 1pMQMh-002o1D-D3; Mon, 30 Jan 2023 09:22:15 +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 03/23] block: add a bvec_set_virt helper Date: Mon, 30 Jan 2023 10:21:37 +0100 Message-Id: <20230130092157.1759539-4-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-Queue-Id: 31C59C0007 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 5s7fsfczyditefstymawgz78zawghn4x X-HE-Tag: 1675070639-781262 X-HE-Meta: U2FsdGVkX19aXlWdjnm5sNEIyTsKqE/xkYfc0VDvjzTJq3FAl2MQHn5PqIEJrjl6lOBf126SUeOHpBOAj3J5OD9Tau2wj6abGlGskK6oon2NL2Ss7ZiAYSqsGQGFu0wEkfvy5VdFSyfKnzg+oTEGDy0qVHnLV+pNLYIXXQV1XkkzokD/XujV+xNnY4gR5P8wTMA9Eu9YfUgZp5dKdshYkWjpjSHvvzeEvJsqr1E0T4KvVllB0CA2nNuuCbFmiEqWQ0saPOO8VVTdqL7YsKqFGjjlMHC/Iv8ibFKSC8cIH/+o4/3kRriAPstpvaf6EnliQckkmsszFrcNUK96jslj8dBaeK0Bi/FpWbew+IJev5nKBvSWVtBfEDEEvVjWvQjKDT1fu2y3qx8osgk97dZjywAJP5MOd7oNRqvwBfA1ZhxQh/prcW5jmclygBgIoQuEBnBmFFQki+ZgK1B1w0WXUnvvRHjVCpaFYMSJqGoAbapmme189CGrLqmhcx+SAugtwjSBfngZJaCuk1pyKnRjb0kEsfDKOZNJ+Z3X+PvYaG5ceV0uXyl3DiY/mBlgEGGdiKj3G+CwlMVoafZba5Hc+t3FV41hg9WI1H7qbCYQ+i2RtbvTGqCIVq8HP8ipRyBql9etIrZ+x0U9Ppnc62sZOdfEDaHT8LBJ4PhjrabyVY4ICBjmApQMv6KojWJVCPWDwiOnRtJtuWJzZ4X3qiMUpVs/ahBNGbrikqFyXkMbZuOICi9xvYh6L/EbT4ZnnKc10cWphpd98k8Gzghj0uMWqZvVT6gYobzOFyithNhaxCy4Z5dZKSSz9U61yhiN6sNLBFqHlQuf4iUgn3+BuyCnXWY1V5wV78qWX1mGjney7vUr/j5jYAlBHaLoMVkTv7480ExDmgvnIwU6MBO4tbJp+Ox53hxz+iPkmtAy6QAsWv5srxngR1SO2Z2CmSCdr+eR53t+pEwdN2SRT2rcxVc WWqfIrkS 4skhCiWgr2cEBt1FhA8jcQw/ejaYg+UJdruYw1246uSu/T7qJAsfAP7/03DEILr11Tr5BmNGpsTUZhFAZ38uGpTKPkB1sVFO9qn/H1SE446sq7Fym8gP1YBhpHDVJ4OD/yafCXMSqlD2Wu9jZiS6DbctqbAiC7CPMcgUZStPMD0ggvwhRVZm/QF3OwBKL7YibD4IsFUlh/izryCzVMTvUIRK+Kvc/KoQIizAksOhPmPwL+vHcmUmf4cvr6KyRdjJK1qaV6+j7gkX/X5ZP6jdtBus2WeLCkXKOntTN4T7l85dB9TxKAmo+Wa+bn+zh8Q7vIbnZ69LMLdaPQ652jcECBIQL1D+3dL3swGiZOLXhYEl110Vm6Gmi8S4iNIGwywphvNahSRML1rmLoy5/XB30QrK6T3PdYImYu32AfHW7yAl2jyxTvs2qtZ6AfvGz9yDBk1j4cAaj7+zDi4ICXDIjSy6fv2Q8RcyJNn0+Tcl/9TdltU59d45tgLt1jw== 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: A small wrapper around bvec_set_page for callers that have a virtual address. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- include/linux/bvec.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index f094512ce3bda9..7031d83af02267 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -63,6 +63,18 @@ static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio, bvec_set_page(bv, &folio->page, len, offset); } +/** + * bvec_set_virt - initialize a bvec based on a virtual address + * @bv: bvec to initialize + * @vaddr: virtual address to set the bvec to + * @len: length of the bvec + */ +static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr, + unsigned int len) +{ + bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr)); +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */