From patchwork Wed Mar 13 17:02:53 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: 13591608 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 3CDB5C54E66 for ; Wed, 13 Mar 2024 17:03:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55A248004D; Wed, 13 Mar 2024 13:03:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E266940010; Wed, 13 Mar 2024 13:03:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E8808004D; Wed, 13 Mar 2024 13:03:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 14684940010 for ; Wed, 13 Mar 2024 13:03:46 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D788E140B23 for ; Wed, 13 Mar 2024 17:03:45 +0000 (UTC) X-FDA: 81892637610.27.753ECEA Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf13.hostedemail.com (Postfix) with ESMTP id D4ABA2002C for ; Wed, 13 Mar 2024 17:03:42 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Qsht05+U; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf13.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 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=1710349423; 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=K/DUVmmSdMYXfogG3VkAiYhU6qYgNVi5gtPJ5i04LEI=; b=1Q0bzqbLqwU8YJWT2QXHhiHYOGSZoAv9KPkb96hSfIfrsVZQN7VnfT8KPUqRw2mRY/Z1rK /U8z9nJzsmuDRj7M67Gvox5SC0c0/HQgMeP3Ro78OUEUzRB15IzJCQ/PG7j0gE4p8o0/cA SzYXxKRbKajLzq5xExR/0Qk2WE+FOg0= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Qsht05+U; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf13.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710349423; a=rsa-sha256; cv=none; b=g303VBzvzRHxWdeEr9k1PO03+wPElHx6SikjHwKRc8ZwQAuH94qQS3Ejw8Ttazdx0QkfJf +UlWrZLovsbm1RLp0EKZ4tX9V6aKIv9bHj8h3akwuuJK88C2xhPvHIYXJAimoJliaIF8PH XBzUOfaPi3LT3s0dI4hAsDyUlLk4Dc4= 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> MIME-Version: 1.0 X-Rspamd-Queue-Id: D4ABA2002C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: xgm5qz58h6e4813abz6m1p9dwjckiyzc X-HE-Tag: 1710349422-571812 X-HE-Meta: U2FsdGVkX1/biLZxlT32q6aIle9RSb7GWEDXkS4wzSWA56dAx6AOjWSiYA9LU7jjcSWdKn5oOcqCAaAR93bakjS5E4n+TM5vnRelvnqNzdLzMQrEf0KM52HQSVp/pI/oysAcjogF3xHde2SkoXISCkvyk4muDHOTKIs03+d+xvwAbwnUXuWybGVXJQ49TltJCU1lbVMPs3KGWO0KnQ7eEMRjjRC1XYkWXaTzb1VmYdQ5kIZTXaBNBNQKtn5G802soiUsmLSnob4fsgCp7W0xxS6z6hbXa42iRpeuHp4GAStnNPCFLV4rtbAkPUKCn24eDSBY6ohGpbieyB+qkk6Uc+Cl1CbgXyayhSezwv+WyDr7sZ1A+MjzSB3IxU/rotxTiIK6+wqyn2uGHQF63xmP1dABILvVGFltas3tE9nEEhr9OyU28v8XKshmGqhja6xGtU6IcMmOACqbNsnao4JIMifc9HBtEMzFYGvr4jDvYfM7DbZ0kM1lu2t19/ptmswnJsZ2SHJ/KPk81oKynq58eW/WFndz8lszojffBsCzckGnHkPvNgHGginI6jBWpoaoMWxcfYsJowDgDt0SeSNa/E/ApmmQcaG9Z/0sHJzX3TWegfDJCZXFQDy52OYkQPE/HNYKXvivrHpO1vSz9B88iovyHBqKilgUXRecKDB4r/Y5FGAa0o0pQdQzU0qBG160uAQJ7/1xe3g7vf9tovEVMOOmqPV85g6eCsSXwQTplNrP9ABz9zRjeZvWI3cfFy28Q34tkuTmU/gsCXzrYRMhGM5KsbUVenFd7hg21jZrkT3De0zOTzZJ4OrM7e9VPrQ+dmeUR4Rff8pSEPlRYHJ8A5EfH+00BIA9UJ9fQSFh5ajgtcA+rRaZquG/yHb8CzwMW4l7cbr8PRd0A7FV4W1nTAf/RJIWiHxW6Skipc37duer8ipMf3CaCK+AoCTAMDxbzJ91GyCIAySXO5kD27B hfPLPMX7 to0Dh5TOKryYU/V89/joo05Pa7x1OVcET4LXdJs+jMsoEeo9fEyP8x+m6V8iQ1pSo+1f2dmaKzgHcpV9RJzquRtFD/w== 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 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 */