From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAABD2592 for ; Wed, 8 Nov 2023 15:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CI8K5UMU" Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 451AA1BF7 for ; Wed, 8 Nov 2023 07:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZVwMMyCFylHELVoPXodIP6DHhsCSoTREusviqH4gvQE=; b=CI8K5UMUXZE+tGLSBIvqzrBUJo YuJJ9liNc1A9+NVevcF6zgoeM9dY+9B72xzNUiWaLPnZqdy/PX4eWD1ApnJS8crdgNJvmmxvRzHBZ ITKCtgm1kCM8HFKHuzvWMxtaJwEzndCoji5F2BtwgA3coSsWsmEwTKCD0499ujVl8SBHWQS77yml1 s8FtV4kcFFoDsRDYmwHHvVPqD76il7K7IVLenNh8GXZO3jWvjEkK782DJWI1TuCKiQzG0qDIb7k+I STBzpsb6XKj2fgCAPgnpcsTH3YFh2wBHBkvFS9ji574bU9YvvlNQTA/vVflRYLZgz02jbfunw+pqA o5bubFGQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1r0kOL-001kiU-57; Wed, 08 Nov 2023 15:22:53 +0000 Date: Wed, 8 Nov 2023 15:22:53 +0000 From: Matthew Wilcox To: Pankaj Raghav Cc: Andrew Morton , Hannes Reinecke , Luis Chamberlain , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/5] buffer: Calculate block number inside folio_init_buffers() Message-ID: References: <20231107194152.3374087-1-willy@infradead.org> <20231107194152.3374087-3-willy@infradead.org> <20231108145951.a7o3uld7nd5icslf@localhost> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231108145951.a7o3uld7nd5icslf@localhost> On Wed, Nov 08, 2023 at 03:59:51PM +0100, Pankaj Raghav wrote: > On Tue, Nov 07, 2023 at 07:41:49PM +0000, Matthew Wilcox (Oracle) wrote: > > The calculation of block from index doesn't work for devices with a block > > size larger than PAGE_SIZE as we end up shifting by a negative number. > > Instead, calculate the number of the first block from the folio's > > position in the block device. We no longer need to pass sizebits to > > grow_dev_folio(). > > > > Signed-off-by: Matthew Wilcox (Oracle) > > Not totally related to the patch but even though the variable "block" > is sector_t type, but it represents the block number in logical block > size unit of the device? My mind directly went to sector_t being 512 > bytes blocks. Yes; it's confusing. buffer_heads are always created for the logical block size that the filesystem mounted on the device needs. It's never for the fixed-size 512 byte sectors (but might happen to be 512 bytes if that's what the fs has set the block device to). > But the math checks out. > Reviewed-by: Pankaj Raghav Thanks!