From patchwork Thu Jul 4 11:23:20 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: 13723630 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 8CEFDC30653 for ; Thu, 4 Jul 2024 11:24:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A3376B00B6; Thu, 4 Jul 2024 07:24:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12D596B00DC; Thu, 4 Jul 2024 07:24:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE8F76B00DD; Thu, 4 Jul 2024 07:24:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CDCBA6B00B6 for ; Thu, 4 Jul 2024 07:24:11 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4E571C0E52 for ; Thu, 4 Jul 2024 11:24:11 +0000 (UTC) X-FDA: 82301836302.04.289CF5D Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf30.hostedemail.com (Postfix) with ESMTP id 836D18001A for ; Thu, 4 Jul 2024 11:24:09 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=oBjypVax; spf=pass (imf30.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.171 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=1720092225; 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=nv7t1+SeZeFQOoZa3NhjLEVFIBlYMe3kqcm8FqgaxW0=; b=mBEypkvzBClv7KJxkSkBrlyXIarFzJYRyybWPhJjbZEV+qiiUlFqLT++Wk3lYCN4q/rlO5 g7KGA6KTqsQ0a3RC6xS291MsKjjPpGYuT+qO1MNOTOqaLq/W0YV/e1DVF7Sli5Y3+GNib2 3uEhRelSxXDSuE7Gryh6CTVQ5NQVifY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720092225; a=rsa-sha256; cv=none; b=3ulAEKPg8BGNHdVJhCJdpeZ0PKwaLUbQddLc2dNuirEIFjytUVHRHL15V3Hkam5ft5G4sJ rAheybDeUTRpz+aeDch9LrKAwfCwBVKPhXMCPq9y+GWxLLHnI/I+LLLqYsj82TyxzS/936 GMlg51p56unJD3di4jy+xt2dG/PLeQI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=oBjypVax; spf=pass (imf30.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (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 4WFDn23JWSz9tKk; Thu, 4 Jul 2024 13:24:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1720092246; 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=nv7t1+SeZeFQOoZa3NhjLEVFIBlYMe3kqcm8FqgaxW0=; b=oBjypVaxqJ1LHw3Y9yNKjm7fdKkn3SIqDFYY6OEEqE+hDdibf+1lIRmUFuqrzhEiB5Vs+h 4DPN1I9ZeW4p3vRCe7DycD+Be8/UfCPP1PirdIVgPMrsV1g8SRlYGsHAR4ZgknqqqQuIbq Vn4dm8CMLGtq5aiEFEOkqeq2+DzBNitczvEVvwmfX5kraSdYuvhu/WlwTCp0xTl6l5LUyb brq1I1JnBgyGWOQd5z3M/2FQwpNcq3Wzr/Z/zbr4y9F5JRRroT9IBQW6J63SX4ddhIpY/Y C6LnNjsYXkFuk/HdxqO9So4eOxecg4OmSvD/FO6s8uVE1NF3gPQbvL9VhxSb6w== From: "Pankaj Raghav (Samsung)" To: david@fromorbit.com, willy@infradead.org, chandan.babu@oracle.com, djwong@kernel.org, brauner@kernel.org, akpm@linux-foundation.org Cc: yang@os.amperecomputing.com, linux-kernel@vger.kernel.org, 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, kernel@pankajraghav.com, hch@lst.de, Zi Yan , Dave Chinner Subject: [PATCH v9 10/10] xfs: enable block size larger than page size support Date: Thu, 4 Jul 2024 11:23:20 +0000 Message-ID: <20240704112320.82104-11-kernel@pankajraghav.com> In-Reply-To: <20240704112320.82104-1-kernel@pankajraghav.com> References: <20240704112320.82104-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 836D18001A X-Stat-Signature: 3cie9zdskjj4dpixozmekwkwhgo4i745 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720092249-179799 X-HE-Meta: U2FsdGVkX1/DxMlf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3d1VZLR4QHbZy8pEGpvjGlaoFm5j9J9A4UoZQOYElpEgpDCZVH1gbU2EJ3gG1pwq4fEy1uvkqgZM//n14Y3QPNMXHrgAIZWg0QMeJ6s67/QdRQmr58gEC7POu0+867w1MY0WHEkyig9eqqZVUR1x6l29ehZ81/+JJmEGRlBoCzm9tCZE6YTCJuvaO+6CIZtgcHFdy8r2d+jZZAX5r9wZwF+ 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 Reviewed-by: Darrick J. Wong Reviewed-by: Dave Chinner --- 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 | 18 ++++++++++-------- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 14c81f227c5bb..1e76431d75a4b 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -3019,6 +3019,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 34f104ed372c0..e67a1c7cc0b02 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h @@ -231,6 +231,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 cf629302d48e7..0fcf235e50235 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! */ VFS_I(ip)->i_mode = 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); @@ -325,7 +326,8 @@ xfs_reinit_inode( inode->i_uid = uid; inode->i_gid = gid; inode->i_state = state; - 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 3949f720b5354..c6933440f8066 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -134,7 +134,6 @@ xfs_sb_validate_fsb_count( { uint64_t max_bytes; - ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); ASSERT(sbp->sb_blocklog >= BBSHIFT); if (check_shl_overflow(nblocks, sbp->sb_blocklog, &max_bytes)) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 27e9f749c4c7f..b8a93a8f35cac 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1638,16 +1638,18 @@ 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.", + 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; + } + + xfs_warn(mp, +"EXPERIMENTAL: V5 Filesystem with Large Block Size (%d bytes) enabled.", + mp->m_sb.sb_blocksize); } /* Ensure this filesystem fits in the page cache limits */