From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A99330CEA for ; Thu, 16 Nov 2023 16:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gompa.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-41cc537ed54so5514451cf.2 for ; Thu, 16 Nov 2023 08:02:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700150567; x=1700755367; 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=gzn6gpBv9OleWUEhEJCmZq93KrA6r6P5N/PbiyoQ8dg=; b=O758Vtgwj5cDdFZUwbvZdJUySwrk1C6V1c7payXhamt16+IEvZn2sbdBw24rlFYCv6 ASSI/2FXdruK9NcYE2jcDQcZXdZIv02rtzfI5Sx8oIwdC/GTxd7wyD3uD+7YXIbv3tWZ J6vF9d/hGotuZ8JEDZA2G8HEM78AEBOK3locvlXZxZO0w6NKwZesJEMxGjtTgLRjnHVw /CGr30k1JwS3xtBuSf723ICEt6F/S9J9BI3AZv1/fFzAJuqh3eVta1iX/spNg7WgaF4/ 6/4OsygVm8Ru+jBAPU6et2Rdgr+tEZHEG0h+5PVRXobxwZnDj8mbcY8eX4xtcqtuLO4U 1Llg== X-Gm-Message-State: AOJu0Yy9R8xRzOXW51nm/ir1LBGRfbHSdIry2qPxsLQzRDKoJbPo7yFM pq/EtvQJ0N2mL7MZh2d4Yos= X-Google-Smtp-Source: AGHT+IH4luh7sxKQsF4SxXfj+u28qYx36qkvfsU02pNamWCDPaAbduQDXn2gXew5PC64v18dR37Y7Q== X-Received: by 2002:a0c:d6c3:0:b0:671:2fb5:cb2b with SMTP id l3-20020a0cd6c3000000b006712fb5cb2bmr9323526qvi.60.1700150566905; Thu, 16 Nov 2023 08:02:46 -0800 (PST) Received: from Belldandy-Slimbook.infra.opensuse.org (ool-18e49371.dyn.optonline.net. [24.228.147.113]) by smtp.gmail.com with ESMTPSA id dj11-20020a056214090b00b00671248b9cfcsm1436868qvb.67.2023.11.16.08.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 08:02:45 -0800 (PST) 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 v4 1/1] btrfs-progs: mkfs: Enforce 4k sectorsize by default Date: Thu, 16 Nov 2023 11:02:24 -0500 Message-ID: <20231116160235.2708131-2-neal@gompa.dev> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116160235.2708131-1-neal@gompa.dev> References: <20231116160235.2708131-1-neal@gompa.dev> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 | 17 +++++++++-------- Documentation/mkfs.btrfs.rst | 13 +++++++++---- mkfs/main.c | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Documentation/Subpage.rst b/Documentation/Subpage.rst index c762b6a3..1655ae7e 100644 --- a/Documentation/Subpage.rst +++ b/Documentation/Subpage.rst @@ -9,18 +9,19 @@ 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 -and mount filesystems with 4KiB sectorsize. This still needs to use option "-s -4k" option for :command:`mkfs.btrfs`. +Since v6.7, 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 :command:`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, most features are already working without problems. -On a 64KiB page system filesystem with 4KiB sectorsize can be mounted and used -as usual as long as the initial mount succeeds. There are cases a mount will be -rejected when verifying compatible features. +The initial subpage support has been added in v5.15. Most features are +already working without problems. On a 64KiB page system, a filesystem with +4KiB sectorsize can be mounted and used as long as the initial mount succeeds. +Subpage support is used by default for systems with a non-4KiB page size since v6.7. Please refer to status page of :ref:`status-subpage-block-size` for compatibility. diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst index 7e23b9f6..be4f49cb 100644 --- a/Documentation/mkfs.btrfs.rst +++ b/Documentation/mkfs.btrfs.rst @@ -122,10 +122,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.7 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 d984c995..0570c8f8 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1384,7 +1384,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; -- 2.41.0