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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF700C433F5 for ; Thu, 23 Dec 2021 15:24:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 424A46B0075; Thu, 23 Dec 2021 10:24:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D27C6B0078; Thu, 23 Dec 2021 10:24:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C2776B007B; Thu, 23 Dec 2021 10:24:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 1EFFE6B0075 for ; Thu, 23 Dec 2021 10:24:29 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CA11A181AC9C6 for ; Thu, 23 Dec 2021 15:24:28 +0000 (UTC) X-FDA: 78949430616.14.5982E5D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id C8EF7100025 for ; Thu, 23 Dec 2021 15:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640273067; 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: in-reply-to:in-reply-to:references:references; bh=8xvHhyqpJnfAF4nzjhPGcOWeASMzT5CGLatcRq8FkGU=; b=Fzoz3CS44wO2c26nMDxZRAMTwtf2dHLtDLpO/ma4pEYa5JdEtXbY1ljr3eKoOYv8K9znsF bBtAVSrIGQxxYqCoWyHBCl/6cpaMiDA0hlsdOOXVJ1UgUWy4mgZSaiXnxs5+Fusr85rizA 9pGYblxygIUcUkwMT0lWQlr6dCr87H4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-176-cFA9QJpoPXC-y6nZ_4xKOw-1; Thu, 23 Dec 2021 10:24:24 -0500 X-MC-Unique: cFA9QJpoPXC-y6nZ_4xKOw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29B978042E1; Thu, 23 Dec 2021 15:24:23 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DF73610A6; Thu, 23 Dec 2021 15:24:21 +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: <20211208042256.1923824-1-willy@infradead.org> <20211208042256.1923824-8-willy@infradead.org> To: Christoph Hellwig Cc: dhowells@redhat.com, "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 07/48] iov_iter: Convert iter_xarray to use folios MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <800799.1640273061.1@warthog.procyon.org.uk> Date: Thu, 23 Dec 2021 15:24:21 +0000 Message-ID: <800800.1640273061@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Fzoz3CS4; spf=none (imf14.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C8EF7100025 X-Stat-Signature: dgngrpc83xjg639q1grmqcgftzmpp36s X-HE-Tag: 1640273066-747678 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Christoph Hellwig wrote: > > + size_t offset = offset_in_folio(folio, start + __off); \ > > + if (xas_retry(&xas, folio)) \ > > continue; \ > > + if (WARN_ON(xa_is_value(folio))) \ > > break; \ > > + if (WARN_ON(folio_test_hugetlb(folio))) \ > > break; \ > > + while (offset < folio_size(folio)) { \ > > Nit: I'd be tempted to use a for loop on offset here. A while-loop makes more sense here. The adjustment you need for offset (ie. len) is overwritten after offset is altered at the end of the loop: > + offset += len; \ > + len = PAGE_SIZE; \ > } \ So you'd have to move both of these into the for-incrementor expression, in addition to moving in the initialiser expression, making the thing less readable. David