Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp490226pxy; Thu, 22 Apr 2021 06:52:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMJ5ccBXGEfKru0mUUPrNIRQ62vB4mvFCs34eyoEk06zIKo+vkyrvqVwdSsgHYijlSw4KW X-Received: by 2002:a17:906:3c55:: with SMTP id i21mr3472782ejg.391.1619099549548; Thu, 22 Apr 2021 06:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619099549; cv=none; d=google.com; s=arc-20160816; b=volRda8vqU0TadsXmrOcK+gjMAqQ/eTCDKaNbZ1/nQKiYERVuN8xuHBvXBI2pfx3eA yhddtN+5TlLJMT3rBiNoBKE2xO90bpjRwlitL9/HMOgD80J8b9NLzgTofP3cmpYuoY91 aFv1Cpy+gw8gCo2TeUlMvqB/CDHhYAerawmnFgFgfydEvBw3DRFXXlIGs+9C6+Aq3R+g c32pxhRjopEbk/iTyp50gVduDVQWP6dT0YfOYQIAM92F8QfMXwbCVjekVdGxAvcxL50u 1djqMbwscWwSkxOrpM30a1Nxj/puUu7IlKnd46UBOAUEJBQLisPWFM7HgTLK0VOnI50M FWaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=JGmS/xLoW189jty2r0t6cwkKx1CTQrOOThGSNPhaRfs=; b=hftQdo3BhQmCE4xR1HFGL2laNt7VOoplOP4teEJCZgIPD613rWAV5mizcCAWPzE/j/ NFF/ysMA1pEzo1/wEAO7xn1nJe/PdVKtTvt1DLloc2LGDyUaP428JadEHUdPeedQWXEp m2unzWuPXUat9SKRNUg0Nfih5gou7M1o9+h8DUgmEjJ51RlTwouLjAR+xYaNczHV7yR3 7Hy3MickqmgNInjHPgzDqXkTPVw34tBC3rCzzHno9c8yph0Oyeqw8O6NoDykhOxPyZNy +3f/VLDBBERjacRrLsIUE7CyVYpaaku//Mlh4kigRRZGXzLuStHmOAOfpGScsT76hg5e 961Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2JYgmG8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt30si2254086ejc.360.2021.04.22.06.52.00; Thu, 22 Apr 2021 06:52:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2JYgmG8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236500AbhDVNwZ (ORCPT + 99 others); Thu, 22 Apr 2021 09:52:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40782 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236236AbhDVNwU (ORCPT ); Thu, 22 Apr 2021 09:52:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619099504; 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=JGmS/xLoW189jty2r0t6cwkKx1CTQrOOThGSNPhaRfs=; b=F2JYgmG80NZS9kJzYxX2swQYeKtcoqm3j3lzGhA8OPYyyMYOiJSB5IKtBET314mSqr/n7p 01b70O5DI1bNvCqQRDPAICWiWXg0PlJHswqJDJs0FTTrr5ltEXE21yFfRfwwUTeYv40cys 79z47+7AToc1mq4PAc06s+zCnz4q5Sw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-D-9gXEBGPL-JfVdk-rKe9g-1; Thu, 22 Apr 2021 09:51:42 -0400 X-MC-Unique: D-9gXEBGPL-JfVdk-rKe9g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E7A82107ACF6; Thu, 22 Apr 2021 13:51:39 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-124.rdu2.redhat.com [10.10.112.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0935760938; Thu, 22 Apr 2021 13:51:32 +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: <27c369a8f42bb8a617672b2dc0126a5c6df5a050.camel@kernel.org> References: <27c369a8f42bb8a617672b2dc0126a5c6df5a050.camel@kernel.org> <161789062190.6155.12711584466338493050.stgit@warthog.procyon.org.uk> <161789064740.6155.11932541175173658065.stgit@warthog.procyon.org.uk> To: Jeff Layton Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, Alexander Viro , "Matthew Wilcox (Oracle)" , Christoph Hellwig , linux-mm@kvack.org, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , David Wysochanski , linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 01/30] iov_iter: Add ITER_XARRAY MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2293709.1619099492.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 22 Apr 2021 14:51:32 +0100 Message-ID: <2293710.1619099492@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Jeff Layton wrote: > As a general note, iov_iter.c could really do with some (verbose) > comments explaining things. A kerneldoc header that explains the > arguments to iterate_all_kinds would sure make this easier to review. Definitely. But that really requires a separate patch. > > @@ -1126,7 +1199,12 @@ void iov_iter_revert(struct iov_iter *i, size_t= unroll) > > return; > > } > > unroll -=3D i->iov_offset; > > - if (iov_iter_is_bvec(i)) { > > + if (iov_iter_is_xarray(i)) { > > + BUG(); /* We should never go beyond the start of the specified > > + * range since we might then be straying into pages that > > + * aren't pinned. > > + */ > = > It's not needed now, but there are a lot of calls to iov_iter_revert in > the kernel, and going backward doesn't necessarily mean we'd be straying > into an unpinned range. xarray_start never changes; would it not be ok > to allow reverting as long as you don't move to a lower offset than that > point? This is handled starting a couple of lines above the start of the hunk: if (unroll <=3D i->iov_offset) { i->iov_offset -=3D unroll; return; } As long as the amount you want to unroll by doesn't exceed the amount you'= ve consumed of the iterator, it will allow you to do it. The BUG is there to catch someone attempting to over-revert (and there's no way to return an error). > > +static ssize_t iter_xarray_copy_pages(struct page **pages, struct xar= ray *xa, > > + pgoff_t index, unsigned int nr_pages) > = > nit: This could use a different name -- I was expecting to see page > _contents_ copied here, but it's just populating the page array with > pointers. Fair point. Um... how about iter_xarray_populate_pages() or iter_xarray_list_pages()? > I think you've planned to remove iov_iter_for_each_range as well? I'll > assume that this is going away. It might be nice to post the latest > version of this patch with that change, just for posterity. I'll put that in a separate patch. > In any case, this all looks reasonable to me, modulo a few nits and a > general dearth of comments. > = > Reviewed-by: Jeff Layton Thanks, David