Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1049270lqd; Thu, 25 Apr 2024 04:51:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWC0xiUOzrH/trj1OlKvSB/v6bNLgJUef3XEwS2Ik0UwkG0PTzrvl4pG22WTE1EnUtVId0ZPAbr9opxbnTesgtMP9VM4s1IiK+uHBYLmg== X-Google-Smtp-Source: AGHT+IFjzJaEH0D0/TxfjYF/g0AAUxeC82ni+NJqP6wzfsz19OMgihxgev3gcdy+ALORUFGu+04F X-Received: by 2002:a17:902:c40d:b0:1e4:d548:81a0 with SMTP id k13-20020a170902c40d00b001e4d54881a0mr5710524plk.67.1714045880712; Thu, 25 Apr 2024 04:51:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714045880; cv=pass; d=google.com; s=arc-20160816; b=SgM9hYHvszRJr6BgxaEcu1DXfA20vbCpML4dnW3C5NOWCGnwFs4V9Vh+3XkITKrgcs +caPXeoJeGE8Qns/0TU9FqyOxZxLxW3DlDOwG0yuAywLYOuCWRqw16ZGBJAKGtISqzSz wZEAg6FjtAHxkVGGsc5A7FJyErfQJ4ypsez3+RfwXlxrxdm/d2fwg3Ar0Eo7DuXF9T61 SJWpP2fwqC3vsj+3F9ouM1ZEtBdKlZdKn4/ba3QFDPsTagyP36389NR1euAvICOPY3DY R+X15ApcchMd7buU9NnchmpXefBxY8Eppe1p3HzBdFDfTa/uZ1/LHG9AxbFTChJ2vsK0 uA5g== 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=Xr9yeLAhFPdiP5bQa/19/Lc9ERKBMv2dNCWngwYe54s=; fh=AC6j17aBHSL5HsK8cY4ELsf/ZPirpNG+gef8M2C/TAc=; b=WY7Le+sXH4mzOzvn99Bs9ukwDnblLz7wrLRBHX35oh3ajY7Gd0MOG4fNwZU4sNx4e/ sTOT6jH4iRNtml0RHxqeENa1p1wz0EJ/Vx8gtxmyNVltev0h/+9BnkYGPkd2HU50lmcY kfHHQhq7csmesNMYBdrFtuKqGkqxItViUMtW57Nv1Gwgvj/uym+kmGxJWjsHp1W6Q9li fUx7iLpMAaSr2zRiKM9IEwl16ywe/fonI0Q6sZPWK8FLVEhutyLhzuI4iRgKSYGNcX6f OVRGFHA7KKKHMdu6wb9nYh3IIfHiQ0zNE8zXL1HfUdM3QOTsBEQ3cgdUDOjudaNonCX4 lzmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=qZ6LTcj4; 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-158464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e3-20020a170902ef4300b001e8d0856c1fsi11566280plx.378.2024.04.25.04.51.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 04:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=qZ6LTcj4; 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-158464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158464-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 35DCEB25300 for ; Thu, 25 Apr 2024 11:40:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0437812BF21; Thu, 25 Apr 2024 11:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="qZ6LTcj4" Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (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 8A7AF12DD99; Thu, 25 Apr 2024 11:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714045118; cv=none; b=ZPv/hpq95pRvoIbOTSedmPOXdbiNH7+p8ywtfdfAxcqTLs6zmZn2JJsRaxrb+QQbdV0zBGJPKbpnImlBXqSXW2/NtBA8TTOdnHxtoQLLXs9fMSJ2x2L21cqHbBJ9VR6A9OMLP1lAEdOVR4s5eD1nVKiIKqurwIUpeJP/xjLEqzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714045118; c=relaxed/simple; bh=TJIZdpHmJG9swkIw5uEiYbYYbhmGY+zC8S7LBps8Xic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eFv2dvICFMlgUm+V6RZ6X6Vqiz3nVJlzFDsGMYxNE2hYslGYhyvEraigNeGlyUmNQGfwu5N4clBRCMvSExuwBD2bXkwIFqF0QVwrJyMMLwaShSBlqPhNe7y3nOv3JO4C9wAkyvk1dNQHBxRmLA12ZddCnKOHcT+ixYlVilQrrI8= 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=qZ6LTcj4; arc=none smtp.client-ip=80.241.56.151 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 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-101.mailbox.org (Postfix) with ESMTPS id 4VQDQ12C01z9sWy; Thu, 25 Apr 2024 13:38:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1714045113; 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=Xr9yeLAhFPdiP5bQa/19/Lc9ERKBMv2dNCWngwYe54s=; b=qZ6LTcj4Mi7kgadnj1OzMKN/Iop3ThPOJ/gYL2uMPgOTLUO+rN0Br4nAhEMODvtNkEH51Z /n9ysdoccT78ZdOJBu7ME8LXFbUx0PjzDm4A2pLgbJfNABv6x462zHw2tCKwqOSjublJXy hFZs6PTWq5pKg3FQ7khiOiJ9i+CPFke5gT5AtK3+z1abZpIl4xP4K2bXY89Y1cKWXOa4dO Jk5HGQqId3wJL5tLfFrO+lXaDZuNtELeYTUf/c7vvFqTjD0fqfVF/WuHKQa6qVyIEahElu Rr9NLaI6azL9hy8cYsmi7pUBI6xkLSihpOM3vpVRsXvWKcb4XSYC6rPNnLT/sw== From: "Pankaj Raghav (Samsung)" To: willy@infradead.org, djwong@kernel.org, brauner@kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, hare@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, mcgrof@kernel.org, gost.dev@samsung.com, p.raghav@samsung.com Subject: [PATCH v4 11/11] xfs: enable block size larger than page size support Date: Thu, 25 Apr 2024 13:37:46 +0200 Message-Id: <20240425113746.335530-12-kernel@pankajraghav.com> In-Reply-To: <20240425113746.335530-1-kernel@pankajraghav.com> References: <20240425113746.335530-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 X-Rspamd-Queue-Id: 4VQDQ12C01z9sWy 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 e5ac3e5430c4..60005feb0015 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -2975,6 +2975,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 dfd61fa8332e..7d3abd182322 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h @@ -229,6 +229,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 74f1812b03cb..a2629e00de41 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 56d71282972a..a451302aa258 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 bce020374c5e..db3b82c2c381 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1623,16 +1623,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 */ -- 2.34.1