From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD0A442315B for ; Thu, 4 Jun 2026 14:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780583166; cv=none; b=fCA+GoxM45XiokTRElxTPzgO7ssucxYxP3+tC9iCS8lIcmaDprq0SeAdLluJ3SP4Qpz02tvxXUC3+Sa90nTZMYTlymmiUnOuVXdFyLOZf47CgpkkSHS/lVeQIlSAVjYDybo5PJxyJ5qQJW82MJAtS0cdN9JhfVwlICRjJJGhWKg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780583166; c=relaxed/simple; bh=oyupZJcjxvClYUnY8PtlxQPfTXtc+rhg1VGXf1uiPhY=; h=From:In-Reply-To:References:To:Cc:Subject:MIME-Version:Date: Message-ID:Content-Type; b=rKlAVlDw6P8vmQoLPlQeaVLyHxiq/B3yaD9AyJxGAobg7uwUc/11XrOURzwT0KO17eFQeEjfZN+PcdJ1auzEzuVSWs+0PS1fsXzzZ/RQMKxmCRq/uucTTu2KW52p2zrbKsBIDIQ0y27LQgRPy+FDub3uWkUB2qyKfU+hggExz6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=U1i6t3pi; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U1i6t3pi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780583164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+hEgi4Js9Sg/b57dL6O3ikI5IA10/Ul0ztOGbyS/4bs=; b=U1i6t3piarlYuMh87LLfl7vs5YWK9KMQ0be75+cGzmsuNH0Ezybq1SaoYfUivmwmPayoao ZlZ8ktMI+PQs+MLoPS40c8f7W7+0s0aWoN8t2kcfPUAdxi6c9rDzAzvloOBSHcbnxanKsm gN96Gw3yarsXleZSquuWLcvdglRjtx4= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-010EzjtuPq6sAk9ZnnOTDQ-1; Thu, 04 Jun 2026 10:26:00 -0400 X-MC-Unique: 010EzjtuPq6sAk9ZnnOTDQ-1 X-Mimecast-MFC-AGG-ID: 010EzjtuPq6sAk9ZnnOTDQ_1780583158 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2813A1956094; Thu, 4 Jun 2026 14:25:56 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.44.50.14]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F3B2130001A1; Thu, 4 Jun 2026 14:25:47 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20260518222959.488126-1-dhowells@redhat.com> <20260518222959.488126-6-dhowells@redhat.com> To: Christoph Hellwig Cc: dhowells@redhat.com, Christian Brauner , Matthew Wilcox , 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 Precedence: bulk X-Mailing-List: netfs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 04 Jun 2026 15:25:46 +0100 Message-ID: <127138.1780583146@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-MFC-PROC-ID: SkdZjMkbzrOnn-Hs5LyQAZOIp9we-5EjOZlczrnvM3g_1780583158 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-ID: <127137.1780583146.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Christoph Hellwig wrote: > > +static inline void *kmap_local_bvec(struct bio_vec *bvec, size_t offse= t) >=20 > 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. Sure... But it then differs in pattern from the various kmap_local_*() tha= t we have. > > +{ > > +=09offset +=3D bvec->bv_offset; > > + > > +=09return kmap_local_page(bvec->bv_page + offset / PAGE_SIZE) + offset= % PAGE_SIZE; >=20 > ... Also this can use shits and byte masking to be a tad more efficient = and > matching the rest of the bvec code. PAGE_SIZE is a constant power-of-2, so it shouldn't make a difference if th= e compiler is doing its job properly, but okay. One thought: I could just give bvec_kmap_local() an offset parameter and us= e that instead. > Users of this would be interesting It's used four times in patch 10 ("afs: Use a bvecq to hold dir content rat= her than folioq"). I could merge this patch (patch 5) into one of the other patches, it's just been more convenient for it not be in a later patch when flipping backwards and forwards to cut down on recompiling. > and why you're not simply using a bvec_iter at page granularity, which is > what other block kmap code does. Because for the most part I don't want to do linear iteration. There are a number of cases: (*) Read-link and follow-link: For symlinks, there will only be a single block and it will fit within PAGE_SIZE. (*) Readdir and dir checking: I iterate over the directory contents using iov_iter and iterate_bvecq(), though I could also use bvec_iter inside= a loop to step through the bvecq chain. (*) Lookup: Follows the hash chain in the directory rather than searching linearly. (*) Editing of local directory copy: Doesn't do linear iteration, but rath= er does random access of blocks in the directory. (This is to avoid havi= ng to reload the dir from the server when doing mkdir, rename, etc.) Note that directories are 2K, not PAGE_SIZE, and, when editing, I may need = to modify more than one block in a directory operation and they may share a pa= ge (which may be part of a higher order page). Can we drop 32-bit arches yet = - or, at least, highem support? David