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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6D7BC43461 for ; Thu, 22 Apr 2021 13:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79A94613B8 for ; Thu, 22 Apr 2021 13:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236872AbhDVNw0 (ORCPT ); Thu, 22 Apr 2021 09:52:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21782 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236333AbhDVNwU (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-kernel@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