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 0DABDC3DA49 for ; Tue, 16 Jul 2024 22:37:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 455046B0089; Tue, 16 Jul 2024 18:37:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 408C66B008C; Tue, 16 Jul 2024 18:37:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CD3A6B0092; Tue, 16 Jul 2024 18:37:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0DEF56B0089 for ; Tue, 16 Jul 2024 18:37:10 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 41442160708 for ; Tue, 16 Jul 2024 22:37:09 +0000 (UTC) X-FDA: 82347077778.12.4AD19D2 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id B7CA2140008 for ; Tue, 16 Jul 2024 22:37:06 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=F1p9IYH6; spf=pass (imf09.hostedemail.com: domain of djwong@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721169388; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=veCKm08BsfIVjbVt/Mxq9ujCYIYztaOV9v2/t3VF0Og=; b=p5qraMfG8ok+rG5INmwdIIJGP1GEMJRIQxm6Xm37CiTXF6+mFer4NRjmgCwq6iymFzaVyH SfGKqCPGTQ4uEx38F4t6mHLHc8M/NDfYovKBYBPdM9LbqDEnyEWRhqsDPJP0Yl2uwR0O7d oTrXBQNfWxre+PSotam863cFRcQZ9As= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721169388; a=rsa-sha256; cv=none; b=jGdubR/6y/yjSz7Xc1S/QCXzb1hDdr2ElvL/JYHwUIynfdU3QZhSsNQDCQV+KZ3PG67bzw aJPC7/mGGB+pE+nkJ43ZcORTNJc61pw2e9xFo5/sR89sQdhb7BWRDIdQiaxfEXI7T5ZOpY aam3LRireEIRQb1Og+uSPbA0HqcMPXE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=F1p9IYH6; spf=pass (imf09.hostedemail.com: domain of djwong@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6421BCE010F; Tue, 16 Jul 2024 22:37:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E0D6C116B1; Tue, 16 Jul 2024 22:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721169422; bh=XUhPqr66mBnpUl5wHd3I09bj5Pm8QPcHLcQbS8RN2FY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F1p9IYH6CeswGs4EhE3VvNyGUrDLpo0oWzVNjMgdh1KruHl2vKfSDfiscijpVIalA DHurXGvl7xl1FcRKM+mgjsN5Q8QAUUSQ5i64eUKdblM8SurZYwSNXaTLK63c2MPcPJ wWG13t+2ppvzi8J65PTwRj0YFm7SBgwlzjAYjHozzpKrlEIR8bQUg+m6zedz8yS8km 4JZndZ1R6/kkdFyE6/5L0/UnCAhdf/MMPw6YTn72JsINyPJfeRg9gvOpMBFC0/IlC0 MI+IxItyLo0XzPGtrksOOQTYCXZQFJua4YwNox8hmOrVBBkM1UaR/xa7rNE/MimPu6 PxeS4v9QjH9Ng== Date: Tue, 16 Jul 2024 15:37:01 -0700 From: "Darrick J. Wong" To: Matthew Wilcox Cc: "Pankaj Raghav (Samsung)" , david@fromorbit.com, chandan.babu@oracle.com, brauner@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, linux-mm@kvack.org, john.g.garry@oracle.com, linux-fsdevel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, mcgrof@kernel.org, gost.dev@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, ryan.roberts@arm.com, hch@lst.de, Zi Yan Subject: Re: [PATCH v10 10/10] xfs: enable block size larger than page size support Message-ID: <20240716223701.GG103014@frogsfrogsfrogs> References: <20240715094457.452836-1-kernel@pankajraghav.com> <20240715094457.452836-11-kernel@pankajraghav.com> <20240716174016.GZ1998502@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B7CA2140008 X-Stat-Signature: bnatobmbxzknn1onjx8nncgx5biz81a1 X-HE-Tag: 1721169426-851727 X-HE-Meta: U2FsdGVkX1+Nd9tXBF21rEQxXvL8yC6qHBE5L7A82FFj5gyEG1M7HgYI0LXdh3T7+SnP8qhK5wo6+hEs5uUkE8zEeyUUobuUL7HFbURJpcW2XjYhgQ0WOrTF5j7CHFqydb+03XLC8iOWkEU7UPxbiu2TYfU6SR8iVv7HA5kkQl3pKc0epF+5OC0sP32VQWFsPdZOzo+YPPoO838Bz3id6vMV/mbDMQje6WvJa0nNawkJA6r9bfPXusKl6/uB5saURk2XNAlH7H6rAj6yemkS1ChBOms4pc3LLab4zD9r7jqaETTS7vdj9kra0IlRrzNbaG4Q6erO9lAylEsH5g1236L2UOPRjh1fUOQHWBUqXTBw2AolAp6hxmQRGu8DIwd8TbrIl42lufvXVRIMIFWbRLFJLibwH3DyjhVPSGyYW7f+tZAPkior/L1fUOrNO6xFXObgHdIGlAlBEBVOFKI0ZwhzGZXmA+JP/IFNLTvlUdWWezy/f4bfjR53vMUhpciJpoDlz2rOGyW8q329CUJcQiua978jEr5EUbBceWODiwVF9Z9fXpB4RWRT0FocmWmFEWI77UyzE0WkLjhcGEmnLpiu9K4H78vZ6ilNXgSvyZ3CpyIZaJShq9O+Rjif4wXYaV3ewAa4M/SKUX6Fr2kfWl5B3gz6vCVNn6Z95lfXNzCPi0xfV3Ca9jdR+pIJjGHzgvrhqoxv7UGWuqzPsIA8OH+9zJVh42aoOsptm0JSus+WdrdByWiY5vMfvLv6D+cPWtWEHcqAXa0BOSH84TVTh2XdMj8KTRDDpu8rnYogKFDTwFkGt13xKz21Lk90d/EBaIcZjY+bJup2/HyYZJSZkuGD3wE+y1aDHUiRuSJKLL9lafiiOvWcC7/D4Li97KQbwZ+vAKR0BkHShwXs+ZED0y76ciqW2/VaXFU+aOebJg12S/86rCixUCfvMJB0y2JxEgYoMlxD+ItUrLqoNR2 /faQgxAd 8k2Q7RSOeSgOGpOpgChIY6yfOPLxsNPrt64VqEkVHh+nm4IhU54x60x/U9QRian3BRzjbsxNcI/2gzgBCB0gXJzHNZqYVkkuuhc2qxov2ZiTk/moOqH/A+w8DvbChzGKxKN8QUUl4lnrPAtiO5YJl6vbAjG2sb/zCWSPtGyo3TK9F0RkGfGLvQnpp0e7lgUpfMvTtdHpfckgiAOW/Ol7gqWZp37it2gp+P4nL 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: List-Subscribe: List-Unsubscribe: On Tue, Jul 16, 2024 at 06:46:40PM +0100, Matthew Wilcox wrote: > On Tue, Jul 16, 2024 at 10:40:16AM -0700, Darrick J. Wong wrote: > > On Tue, Jul 16, 2024 at 04:29:05PM +0100, Matthew Wilcox wrote: > > > On Mon, Jul 15, 2024 at 11:44:57AM +0200, Pankaj Raghav (Samsung) wrote: > > > > +++ b/fs/xfs/xfs_super.c > > > > @@ -1638,16 +1638,30 @@ xfs_fs_fill_super( > > > > goto out_free_sb; > > > > } > > > > > > > > - /* > > > > - * Until this is fixed only page-sized or smaller data blocks work. > > > > - */ > > > > if (mp->m_sb.sb_blocksize > PAGE_SIZE) { > > > > - xfs_warn(mp, > > > > - "File system with blocksize %d bytes. " > > > > - "Only pagesize (%ld) or less will currently work.", > > > > + size_t max_folio_size = mapping_max_folio_size_supported(); > > > > + > > > > + if (!xfs_has_crc(mp)) { > > > > + xfs_warn(mp, > > > > +"V4 Filesystem with blocksize %d bytes. Only pagesize (%ld) or less is supported.", > > > > mp->m_sb.sb_blocksize, PAGE_SIZE); > > > > - error = -ENOSYS; > > > > - goto out_free_sb; > > > > + error = -ENOSYS; > > > > + goto out_free_sb; > > > > + } > > > > + > > > > + if (mp->m_sb.sb_blocksize > max_folio_size) { > > > > + xfs_warn(mp, > > > > +"block size (%u bytes) not supported; maximum folio size supported in "\ > > > > +"the page cache is (%ld bytes). Check MAX_PAGECACHE_ORDER (%d)", > > > > + mp->m_sb.sb_blocksize, max_folio_size, > > > > + MAX_PAGECACHE_ORDER); > > > > > > Again, too much message. Way too much. We shouldn't even allow block > > > devices to be created if their block size is larger than the max supported > > > by the page cache. > > > > Filesystem blocksize != block device blocksize. xfs still needs this > > check because one can xfs_copy a 64k-fsblock xfs to a hdd with 512b > > sectors and try to mount that on x86. > > > > Assuming there /is/ some fs that allows 1G blocksize, you'd then really > > want a mount check that would prevent you from mounting that. > > Absolutely, we need to have an fs blocksize check in the fs (if only > because fs fuzzers will put random values in fields and expect the system > to not crash). But that should have nothing to do with page cache size. I don't understand your objection -- we're setting the minimum folio order on a file's pagecache to match the fs-wide blocksize. If the pagecache can't possibly fulfill our fs-wide requirement, then why would we continue the mount? Let's pretend that MAX_PAGECACHE_ORDER is 1. The filesystem has 16k blocks, the CPU has 4k base pages. xfs will try to set the min folio order to 2 via mapping_set_folio_order_range. That function clamps it to 1, so we try to cache a 16k fsblock with 8k pages. Does that actually work? If not, then doesn't it make more more sense to fail the mount? --D