From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D938BCD5BC0 for ; Mon, 25 May 2026 06:13:46 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gP5DS345zz2xnK; Mon, 25 May 2026 16:13:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2607:7c80:54:3::133" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1779689624; cv=none; b=dHRN0NuL9V0CJnd8nsvnPUMVJKOw48L+n+pwGOCiebkaGEeFTs7he3/TDC0yU0UG2sqDw2eDdcBf9ULoT7uq9dZ70gs3SNAPaj098oBpp/LOC8AoZTotlFKPa6GqNDWZVOk91sRLaTFfTe+Edp5oBgGt2aaPOE6T0x2pz8WzZOgEd5PEsV0x3dmqcJmA6jXzDW9j2f5KLNaDIeeE8F24Ehrklkpy8dOVyGza8eqgPR29bjW/Kqm2DTKhu9fErSuv70PTaKBuDdpE3j4ZpPvkabqiLTamVWq3+A/I1Hy+KDsOTLtuxDafy7rV5Gvyq1pSb/XYASaCtzgjBALMKWJQgw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1779689624; c=relaxed/relaxed; bh=k3SPzxVyWdadKptBoGs22ABp+4fSutAbLhXgTnFnk+c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oEGk3cn4vwK/L+uGXkTWbNHj1x5uDeufTDauphre6d7iBjKUa6L3hAVO1KmCICPe6601Emv8jxqey11jUEvbQDTTAc6nRz9QhvWPW2moK20KKAdiGVIxOvOT190G8GRssvh/qHlG//93m22nF+D7B67eEt3u2E97o7IFmM7uMVvnWWEu0c2GkED2sPhpSUJPSCqxuw+ely3b9ipxNcA4o3ACpfBnq+WZR5CtFICGMcNQsnFJgr2E1aqE1JQY61xl6y9tCbVkAZ7uf1JyxirbDzHUP0Filf1e72SrFgHiMX7ZMw9hRjOn1FCvzOpUCAoMVQGSk1+6H9q5CR04AD5LhA== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=infradead.org; spf=none (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=batv+728b97dfb722ff21c2bb+8310+infradead.org+hch@bombadil.srs.infradead.org; receiver=lists.ozlabs.org) smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=bombadil.srs.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=batv+728b97dfb722ff21c2bb+8310+infradead.org+hch@bombadil.srs.infradead.org; receiver=lists.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gP5DJ61lYz2xk7 for ; Mon, 25 May 2026 16:13:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=k3SPzxVyWdadKptBoGs22ABp+4fSutAbLhXgTnFnk+c=; b=ch8C4AQus3YZ806Wh67oNprJWu 4YgLFI2/PnBCMuybdDy7PbfGtTtnOYTERUedeW5E5Ru5s2A42Wbka5YWGITgpXyoniyxVkeoX4jLc IUiRdYgZdzB/Am4gsRBuGO/BRVBQ7wRZfgKXj1zZbTQQSFMZAafdMq1Nx00l5Uir2sYkM1+syo7Sb tR2MZOHYxgUNgn6enT0n7mgnTQttQ6CNWFQCnUaBYMiOmFQAvhU06ASH+830Qwzg/OZoJ2MMde8pk 5myaDznWnGdkaDDiOgZB+6sZOcmbLJfO3PHqjAYQdxaW+wE6I2paALx9V82PLnhPBfyxJiW3AXzQ8 ADrqVaWg==; Received: from hch by bombadil.infradead.org with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1wROYn-0000000GOIp-2PQ1; Mon, 25 May 2026 06:13:09 +0000 Date: Sun, 24 May 2026 23:13:09 -0700 From: Christoph Hellwig To: David Howells Cc: Christian Brauner , Matthew Wilcox , Christoph Hellwig , Paulo Alcantara , Jens Axboe , Leon Romanovsky , Steve French , ChenXiaoSong , Marc Dionne , Eric Van Hensbergen , Dominique Martinet , Ilya Dryomov , Trond Myklebust , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: [PATCH v2 05/21] Add a function to kmap one page of a multipage bio_vec Message-ID: References: <20260518222959.488126-1-dhowells@redhat.com> <20260518222959.488126-6-dhowells@redhat.com> X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260518222959.488126-6-dhowells@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Mon, May 18, 2026 at 11:29:37PM +0100, David Howells wrote: > Add a function to kmap one page of a multipage bio_vec by offset (which is > added to the offset in the bio_vec internally). The caller is responsible > for calculating how much of the page is then available. > > Signed-off-by: David Howells > Acked-by: Paulo Alcantara (Red Hat) > cc: Matthew Wilcox > cc: Christoph Hellwig > cc: Jens Axboe > cc: linux-block@vger.kernel.org > cc: netfs@lists.linux.dev > cc: linux-fsdevel@vger.kernel.org > --- > include/linux/bvec.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/include/linux/bvec.h b/include/linux/bvec.h > index d36dd476feda..9df4a56fef61 100644 > --- a/include/linux/bvec.h > +++ b/include/linux/bvec.h > @@ -299,4 +299,21 @@ static inline phys_addr_t bvec_phys(const struct bio_vec *bvec) > return page_to_phys(bvec->bv_page) + bvec->bv_offset; > } > > +/** > + * kmap_local_bvec - Map part of a bvec into the kernel virtual address space > + * @bvec: bvec to map > + * @offset: Offset into bvec > + * > + * Map the page containing the byte at @offset into the kernel virtual address > + * space. The caller is responsible for making sure this doesn't overrun. > + * > + * Call kunmap_local on the returned address to unmap. > + */ > +static inline void *kmap_local_bvec(struct bio_vec *bvec, size_t offset) The name is rather confusing for something that does not map the entire bvec, and is an anagram of the existing bvec_kmap_local. So please rename it to bvec_kmap_partial or something. > +{ > + offset += bvec->bv_offset; > + > + return kmap_local_page(bvec->bv_page + offset / PAGE_SIZE) + offset % PAGE_SIZE; Overly long line. Also this can use shits and byte masking to be a tad more efficient and matching the rest of the bvec code. Users of this would be interesting and why you're not simply using a bvec_iter at page granularity, which is what other block kmap code does.