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 5C2C4C3DA42 for ; Wed, 17 Jul 2024 10:02:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8BE46B009D; Wed, 17 Jul 2024 06:02:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3BA96B009E; Wed, 17 Jul 2024 06:02:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D03106B009F; Wed, 17 Jul 2024 06:02:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B39C96B009D for ; Wed, 17 Jul 2024 06:02:32 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 53AE41409BA for ; Wed, 17 Jul 2024 10:02:32 +0000 (UTC) X-FDA: 82348804944.25.4CAF3EA Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by imf21.hostedemail.com (Postfix) with ESMTP id 6D1371C0022 for ; Wed, 17 Jul 2024 10:02:30 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Dlo4sxwn; spf=pass (imf21.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721210530; a=rsa-sha256; cv=none; b=S4TXiCPIK9Pm4bk+FJjv2+7WpkB954QdYx+QBjIe3WSQi45jbiUHBUJZ7Yt3la8CzpjKGs GkkZl7FW3ijcdYoNLelxMS4uvK65QOBWwV0+rlHwY/5qafG4u/UmkGJMQLqy/fBCYl0Ho6 c94h5dx4ZQbcNVBICf7acyMaRWX9vOs= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Dlo4sxwn; spf=pass (imf21.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.161 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721210530; 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=YQLwtMiKThXyfOPp8jc/dtC59kYpr5zUV9WlubZ4kZM=; b=2DzAUjGrkVpSxaGCQL9RHjB1dXExDlHzdVkbHsd0UI+nMzNAC1zMBsboGSKqEtNyuqKSol V1z1sNz09Y1OiUAKyg01i4rg1dPQetccpfDscLdK42vwwk3SvrhCCuuda+G3ndQxemlCji wOVwxVbyglik6vBV1mTraP5AEu7/e40= Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4WPBLn4xyMz9sbt; Wed, 17 Jul 2024 12:02:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1721210545; 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=YQLwtMiKThXyfOPp8jc/dtC59kYpr5zUV9WlubZ4kZM=; b=Dlo4sxwnsrXcYrRd8hBQHZv4Bc3AnO/xq1e/zndQbW4aEkYWYOzqAun7Eo/A9x2pra12bH 21EOkvFljmpzmsAl+7MEpx/RUx96v2tqgp0Ied/a5J7DHSQpsOOvgaB5XLjexMuI6opnzZ qBzsPXzCMR4Pu93beFjHlZD4RdvaRSKkwGpB7fW1M8ZvlkSX4GjQswsam0XQTBOUuWqxjl gMWvtY7gqD1M6m0hWsbQX4/f+VNl/ks9JcdpylrITjnUdTmtwkIwxVdN/eojXe0Q50dlMN X+3GpMcJ7xLQ4tciFbseeqfWxE0KKIDyJZ6+vW7flWX8YWXOlzDHu6P1S8Gkcw== Date: Wed, 17 Jul 2024 10:02:19 +0000 From: "Pankaj Raghav (Samsung)" To: Matthew Wilcox Cc: "Darrick J. Wong" , 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: <20240717100219.ntadlclud6eabrso@quentin> 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-Stat-Signature: retrd5z9w9f1joxsc1ihxzdwxo4ys9ck X-Rspamd-Queue-Id: 6D1371C0022 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721210550-999835 X-HE-Meta: U2FsdGVkX19nB3ED5YItZuffmHOVcq7vi6B0YCRJQgJgO8dRKEOMnY8tC0ZeZ8jbz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Rit51UmR12s4ZJdQAdxg45H8sKNvBtBCa+sgyO7qVWGtzzoJG3tF31684elR6zdIlNEZleTgbGr0xAF7wu3iRIGh0/tr681cjd4BNAarUoPYfzZoC4fVr4uiFPzNjr4y3mbFCM28M9We8x69OQjrFmLrceck7GKrUizv8vhuqqm96Y48EyttfqZwUKEbKRbv9rq3GB1NzX0H6xLkP8AyVlS0D3kxLPg== 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. Ok, now I am not sure if I completely misunderstood the previous comments. One of the comments you gave in the previous series is this[1]: ``` > What are callers supposed to do with an error? In the case of > setting up a newly allocated inode in XFS, the error would be > returned in the middle of a transaction and so this failure would > result in a filesystem shutdown. I suggest you handle it better than this. If the device is asking for a blocksize > PMD_SIZE, you should fail to mount it. If the device is asking for a blocksize > PAGE_SIZE and CONFIG_TRANSPARENT_HUGEPAGE is not set, you should also decline to mount the filesystem. ``` That is exactly what we are doing here. We check for what can page cache support and decline to mount if the max order supported is less than the block size of the filesystem. Maybe we can trim the the error message to just: "block size (%u bytes) not supported; Only block size (%ld) or less is supported "\ mp->m_sb.sb_blocksize, max_folio_size); Let me know what you think. [1]https://lore.kernel.org/linux-fsdevel/Zoc2rCPC5thSIuoR@casper.infradead.org/