Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1100879lqt; Fri, 7 Jun 2024 08:03:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYvagZM38R3SzgRGAWHd5KCw/HQcl3qXGqWygGTQ15HTxMEpHTGcjso613lblN6n/CEA/LLPYslLHrsofFrOet6blJPZ928kMywrtCOA== X-Google-Smtp-Source: AGHT+IHlIZJL7G/cRIznzcQ7T4gD+BgF/jbytr9qaa9ldUROLB2JjiqG83ZLZv9YYzWdM7yYP4ef X-Received: by 2002:a17:907:10c9:b0:a6d:fd81:8f7d with SMTP id a640c23a62f3a-a6dfd90d34dmr108368966b.35.1717772628860; Fri, 07 Jun 2024 08:03:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717772628; cv=pass; d=google.com; s=arc-20160816; b=jF4aDmunY9K1HnolO5xijzoQqZAT9d9B253XcbPYlDufL79SSzKqhuLedpXn8IAic0 IvL/Wyp5mqEE0gLKFqxZ8Q6YNigMzyWxGI0bTRssq7LiOTmCYlq32ybs0Pa+TJl4xlMh +TLCdRIuy2RSAfcdyBxoYiJ+UucCqu+FTPObelLiKG4vugjM7c7mfZEVkC4M8mXMaueu dqiTxvSB3u6VDPR7QdIqjRBsH1jILwft3cCAFFMtpghpRX/OjlnR7F+Ow4uioO7vQ3gX 17Z1U1Ix5mIi2nObIr6CRiXVcLXdyQYJViDKbQ9cwnBW6GcXnUdP1oyGXdBbVj8NO6US sECg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9vXYgSxRyUppcEZmCRlqS1p5lc/MCHDHslK/G0CWBeg=; fh=pqFiGWrwOnMOz7J5JEcls+uL5JrBxW7q4gBZg6HAuoA=; b=FMrO+nlRz7yYArfA8aQhLh+pfC5oe/ao2aqz8Idk1JYvsDIoBp+y5edIwjS6OgeG45 j0pRYYUzpLgTX6kT3gBSTm+C/lEFNU5kwF8VfMEiQycIgAxneR730/E0nWeHurnQfj5J QFX3WWpVph52DIQemn854efMIMNmy8zBKa6LZADfVMhgIpvzpPUcnVfa1Ml6BwEN6Ux6 dS6Px7O1//KDHMdVgznCT9izQGSiFomQC5CAIKOq9g4bQJ5PYq1z15jwKs0l8I5/c03t OcQilnetn25H6vHn7naRkf7FcBRa0b1K7OxAYoj9Yrw9dmFa6X0QkA6+yf/MT2j6ToLs 3/tQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=xI6YI1vM; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-206337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80748149si193279466b.913.2024.06.07.08.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 08:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=xI6YI1vM; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-206337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B7371F25F85 for ; Fri, 7 Jun 2024 15:03:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C82919E7F3; Fri, 7 Jun 2024 15:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="xI6YI1vM" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6E5419E7E0; Fri, 7 Jun 2024 14:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772399; cv=none; b=IRNziBYa/KHy0THKPC0RYW2L7UpFbN4k+8Iins3A12bSOZcuBz1E7s6677E01LZB5leycAjS2+Z3UtWUoL+UJWnzvCJF8a37/91C8CsBJCvoHV4f1we6ZloN6aCDH4t02h9Pi56LeGVBNusVayt/ndTPrNrHYax5UXtAERTCyPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772399; c=relaxed/simple; bh=EmTqGE3ZvWlOqEFX6X4AvFp9DIkmcGEg7sqUyfmuXr0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rkDZdipXDlWeUNcMx9L+ycwoaRo1l2oSGRy3cjy1Jat9j9s/OGN9ZXMfxSp0JxmuC3+NP+awZIIwTFAeM4qfiSzJnfSkBF5IBZyoyJTi9JO9Aq/kkUqTHrOQ8Bcp8pMwwsRu7eKv8aqvXIZX81/ybgOVnwKQbExQkQ11easYmUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=xI6YI1vM; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com 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 4VwkrV2rnVz9sZS; Fri, 7 Jun 2024 16:59:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1717772394; 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=9vXYgSxRyUppcEZmCRlqS1p5lc/MCHDHslK/G0CWBeg=; b=xI6YI1vM1H1/ZjtAWLYXlEyhjVfEgiFVm+IOb4aP6oO9OsaYYEFEfmH/q1rDW1In2Biwz5 5rIXG/pNhXxtoegWKWgJfGO3WfQLKHHfCxqjr8QK+3gX08tjTqUJ8V616NTECLo3IV2hzi gIkcMCJCVJ50L/SEL5voxRVc0ElELkW64AbYcGod1KcUyz4CIaWqirZLQgFNW3goGUcA+g LeN+UgpwOVClQ6AFRS2hScRrskVOJ6oYALJeagygISDlQMdz4hJWZaknxgysxDQBT5hYxj 7yjRzzmeXuu6xHTlv7/Y9U2IbOciSs04WqUwILZp+aKSpUbtLyQgnr6wT2O3cA== From: "Pankaj Raghav (Samsung)" To: david@fromorbit.com, djwong@kernel.org, chandan.babu@oracle.com, brauner@kernel.org, akpm@linux-foundation.org, willy@infradead.org Cc: mcgrof@kernel.org, linux-mm@kvack.org, hare@suse.de, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, Zi Yan , linux-xfs@vger.kernel.org, p.raghav@samsung.com, linux-fsdevel@vger.kernel.org, kernel@pankajraghav.com, hch@lst.de, gost.dev@samsung.com, cl@os.amperecomputing.com, john.g.garry@oracle.com Subject: [PATCH v7 11/11] xfs: enable block size larger than page size support Date: Fri, 7 Jun 2024 14:59:02 +0000 Message-ID: <20240607145902.1137853-12-kernel@pankajraghav.com> In-Reply-To: <20240607145902.1137853-1-kernel@pankajraghav.com> References: <20240607145902.1137853-1-kernel@pankajraghav.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Reviewed-by: Darrick J. Wong Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- 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 14c81f227c5b..1e76431d75a4 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 34f104ed372c..e67a1c7cc0b0 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 0953163a2d84..5ed3dc9e7d90 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -89,7 +89,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); @@ -324,7 +325,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 46cb0384143b..a99454208807 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -135,7 +135,6 @@ xfs_sb_validate_fsb_count( uint64_t max_index; 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 27e9f749c4c7..b8a93a8f35ca 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 */ -- 2.44.1