Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp538762pxy; Thu, 22 Apr 2021 07:51:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyfwMXu4S8aGKKAmj5LQmQIygtCL2DrtRpHdsHVLPPmaE0yKobkPIskFyWRrF1sk4DP6fa X-Received: by 2002:a17:906:c09:: with SMTP id s9mr3794284ejf.145.1619103113940; Thu, 22 Apr 2021 07:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619103113; cv=none; d=google.com; s=arc-20160816; b=OR2q61vpX+SGIn3bhhvIPWoN9SgHVUYZezxmdzX1lc7uF2uK8WeIzUAsfj/FEtRCvM LjW2pcaR4FrD4oQEoq9V5mKZ56USc7pF2Csb82PzUnIp50/pzIdYEDmkOuVkZi1PLXdU NnrJSd4yaQfXtHJpAecHTVepECIL9pwNYmYhMaR+JziIAZCLBzFTa4I6/StxErD+3OGv 7FLxldwoThjukYZU7Ntie1hhHXTNpBNN5yYepbWKBj4DWyQAHXylt45kzZr+RVYlgWdx gfM3ZT05Xwocb7OYdMblxgr7dTrGZd6GQ6HceqaS11XNVo2W0KLhxX/YE97eCJKaOF01 Dpmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=mgtxhae1O66zLB4IpS3o/gKrtyB7o7mTtKynIuMRbJg=; b=ymyUy8DzF4L7LO/8bLDYzkntyhfvWZdjZqNDM4YYNDa/Qq4fqui6E8vBdcfPHYL5DG MXWR3iOrSUJTABd+9BVsFhhMyX8K2K9FmmB7ZG8qms0VnT0dueuHnh41Om0UXxrqBOOu /z3cegAjb25OQNkKYUgh/pDrqGoWaG36yT4aCETJD07HomN+DsUJOGdCChjdUiPSz3DF A+/kYeISM8pL+sSJ0lNaJFt/ca704sjoSaMQv07w8nuEuD3O8eugEQlN5+NBYw4ESgo2 v7guU4QZxLEhRdvFazeCDySSrzBzjH+GfrMG2Ghg4BqBFdey0j3lm8X8s7QaUI+AhZBT fwLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ISEFHesJ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga26si2452974ejc.537.2021.04.22.07.51.19; Thu, 22 Apr 2021 07:51:53 -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=@kernel.org header.s=k20201202 header.b=ISEFHesJ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236459AbhDVOvw (ORCPT + 99 others); Thu, 22 Apr 2021 10:51:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:39504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236019AbhDVOvv (ORCPT ); Thu, 22 Apr 2021 10:51:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B63461425; Thu, 22 Apr 2021 14:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619103076; bh=SABrBVqsF72QfA15qnobAparqW+KASuoIMcq/PiBNyQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ISEFHesJOLuYeLHcNDksC5KuWW+5nxW3X+DhvyEAmqF/uRFP5nQxuBuVn5L/aZiYr 2Cy7HQg4cBmEOyWy/aD5GewKDQib2hy0QHxelQ3fbslJekhlOKA8Vv0qamHl/sHAaa zI+F9ko8twDY4PvNrgRcbc715vs98IxZn9EO2++8yAKRZVnQHsTjOXMbGsXu8pyu1S 7yxSntGlu+TorOs1Ps6BNrZ3UsK/LoNdK7xyDZJxRVyc4X1GriKhZAIkVarearMkBS Ex8eq+2aZnRgx41OlNE2DBmA2pe7SPgzHIlqYkoZljNTB+4QBRADLXV1hfqWwTv8f7 U/aewDPyMcKtQ== Message-ID: <95de6e0ff902903cfc8825a4e0b7f1c64594630f.camel@kernel.org> Subject: Re: [PATCH v6 01/30] iov_iter: Add ITER_XARRAY From: Jeff Layton To: David Howells Cc: 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 Date: Thu, 22 Apr 2021 10:51:13 -0400 In-Reply-To: <2293710.1619099492@warthog.procyon.org.uk> References: <27c369a8f42bb8a617672b2dc0126a5c6df5a050.camel@kernel.org> <161789062190.6155.12711584466338493050.stgit@warthog.procyon.org.uk> <161789064740.6155.11932541175173658065.stgit@warthog.procyon.org.uk> <2293710.1619099492@warthog.procyon.org.uk> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.40.0 (3.40.0-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, 2021-04-22 at 14:51 +0100, David Howells wrote: > 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. > I suppose. > > > @@ -1126,7 +1199,12 @@ void iov_iter_revert(struct iov_iter *i, size_t unroll) > > > return; > > > } > > > unroll -= 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 <= i->iov_offset) { > i->iov_offset -= 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). > Ahh thanks. I misread that bit. That makes sense. Sucks about having to BUG() there, but I'm not sure what else you can do. > > > +static ssize_t iter_xarray_copy_pages(struct page **pages, struct xarray *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 like "populate" better. > > 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 > Cheers, -- Jeff Layton