From patchwork Fri Mar 1 16:44:44 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: 13578751 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 9B520C5475B for ; Fri, 1 Mar 2024 16:45:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29C6394000C; Fri, 1 Mar 2024 11:45:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 24C00940007; Fri, 1 Mar 2024 11:45:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A02F94000C; Fri, 1 Mar 2024 11:45:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EA2F3940007 for ; Fri, 1 Mar 2024 11:45:37 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C9D6F140513 for ; Fri, 1 Mar 2024 16:45:37 +0000 (UTC) X-FDA: 81849046314.17.37B1F7C Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf21.hostedemail.com (Postfix) with ESMTP id 344671C0023 for ; Fri, 1 Mar 2024 16:45:35 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=rMBOipsj; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf21.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709311536; 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=5wzUd/M7ghnUlsNiIWLrpCm78wsb6uIwk5Sv3jrhDE4=; b=QbvqLsFLN6FutsogYpDI0zTsxk7qMEqPuvRkJbNv6L3NII+pXRm5RjfY60mVlYMMtS03rk u/QC02xZTdNOgVgzI0hnHLqXN8tYNxVRtM8HTavOjVzfh41BfZirXJA0qo+tAynh5D6xjR 6Art+puDncvwkvaXQRQpYJ8SAJXdNjE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=rMBOipsj; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf21.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709311536; a=rsa-sha256; cv=none; b=uKYU3N8DE3m2lAyDscTuTaLdLd5kga37ghMYKpz+XK8mm/nbN5okand87MbOqbadzOeO5r BB/TONvq3uCZRn0I9S7BSRmRWWVrplA6Jtp90vsc7BsTfYsjJwulB/QGfF3irbGxWGSxJJ vav10Ro8sBGPVTcKpS0zz46b+4ea2to= Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.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-201.mailbox.org (Postfix) with ESMTPS id 4TmYqc6nYkz9t8H; Fri, 1 Mar 2024 17:45:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1709311532; 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=5wzUd/M7ghnUlsNiIWLrpCm78wsb6uIwk5Sv3jrhDE4=; b=rMBOipsj2b50Vol+/PLPN13o213KX6Sgu4s0nw+xplKlK/aVb/eFPsgk0UgrZLst5NUnYW k7Cin8vOiTKFSHGKdhKHNxiiQnBbPZ/xOvRoIOozm0vRrDAZR0ivPF2OrA/Ahch6UutPr9 kELko29pYXU4rzAKp13u4BCCV0VMMTTIqQh4ejEPaMlEA3dRoSV60Gjw23hKzMeqH0d+tA 2NrlE4euJ9rYg5nglYG1aSRTkTdFTypuO423WTy6PT4qu3eOZpJ3FteUVUiA1NbDSNcoup XO1K1DNBNb8zy27CqmMtnKkkwSNOPs7SPGEMgxquqNsqTsxis0jqCRQqqyTSUA== From: "Pankaj Raghav (Samsung)" To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Cc: djwong@kernel.org, mcgrof@kernel.org, linux-mm@kvack.org, hare@suse.de, david@fromorbit.com, akpm@linux-foundation.org, gost.dev@samsung.com, linux-kernel@vger.kernel.org, chandan.babu@oracle.com, willy@infradead.org, Pankaj Raghav Subject: [PATCH v2 13/13] xfs: enable block size larger than page size support Date: Fri, 1 Mar 2024 17:44:44 +0100 Message-ID: <20240301164444.3799288-14-kernel@pankajraghav.com> In-Reply-To: <20240301164444.3799288-1-kernel@pankajraghav.com> References: <20240301164444.3799288-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 344671C0023 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: iibn8pac1ep5rrrbqz75p4e75cst8t1c X-HE-Tag: 1709311535-903546 X-HE-Meta: U2FsdGVkX19CNeL9XkKp2zVZyOHnYXQl0di3MCliNOs72gv4T/qPKYnIfyChkYM2LwWbd3TbuNDHL4U0l0YUIHRWuscx7/QgbQqTF/D9FZDv7ovVwocccbFZ6/dRc/RjA+IDthHGjrVSzGMQ6Y9Q+6D7O5I9lQEr4x8jaeKLJ8mML0MI94wSMNrxqGjRC2esELPocw0k5cCVV/FZnm9Gl6eAJhnSKsej3MeFTlBjfBUZbQ+IXvQehcgTmlMMp0sENAJEyyWJKiZh4YmWN5904zL3x1NjuXL18kEZjbkIukfEs7yc1Ct4oHs2y8M6f9uR6yTTNGUBcPUFoPNVZ/CCaroIh4JPEU8/Oila2aqOfTxY3h3PYQI/w/JYd29ziPmYrV2Kba6e2smt/vixCix/qZoDw8jFFfcL3KXDMm8VRMrjIcL5XbNjzJLamWSnK0Sj7BWkUW2nrqABlwRn3VZ1rhHSW94gtS2Q31pX47Wo4cN/iL+VHjfggQ5MNllwsjLp2QA6fktjkpOKBJClwm3ASvrsJeLPfggnMvf/3FYXLGc9vbBPgYQldXKeMyfxeMDrd5G1jTEOMPFhpRrgYj+ffIBqI5Iw4NDkyLUf1RF917n8kty082SzEi360k1eHg9I78NERZ83vxA9pty/eC0m6nNlUTt2IGbLJ3F8O0W7EjGMB5nG4+2LXXM2k4FB+jdHUqbfgRwn3Nat190c24XB99PTZdJowvz1Uwt3Ik2chR70vHr9bROJLNldBHj7Hx8FYRc1NIJfnrle642T0gUL0pSFBYRi1gLn2YeXVH/PtEAeSgZ+XCf3YlpkrzIHNkfXIjaUxIDtKesanF5tXUAfIM2oA75GpkIRqRZj6ucZoHbREYEksQ+Kvk5B93un1FBvclGu9eP6nF41+oONUHcQZSa3KBOh2QpBrzKt/zBSsFCx1TxW2VNdJ8YeszjcXGb7DU/P7uFl2WiGzpYv1Xg igLKJdHa zBPL1vWHVgErxJxe6+zQBxdn0kOxJQ2vi9dA7FB9Q/07H2hGm0rtUgR6U947TrL2JIn+DjvrAQit0g/BFrLRYryPfrQ== 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 9cf800586da7..a77e927807e5 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 max_index; uint64_t max_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 */