Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp772886pxv; Thu, 15 Jul 2021 15:56:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmjm9Vjqcbp/iCrrpBFXjGaUsrOnQIXitr6/L77lPVKbLrP2irBolCvMIqpMvWzMrePJtP X-Received: by 2002:a92:6809:: with SMTP id d9mr4323322ilc.107.1626389799133; Thu, 15 Jul 2021 15:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626389799; cv=none; d=google.com; s=arc-20160816; b=RlC2E44p4RunB84zFnI0XGUdmCK1yXYPeFOv92FHtdc7dsiB1yj4yse2gboMm/OocV bgRB0C/d8FVgeigHCFY3tf+NItawFftsbOg81W11QF/uNR5XAln9d2L3lLAmizQMgZb9 0IZA1SgbZpxMJmelQImE0Noy4NvCrEjWINNe5Wwx6orC78yYhOgpxrC1HDHPupyngNdE VjkS2Yt2TF0q7kZ6ddy+kaV/NJkPKQFwne2rJLo4ujufWkjaPrSIdAAtN+w9Ep7Xi8if dPeWAifHuLysPaQbWc1hnf0StGaAmdCuwaGukk7jzcqowjX2olMnnoAtaCWi56jyr+/2 sShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4SfRsnl+VUaAcaRb1RxQY2hebMEkDPg6XWRC/HA6ZDw=; b=XL/LImv2sHTbTGEoQT1E8i1oLWhDsPLLxN3OrpnCYQrg7zXg3bf3KnrwxpjMhAJ7XY 0PO9nBwrOu3oEIwNwHWerigjPY6WRaYnpLv8j48UpBmqDaJxZdJ/04kTkIomw5YB70+/ PUcGbvWm0v7vczd+0c235iCisx9CUN9Ygxs2onWQGWxt97udaenfbChScXiJrnJ8WFE1 bvE+fjIbMbNQhcbxtM27ExawjLviVv/a7Dy2jKHR8YTvnM+VP+uX2AdZJhpv48C91HSA Y0VoOxR7ZQN0e+LjmCdU1eVfINagF+/diOdqjVQq9i2oXEpPdD2RXAogQz39sU6cZ45e BLDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n2jY8kpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 b39si3921477jav.0.2021.07.15.15.56.13; Thu, 15 Jul 2021 15:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=n2jY8kpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S229975AbhGOW6f (ORCPT + 99 others); Thu, 15 Jul 2021 18:58:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:59674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbhGOW6e (ORCPT ); Thu, 15 Jul 2021 18:58:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4976E613AF; Thu, 15 Jul 2021 22:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626389740; bh=P9uyzQH7V/Vu5iTQd3DZbraQ8Ej5+Fm7bfjvma3F+c4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n2jY8kpWCk9OuIFpx7Sbt4ugXyih8DxDDZo9X87C+6a6klH0p3PEjKLEhlpNsihmv dIVA1Sx5t2FNXUM5+lTvl+3ZqN48p7pvqjA0EsBTnRytiZ6qbfW+8KCW81SijAsRrY riWkplRp/TzC32evC0K1O7aaDw2BL2B792GvYA/VhmhJP+CxtQqNtLsq5VhOxji6gr E12NqYxl1ujJN1J+M/RJOQaOhexuFlBWuVfIpEiYxPUqgsXH9I4KSMTUjQph9xZTJD ppzOrtguGGUm96LDyB0+E4zoJgNCzQgPw9GF1eC35VuySBJfCyMkcMZ8ktdO6osWUM LYtqCC0m/qhJw== Date: Thu, 15 Jul 2021 15:55:39 -0700 From: "Darrick J. Wong" To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v14 098/138] iomap: Use folio offsets instead of page offsets Message-ID: <20210715225539.GX22357@magnolia> References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-99-willy@infradead.org> <20210715212657.GI22357@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 11:48:00PM +0100, Matthew Wilcox wrote: > On Thu, Jul 15, 2021 at 02:26:57PM -0700, Darrick J. Wong wrote: > > > + size_t poff = offset_in_folio(folio, *pos); > > > + size_t plen = min_t(loff_t, folio_size(folio) - poff, length); > > > > I'm confused about 'size_t poff' here vs. 'unsigned end' later -- why do > > we need a 64-bit quantity for poff? I suppose some day we might want to > > have folios larger than 4GB or so, but so far we don't need that large > > of a byte offset within a page/folio, right? > > > > Or are you merely moving the codebase towards using size_t for all byte > > offsets? > > Both. 'end' isn't a byte count -- it's a block count. > > > > if (orig_pos <= isize && orig_pos + length > isize) { > > > - unsigned end = offset_in_page(isize - 1) >> block_bits; > > > + unsigned end = offset_in_folio(folio, isize - 1) >> block_bits; > > That right shift makes it not-a-byte-count. > > I don't especially want to do all the work needed to support folios >2GB, > but I do like using size_t to represent a byte count. DOH. Yes, I just noticed that. TBH I doubt anyone's really going to care about 4GB folios anyway. Reviewed-by: Darrick J. Wong --D