From patchwork Fri Sep 15 18:38:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13387483 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 D291EEED61E for ; Fri, 15 Sep 2023 18:40:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DB916B03D9; Fri, 15 Sep 2023 14:39:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 862FE6B03DB; Fri, 15 Sep 2023 14:39:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BA386B03DC; Fri, 15 Sep 2023 14:39:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 496CA6B03D9 for ; Fri, 15 Sep 2023 14:39:59 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 15C9C40697 for ; Fri, 15 Sep 2023 18:39:59 +0000 (UTC) X-FDA: 81239696118.22.C14CF0C Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf30.hostedemail.com (Postfix) with ESMTP id 624D280024 for ; Fri, 15 Sep 2023 18:39:57 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=nbK0ltBU; spf=pass (imf30.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694803197; 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=VZYs+58deJjiPO8x76TVvnJ/svOQYbXd85JbMK60DK4=; b=tqMf1mJlEe9MVyoJLKo38X+2zgDs/c1Y5vo2KpvfAztSXgKNDxxPNjlhOoCInK/4SeoMMY deefPamdzeiEl8x5FhP1+H3yI7JRNQTvoiXq5gN7K6vFzXvjmjbmDnsTls2BNhE7Sk/Fhc h+NIgfIuFWbEoSjAlW4GEHsZ8ajrSM0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694803197; a=rsa-sha256; cv=none; b=5pC+tEvYhocBi7GaTCxtIA3XhzFL2zx0XatS4KC8ICkPHWWigiyCn8EihiONSKgOXBLHgx k3p2A4l/xmERpILX2Gn+u4gENBcb3i0e13Ayg2uxo6rtIj7FrY1u+ic85/mm+p7tkUXd+z lgSN1rLxD127weXIlS6MqZlni62tvgc= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=nbK0ltBU; spf=pass (imf30.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=me@pankajraghav.com; dmarc=none Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4RnNK60pC9z9sW2; Fri, 15 Sep 2023 20:39:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803194; 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=VZYs+58deJjiPO8x76TVvnJ/svOQYbXd85JbMK60DK4=; b=nbK0ltBUmQsL56D0EhZ4txGadxEvVy4TubQU3sjKYn6rLPyAwbUdURHJ8b7n3zRdtyN/4Z ypn7d+WKBepAkrMqlYrcpEnjSMQaoXkHFqFzoi6xAKmqYIcE4d5nhd2NJIIkCltxDGFZqX aPiRGdlaOPgV/tMGFjiJ/rnPBUDvjHKssw/KzOPJoi2RRiMVQtr/SMPLsZ5ZmivBbieE89 tSpFP1+7JVhzls4KDO9r0MQkSh811k3tpn2w1NcQ02D8BjCZtKlrXgjf8qjYLwmyE0yjlD nMlVsGHg5BAV06syTuM4YAtZ4/po/zbqrO9EN8APt8gc76aXRTMNwttPDzWfeQ== From: Pankaj Raghav To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com Subject: [RFC 22/23] xfs: enable block size larger than page size support Date: Fri, 15 Sep 2023 20:38:47 +0200 Message-Id: <20230915183848.1018717-23-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Stat-Signature: d35swwz1pzw34goorz3iotjnotzzq1rz X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 624D280024 X-Rspam-User: X-HE-Tag: 1694803197-120833 X-HE-Meta: U2FsdGVkX19LJVcbhUJZo0f6Gw0N+gR1Fba++tufnu/9U6if0ATL5vuZ37RuAoGfR9z7SOkxBLSxhvC8EE+8B2tCTxkkaZvVI2+aGC8Mxw38Z0WebCAsn41MkMuULsmRH1hxz0MTHqa6H8yrnZQ5rADkaoEhMYpH6rpEj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moSErfEIzi3JUpjudj/gMD47MdR9gmroL8y4TC72Y1rZn9lvvlTaGJ9zkjgQQRlLx2z5ob8gWbQ6tFFh8OMsJfetjl3DvsEfoWArXEfOXdxtc1UwxMzKm67r0b/LjZveydoNjzl+HBSBJ5xfCGUN+ZmbqgoDZgn8ighfEEDHMkUIH77dRaHUXBmYpfU0CRAbvUToECLZg= 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: From: Pankaj Raghav Currently we don't support blocksize that is twice the page size due to the limitation of having at least three pages in a large folio[1]. [1] https://lore.kernel.org/all/ZH0GvxAdw1RO2Shr@casper.infradead.org/ Signed-off-by: Luis Chamberlain Signed-off-by: Pankaj Raghav --- fs/xfs/xfs_mount.c | 9 +++++++-- fs/xfs/xfs_super.c | 7 ++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index aed5be5508fe..4272898c508a 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -131,11 +131,16 @@ xfs_sb_validate_fsb_count( xfs_sb_t *sbp, uint64_t nblocks) { - ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); ASSERT(sbp->sb_blocklog >= BBSHIFT); + unsigned long mapping_count; + + if (sbp->sb_blocklog <= PAGE_SHIFT) + mapping_count = nblocks >> (PAGE_SHIFT - sbp->sb_blocklog); + else + mapping_count = nblocks << (sbp->sb_blocklog - PAGE_SHIFT); /* Limited by ULONG_MAX of page cache index */ - if (nblocks >> (PAGE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) + if (mapping_count > ULONG_MAX) return -EFBIG; return 0; } diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 1f77014c6e1a..75bf4d23051c 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1651,13 +1651,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) { + if (mp->m_sb.sb_blocksize == (2 * PAGE_SIZE)) { xfs_warn(mp, "File system with blocksize %d bytes. " - "Only pagesize (%ld) or less will currently work.", + "Blocksize that is twice the pagesize %ld does not currently work.", mp->m_sb.sb_blocksize, PAGE_SIZE); error = -ENOSYS; goto out_free_sb;