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=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,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 80097C636CB for ; Thu, 15 Jul 2021 22:55:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AAAE601FE for ; Thu, 15 Jul 2021 22:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbhGOW6f (ORCPT ); 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