From patchwork Mon Feb 26 09:49:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13571771 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 25550C54E49 for ; Mon, 26 Feb 2024 09:50:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A240A940027; Mon, 26 Feb 2024 04:50:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D4CC940028; Mon, 26 Feb 2024 04:50:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8267C940027; Mon, 26 Feb 2024 04:50:42 -0500 (EST) 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 6EAF6940014 for ; Mon, 26 Feb 2024 04:50:42 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 510F11C05BD for ; Mon, 26 Feb 2024 09:50:42 +0000 (UTC) X-FDA: 81833485524.23.6B3A6DC Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 91EB818000D for ; Mon, 26 Feb 2024 09:50:40 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="r/dmaeu8"; spf=pass (imf16.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708941040; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TxspCYGvd47S6sMZqiF8IxyiXSLrdsbW3Rzpn1A8oVs=; b=EulM5YpPDhCrMh5pcXU70gIVSUUMdwXGa9kmulIrkrWq+ztZDX2PqVoTv4ZNqAF1NH7+u/ NDtrm1nkqUNtX+Ys2WP98yoaYiFC7sq4PFNPNmCNkKx4itBGzQ0VD2IwouVU1IURcFm240 7siULBmZGpCODfDgfpXgjO5vcGdThcM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708941040; a=rsa-sha256; cv=none; b=JrANLiuMZcRop+CElhtqaV79wh0Y4ZT+LHJFknnaEYIWDU2/NHOzWp9YkVqJAn03v9LpMm 3RVf71uq5Rtjqc8SXeky36RS0g/jtQSra0N9DNTklamGKXrBQKMHI+N8frc1o6m/skzWY1 eo/rJeTwTdTTh6M5EjGXeBYP3/Ml/h0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b="r/dmaeu8"; spf=pass (imf16.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (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-202.mailbox.org (Postfix) with ESMTPS id 4Tjwpj3Lszz9sd1; Mon, 26 Feb 2024 10:50:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708941037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TxspCYGvd47S6sMZqiF8IxyiXSLrdsbW3Rzpn1A8oVs=; b=r/dmaeu8ky0Zitwk6d/p71mCATrvYsjhMj+pqGiiXKmkR/JFZzQ4UzKBr1JYGDYt7Xmey+ 4YlsyGLVY0JeTsSAfX9QD8ohDznFOefXqdL91rLdcOIA0b1DC1jKooTiTD8P0N5Otpz96p FcEQHn9pTyCODOwN1oCWuNkBxQtVNSDXAYq2A1Cb7+uZg+SFwRAQhVuH+UxnnR2HHXDPnr lu6+d5f2UIJPqHRvfkqMvtKaGXc4xWYIrcigS98zQJZKP+4F+ZO7iCuF7Us0aVsFsSJ5W/ fzYF/GIvrVQbR8vvaMZ1Xxgb/Yz13ovRc4iCTJuTdI+c/VrA577/Qf+r01F9TQ== From: "Pankaj Raghav (Samsung)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, willy@infradead.org, Pankaj Raghav Subject: [PATCH 13/13] xfs: enable block size larger than page size support Date: Mon, 26 Feb 2024 10:49:36 +0100 Message-ID: <20240226094936.2677493-14-kernel@pankajraghav.com> In-Reply-To: <20240226094936.2677493-1-kernel@pankajraghav.com> References: <20240226094936.2677493-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 91EB818000D X-Rspam-User: X-Stat-Signature: 63d69mw776a9jpiz647ptd3z73njwcr5 X-Rspamd-Server: rspam03 X-HE-Tag: 1708941040-438525 X-HE-Meta: U2FsdGVkX18Tg3IHcoEUBjaKZqxlNR1nm+eadeMZ3WwK5eJxn9b+tPWUIePx6CSidn33eWCEIbmBAdjPu0CfvkusbdxJ46BGWLVAjDRf/B4KdYapT0aDhWgO1WdvNClnQFudnyxAJZFg4efdu+/D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J6UxqNqztOS5fDx2HGUxuPlj2r343pf5oMVYpa3I5RudyFEB2sO70466Qb7aAZtETpBFdGo93lSZZc/0hbxH8+KA3j51AoX9VJOFKoojkfKbssTqCQAz4gvJhOyPuxVGPjyvE5DeyEutS8MwER4awMJz7oUQ= 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: From: Pankaj Raghav Page cache now has the ability to have a minimum order when allocating a folio which is a prerequisite to add support for block size > page size. Signed-off-by: Pankaj Raghav Signed-off-by: Luis Chamberlain --- fs/xfs/libxfs/xfs_ialloc.c | 5 +++++ fs/xfs/libxfs/xfs_shared.h | 3 +++ fs/xfs/xfs_icache.c | 6 ++++-- fs/xfs/xfs_mount.c | 1 - fs/xfs/xfs_super.c | 10 ++-------- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 2361a22035b0..c040bd6271fd 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -2892,6 +2892,11 @@ xfs_ialloc_setup_geometry( igeo->ialloc_align = mp->m_dalign; else igeo->ialloc_align = 0; + + if (mp->m_sb.sb_blocksize > PAGE_SIZE) + igeo->min_folio_order = mp->m_sb.sb_blocklog - PAGE_SHIFT; + else + igeo->min_folio_order = 0; } /* Compute the location of the root directory inode that is laid out by mkfs. */ diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h index 4220d3584c1b..67ed406e7a81 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h @@ -188,6 +188,9 @@ struct xfs_ino_geometry { /* precomputed value for di_flags2 */ uint64_t new_diflags2; + /* minimum folio order of a page cache allocation */ + unsigned int min_folio_order; + }; #endif /* __XFS_SHARED_H__ */ diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index dba514a2c84d..a1857000e2cd 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -88,7 +88,8 @@ xfs_inode_alloc( /* VFS doesn't initialise i_mode or i_state! */ VFS_I(ip)->i_mode = 0; VFS_I(ip)->i_state = 0; - mapping_set_large_folios(VFS_I(ip)->i_mapping); + mapping_set_folio_min_order(VFS_I(ip)->i_mapping, + M_IGEO(mp)->min_folio_order); XFS_STATS_INC(mp, vn_active); ASSERT(atomic_read(&ip->i_pincount) == 0); @@ -323,7 +324,8 @@ xfs_reinit_inode( inode->i_rdev = dev; inode->i_uid = uid; inode->i_gid = gid; - mapping_set_large_folios(inode->i_mapping); + mapping_set_folio_min_order(inode->i_mapping, + M_IGEO(mp)->min_folio_order); return error; } diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 69af3b06be99..c7df1857195c 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -131,7 +131,6 @@ xfs_sb_validate_fsb_count( xfs_sb_t *sbp, uint64_t nblocks) { - ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); ASSERT(sbp->sb_blocklog >= BBSHIFT); uint64_t mapping_count; uint64_t bytes; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 5a2512d20bd0..685ce7bf7324 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1625,16 +1625,10 @@ 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.", - mp->m_sb.sb_blocksize, PAGE_SIZE); - error = -ENOSYS; - goto out_free_sb; +"EXPERIMENTAL: Filesystem with Large Block Size (%d bytes) enabled.", + mp->m_sb.sb_blocksize); } /* Ensure this filesystem fits in the page cache limits */