Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp93118lqb; Thu, 14 Mar 2024 06:25:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDUAz1Urfm6efTHhVfbFiXg5bFQ3/EkbJhlknP49L0PQEwOAhCkO6BCG3lN3r024IMoNb5FqeeKeb1SL2htshaQCLQBfkCSEzIIti+4Q== X-Google-Smtp-Source: AGHT+IFI/lISbwSAw05yLJkKdEryuSBlFr6SkMD0gAeslCYYrJhHigSkarQfnUffY1qd/0F4qwPr X-Received: by 2002:a17:902:f7c3:b0:1de:dc8a:3cd3 with SMTP id h3-20020a170902f7c300b001dedc8a3cd3mr1109352plw.64.1710422737484; Thu, 14 Mar 2024 06:25:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710422737; cv=pass; d=google.com; s=arc-20160816; b=VpmH1oq+rEKy3P/UN4Dwa1UnOAEzaIHeRBdZJqoHUmp9Na5LCoT3bnGmFx0cZTtwo0 1yFPGTs3mXEQToMOqsX099RjAmWKPm4vRRVnvigdHjU21NB5pkoXiu3YkevCr0kE6l3j HCZA7IFeQYH4wYWAXhyXW+v45pH2Z+EREROamUaezow5gaftUop2i9PFkfbvFY8TTJ3c J2lcBOpACJ2uZYUGL3ahfpdDzbz7D6nY2Mi3adoI2+bmjA+sMGVJ8vPS5mbtznDgTrAm KN3XqVoVuKavlCw56ejimBCd4pcwCU4ExpONH53q5b8ShXIKPKo9Uw5iCOTQmErvSugu aahg== 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=K/DUVmmSdMYXfogG3VkAiYhU6qYgNVi5gtPJ5i04LEI=; fh=j3uz2NgZFfq57/Snoylk35aIHaL6SCDmmQDWQGY3sTA=; b=Uk4OaUmhJHi7R//yqDceH1njWKGNGjenSKlNyMfvvJZzdPrvvj9kLnIVU/FvbY/iLx WBW+Rr0V6JN3h9EyiOA2PsbHEiYXrV8GzbBXgr5m4YOXNNHdgozzNQ4qNI8DGFhceNRi 4gwcO7qcE+AtKEnrKA+vCP9eAe1NM6F2JbNspOFHsErdMmzw8ud/LjjXcSrlqGeMqU2w CC37WX2HlNaDjV5BopT/TDNzjJ/jgJA0za8GD7d0sdOlGkWG3cLwk5H516prbVE1DqyX Nr4i8RCdwiE8YuXmS2NKXZqgWTJSPO2A3X0CCZ3VG2rNiM0lUKDthDjLtY06gOPoze1p jLUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=Qsht05+U; 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-102182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102182-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 u8-20020a170903124800b001d99f863c65si1456417plh.154.2024.03.14.06.25.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 06:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102182-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=Qsht05+U; 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-102182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102182-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 75A3FB21F13 for ; Wed, 13 Mar 2024 18:19:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8412519A59C; Wed, 13 Mar 2024 17:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="Qsht05+U" Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (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 1780019A56A; Wed, 13 Mar 2024 17:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710349424; cv=none; b=qEOGB3w0Rb6DOrK0TxK6LjA5jOywhgViD8w517wOK7yTxx21mqi8lCt41+LaJoHIaqVe00TGpXvbTks+Fgish6Syfb3VMTMuPcy07MqnFAlkuTg43+tOAIwMNFxfxUeYInL5kNMlFUaCK6nk07h9Z8WOIF6MYaKY2nEIQ3wL/P0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710349424; c=relaxed/simple; bh=3L4GbT2GGY6ZkVB0Gbmb4Xhq7Pezq97Uzm/KdVsUIvg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aIYuPuy2L5vPXnb0ZY8sPafwDYe3mETGWRhNeRff+hHfSuxbCwnRe1KgRbIhwyjeiFW+o0JWbAjgYh7U/fDnf1TZ6n4iXOoKSyfuyaht+8ksbmv3jPQNUMTeR01RezyUFvyI68QlmkKBGeJvPTEZFu58SFRVKFMT3AP6I0FCmLM= 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=Qsht05+U; arc=none smtp.client-ip=80.241.56.172 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-202.mailbox.org (Postfix) with ESMTPS id 4Tvxfz2mzqz9srv; Wed, 13 Mar 2024 18:03:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1710349419; 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=K/DUVmmSdMYXfogG3VkAiYhU6qYgNVi5gtPJ5i04LEI=; b=Qsht05+Uu/iP54oqngBXP2qLeNxikfv1Eh/QI13SRmymWufjW1qsMdPY+89rtgm6i4g39y SWW8c6kh0MkZTAY9/vDjZV0NUuGdfEDYIvP8SiXji0DUHluzyiOXftszOjn9q5H1LKy/1C Wmuim/RYXM+z/vXQclsx99izmsENZc4h3Rx1QHNx1sH/37t7Egj0nIEXHyTQVY2eGhYv6O juM46526/LJPKkmSZaGglSY7Z+d/pVduLN+qUMl02bRL2+VEd2C2B1ztr6Pz8AjlF74Dwr r544zElg3fjru2Ijy1ZG+m2sSurj0ux4aO+w3OnINoA1SJvA+sNnSqIZUgG9Vg== From: "Pankaj Raghav (Samsung)" To: willy@infradead.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: gost.dev@samsung.com, chandan.babu@oracle.com, hare@suse.de, mcgrof@kernel.org, djwong@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@fromorbit.com, akpm@linux-foundation.org, Pankaj Raghav Subject: [PATCH v3 11/11] xfs: enable block size larger than page size support Date: Wed, 13 Mar 2024 18:02:53 +0100 Message-ID: <20240313170253.2324812-12-kernel@pankajraghav.com> In-Reply-To: <20240313170253.2324812-1-kernel@pankajraghav.com> References: <20240313170253.2324812-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. 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 98401de832ee..4f5f4cb772d4 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1624,16 +1624,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.43.0