From patchwork Wed Mar 22 22:17:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Gompa X-Patchwork-Id: 13184696 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CC74C6FD1C for ; Wed, 22 Mar 2023 22:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbjCVWRs (ORCPT ); Wed, 22 Mar 2023 18:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjCVWRr (ORCPT ); Wed, 22 Mar 2023 18:17:47 -0400 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C85835B5 for ; Wed, 22 Mar 2023 15:17:46 -0700 (PDT) Received: by mail-qv1-f47.google.com with SMTP id cu4so13142271qvb.3 for ; Wed, 22 Mar 2023 15:17:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679523465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=70aK4l/Av1Q0QhfxaKrmYC2qim+9lyKEquLp53Fx+C4=; b=IlI+CJPOUmtgCbgPPwoYiIaiaNlnweiUvF753Q8QHR3eJjLjI6LGqpGZXJP4Y+53OH vLmEBQP42izjtFL+49u97GoECZ8OoIBMSpsbWB2Tka1ZGN/0SnWbIJmaCn+8aFGesgtC bkGrjokMiyguy5yUfX/Q/A7N+qMgOacg/EVmYq3vphljC7vuVyaxRRfMmuHShaZh6zGx ESfvyYLFRx2ZUl6IuEmZ6NIyf5KiTP16yZBTWNf8IrDDRgDJZQygK4bRNWgXurcUVPv4 3Jg/QluQkWobxIvibiozfkrpJHgEZe7RH287jdn8wIbHJ6kW5gFD/GaPnFO1YPBkdmBb du7Q== X-Gm-Message-State: AO0yUKXHH6UUgH6LcvI42HmOmbO/iTXO/yA4eEAQi3C0dYYZN/dRUW2/ DbIJB3Enig+f4hhAGoLhXA0YzJOD0OOWgzEc/6Y= X-Google-Smtp-Source: AK7set9NTyB/cwAkw8m3AoB/2kQNSwaLbq/ZQCQuFuaNWfCRlVb1Gwri+K4dWxnB8GNbnemet3Y9jg== X-Received: by 2002:a05:6214:1947:b0:5d1:d9f3:dd83 with SMTP id q7-20020a056214194700b005d1d9f3dd83mr8305936qvk.7.1679523464959; Wed, 22 Mar 2023 15:17:44 -0700 (PDT) Received: from Belldandy-Slimbook.infra.opensuse.org (ool-18e49371.dyn.optonline.net. [24.228.147.113]) by smtp.gmail.com with ESMTPSA id j185-20020a37b9c2000000b007465ad44891sm11068443qkf.102.2023.03.22.15.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 15:17:44 -0700 (PDT) From: Neal Gompa To: Linux BTRFS Development Cc: Neal Gompa , Anand Jain , Qu Wenruo , Qu Wenruo , David Sterba , Hector Martin , Sven Peter , Davide Cavalca , Jens Axboe , Asahi Lina , Asahi Linux , Josef Bacik Subject: [PATCH 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Date: Wed, 22 Mar 2023 18:17:14 -0400 Message-Id: <20230322221714.2702819-2-neal@gompa.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322221714.2702819-1-neal@gompa.dev> References: <20230322221714.2702819-1-neal@gompa.dev> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We have had working subpage support in Btrfs for many cycles now. Generally, we do not want people creating filesystems by default with non-4k sectorsizes since it creates portability problems. Signed-off-by: Neal Gompa Reviewed-by: Anand Jain Reviewed-by: Qu Wenruo Reviewed-by: Josef Bacik --- Documentation/Subpage.rst | 15 ++++++++------- Documentation/mkfs.btrfs.rst | 13 +++++++++---- mkfs/main.c | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Documentation/Subpage.rst b/Documentation/Subpage.rst index 21a495d5..39ef7d6d 100644 --- a/Documentation/Subpage.rst +++ b/Documentation/Subpage.rst @@ -9,17 +9,18 @@ to the exactly same size of the block and page. On x86_64 this is typically pages, like 64KiB on 64bit ARM or PowerPC. This means filesystems created with 64KiB sector size cannot be mounted on a system with 4KiB page size. -While with subpage support, systems with 64KiB page size can create (still needs -"-s 4k" option for mkfs.btrfs) and mount filesystems with 4KiB sectorsize, -allowing us to push 4KiB sectorsize as default sectorsize for all platforms in the -near future. +Since v6.3, filesystems are created with a 4KiB sectorsize by default, +though it remains possible to create filesystems with other page sizes +(such as 64KiB with the "-s 64k" option for mkfs.btrfs). This ensures that +new filesystems are compatible across other architecture variants using +larger page sizes. Requirements, limitations ------------------------- -The initial subpage support has been added in v5.15, although it's still -considered as experimental at the time of writing (v5.18), most features are -already working without problems. +The initial subpage support has been added in v5.15. Most features are +already working without problems. Subpage support is used by default +for systems with a non-4KiB page size since v6.3. End users can mount filesystems with 4KiB sectorsize and do their usual workload, while should not notice any obvious change, as long as the initial diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst index ba7227b3..16abf0ca 100644 --- a/Documentation/mkfs.btrfs.rst +++ b/Documentation/mkfs.btrfs.rst @@ -116,10 +116,15 @@ OPTIONS -s|--sectorsize Specify the sectorsize, the minimum data block allocation unit. - The default value is the page size and is autodetected. If the sectorsize - differs from the page size, the created filesystem may not be mountable by the - running kernel. Therefore it is not recommended to use this option unless you - are going to mount it on a system with the appropriate page size. + By default, the value is 4KiB, but it can be manually set to match the + system page size. However, if the sector size is different from the page + size, the resulting filesystem may not be mountable by the current + kernel, apart from the default 4KiB. Hence, using this option is not + advised unless you intend to mount it on a system with the suitable + page size. + + .. note:: + Versions prior to 6.3 set the sectorsize matching to the page size. -L|--label Specify a label for the filesystem. The *string* should be less than 256 diff --git a/mkfs/main.c b/mkfs/main.c index f5e34cbd..5e1834d7 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1207,7 +1207,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) } if (!sectorsize) - sectorsize = (u32)sysconf(_SC_PAGESIZE); + sectorsize = (u32)SZ_4K; if (btrfs_check_sectorsize(sectorsize)) goto error;