From patchwork Wed Feb 26 03:59:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13991488 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 92B7525E464 for ; Wed, 26 Feb 2025 03:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740542394; cv=none; b=J1uDj2fJR/VlqYQAYPPZpwodDQ6ACeBcbaNnSjlzPHUkNElIZjMWERUPWs2gjVrQgT/+nMgAPm/Qsl67GD78bjjT6KOWM95en/ZaAhS+LvlCaYoY3yX5olhjv7lWd8/2m5xgUXcN2rS1zsxQ699aT6GPqxtnU6heRQeckOa3Oos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740542394; c=relaxed/simple; bh=m7yEfoxYEx0FZr2uJaJWk2gY3QoZIzp9sbv6V1wi00A=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NdnR7zq3J9UwfKTCIA2Ux0tMjb4Df/9L5shdKRIVyH2ncbE93ll26LsQSM3ZDdUV8RiI016ZrghC5COwzbYr90zqT8vEwEHXZF6O4IkcImS836Q7+4zSAlSOvWdiiRsHZtvVc9xXDhJU0EjobEczftxBS4GfvqP+WnQKNF1SSzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=ZJUIUvvS; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=ZJUIUvvS; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ZJUIUvvS"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ZJUIUvvS" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 23A491F388 for ; Wed, 26 Feb 2025 03:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1740542383; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=En/FjS+LZQylCdidz9Dzq92NwF7ZETNjDp4KdFqldzw=; b=ZJUIUvvSJ6wghM05VTosxsP9/dFZVGwMZHUokfKuWUZ2PJm4rErDg8U8LO82HIAoQvYtmN d49wEyubhlGGfot8pX2ivShiCKzCuKJWvybUZizkxwNY/LPjh5XGhbEY5FfgM0D4mjPjFc 6CBvSXEGrW75/BM7vuwY7LA8enCoaqg= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1740542383; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=En/FjS+LZQylCdidz9Dzq92NwF7ZETNjDp4KdFqldzw=; b=ZJUIUvvSJ6wghM05VTosxsP9/dFZVGwMZHUokfKuWUZ2PJm4rErDg8U8LO82HIAoQvYtmN d49wEyubhlGGfot8pX2ivShiCKzCuKJWvybUZizkxwNY/LPjh5XGhbEY5FfgM0D4mjPjFc 6CBvSXEGrW75/BM7vuwY7LA8enCoaqg= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 58E3013404 for ; Wed, 26 Feb 2025 03:59:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KPh0Bq6RvmdOegAAD6G6ig (envelope-from ) for ; Wed, 26 Feb 2025 03:59:42 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/3] btrfs-progs: fix the incorrect buffer size for super block Date: Wed, 26 Feb 2025 14:29:15 +1030 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Level: Inside the function btrfs_add_to_fsid(), we allocate a buffer to write the superblock to the disk. However the buffer size is based on block size, which can cause two problems: - 2K block size The block size is too small for the super block, and we will write beyond the buffer and corrupt the memory. - 16/64K block size The block size will be larger than super block size, this will not cause any problem but waste some memory. Fix the bug by using BTRFS_SUPER_INFO_SIZE as the correct buffer size. Signed-off-by: Qu Wenruo --- common/device-scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/device-scan.c b/common/device-scan.c index a34d86652f06..7d7d67fb5b71 100644 --- a/common/device-scan.c +++ b/common/device-scan.c @@ -148,7 +148,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, if (!device) return -ENOMEM; - buf = calloc(1, sectorsize); + buf = calloc(1, BTRFS_SUPER_INFO_SIZE); if (!buf) { ret = -ENOMEM; goto out; From patchwork Wed Feb 26 03:59:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13991487 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 0E70425E45B for ; Wed, 26 Feb 2025 03:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740542392; cv=none; b=ZMAQJU/fYNJrT+NUf0DtsZC01o7LcVDjsaC0uh/P4AVmf7DFXoCl80jh45CDJ7U/UUyNBJPEvMALz9VVqrL6hJ7NtrQMuxKpDREgSb5gMPZRhmJ/G2yMUntqkus2QBfm2sd4IJBj/FtFFkEMFSV/uLl/CEeVz5gqUufTJbUq9dI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740542392; c=relaxed/simple; bh=VYLMsW4P6QZFhOjBFaAmfZQYkZFX2ETKP+T8peQpTec=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QJiUeyD9vMTkXycdF6g6/e84pOek2Y3LuaseQvvOYkF8OkMFFPxRohFw3JVYuu0Y6TfvT/ImU8upUEzoINW+DnaDICoF0o8Fx6pIffX8dKGCzzx1S74zdzKHTUeNUwynDn8bdW0uT79p1T+vldzxB5XsZ42oCP/5S0ku5zuJXF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=PoIHLQnz; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=PoIHLQnz; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="PoIHLQnz"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="PoIHLQnz" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 6615B2118D for ; Wed, 26 Feb 2025 03:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1740542384; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WIWqjBAMNLIPH+IE1eUTGigYxJhJOm3Y9DLpS3NMzt4=; b=PoIHLQnzlaVCIMc4BrL4poUTBmxPQNi/lygQBr/Brr/22igXfj9t+y4KTkqXxuhuU+wTEe 11mwfzTg+YcApBppItwYjNrKfb2yg84849TpQRMJkz1uzEhczqNVadY8tEBbiwGInev2i9 QnlSSYO3NB06Za8GLmJWzltkBDrFTe0= Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=PoIHLQnz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1740542384; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WIWqjBAMNLIPH+IE1eUTGigYxJhJOm3Y9DLpS3NMzt4=; b=PoIHLQnzlaVCIMc4BrL4poUTBmxPQNi/lygQBr/Brr/22igXfj9t+y4KTkqXxuhuU+wTEe 11mwfzTg+YcApBppItwYjNrKfb2yg84849TpQRMJkz1uzEhczqNVadY8tEBbiwGInev2i9 QnlSSYO3NB06Za8GLmJWzltkBDrFTe0= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9B76713404 for ; Wed, 26 Feb 2025 03:59:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wNbKFq+RvmdOegAAD6G6ig (envelope-from ) for ; Wed, 26 Feb 2025 03:59:43 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/3] btrfs-progs: support 2k block size Date: Wed, 26 Feb 2025 14:29:16 +1030 Message-ID: <31a6625633a3a64b855d69ce5ade1466e516d0a4.1740542229.git.wqu@suse.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 6615B2118D X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.com:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; FROM_HAS_DN(0.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Level: Since btrfs only supports block size 4K and PAGE_SIZE, on x86_64 it means we can not test subpage block size easily. With the recent kernel change to support 2K block size for debug builds, also add 2K block size support for btrfs-progs, so that we can do proper subpage block size testing on x86_64, without acquiring an aarch64 machine. There is a limit: - No support for 2K node size The limit is from the initial mkfs tree root, which can only have a single leaf to contain all root items. But 2K leaf can not handle all the root items, thus we have to disable it. Signed-off-by: Qu Wenruo --- common/fsfeatures.c | 11 ++++++++--- kernel-shared/ctree.h | 6 ++++++ kernel-shared/disk-io.c | 11 ++++------- mkfs/main.c | 7 ------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/common/fsfeatures.c b/common/fsfeatures.c index 7aaddab6a192..398065dbea86 100644 --- a/common/fsfeatures.c +++ b/common/fsfeatures.c @@ -628,7 +628,8 @@ int btrfs_check_sectorsize(u32 sectorsize) error("invalid sectorsize %u, must be power of 2", sectorsize); return -EINVAL; } - if (sectorsize < SZ_4K || sectorsize > SZ_64K) { + if (sectorsize < BTRFS_MIN_BLOCKSIZE || + sectorsize > BTRFS_MAX_METADATA_BLOCKSIZE) { error("invalid sectorsize %u, expected range is [4K, 64K]", sectorsize); return -EINVAL; @@ -650,9 +651,13 @@ int btrfs_check_sectorsize(u32 sectorsize) int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, struct btrfs_mkfs_features *features) { - if (nodesize < sectorsize) { + if (nodesize < sectorsize || nodesize < SZ_4K) { + /* + * Although we support 2K block size, we can not support 2K + * nodesize, as it's too small to contain all the needed root items. + */ error("illegal nodesize %u (smaller than %u)", - nodesize, sectorsize); + nodesize, max_t(u32, sectorsize, SZ_4K)); return -1; } else if (nodesize > BTRFS_MAX_METADATA_BLOCKSIZE) { error("illegal nodesize %u (larger than %u)", diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h index 8c923be96705..c3d66c99c78d 100644 --- a/kernel-shared/ctree.h +++ b/kernel-shared/ctree.h @@ -63,6 +63,12 @@ static inline u32 __BTRFS_LEAF_DATA_SIZE(u32 nodesize) return nodesize - sizeof(struct btrfs_header); } +#if EXPERIMENTAL +#define BTRFS_MIN_BLOCKSIZE (SZ_2K) +#else +#define BTRFS_MIN_BLOCKSIZE (SZ_4K) +#endif + #define BTRFS_LEAF_DATA_SIZE(fs_info) (fs_info->leaf_data_size) #define BTRFS_SUPER_INFO_OFFSET (65536) diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c index a4f91d10fa4e..b7d478007ae8 100644 --- a/kernel-shared/disk-io.c +++ b/kernel-shared/disk-io.c @@ -1816,13 +1816,10 @@ int btrfs_check_super(struct btrfs_super_block *sb, unsigned sbflags) error("nodesize unaligned: %u", btrfs_super_nodesize(sb)); goto error_out; } - if (btrfs_super_sectorsize(sb) < 4096) { - error("sectorsize too small: %u < 4096", - btrfs_super_sectorsize(sb)); - goto error_out; - } - if (!IS_ALIGNED(btrfs_super_sectorsize(sb), 4096)) { - error("sectorsize unaligned: %u", btrfs_super_sectorsize(sb)); + if (!is_power_of_2(btrfs_super_sectorsize(sb)) || + btrfs_super_sectorsize(sb) < BTRFS_MIN_BLOCKSIZE || + btrfs_super_sectorsize(sb) > BTRFS_MAX_METADATA_BLOCKSIZE) { + error("invalid sectorsize: %u", btrfs_super_sectorsize(sb)); goto error_out; } if (btrfs_super_total_bytes(sb) == 0) { diff --git a/mkfs/main.c b/mkfs/main.c index dc73de47a710..c7968540e8af 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1669,13 +1669,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv) if (nodesize > sysconf(_SC_PAGE_SIZE)) features.incompat_flags |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; - if (sectorsize < sizeof(struct btrfs_super_block)) { - error("sectorsize smaller than superblock: %u < %zu", - sectorsize, sizeof(struct btrfs_super_block)); - ret = 1; - goto error; - } - min_dev_size = btrfs_min_dev_size(nodesize, mixed, opt_zoned ? zone_size(file) : 0, metadata_profile, data_profile); From patchwork Wed Feb 26 03:59:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13991489 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 B2A4425E452 for ; Wed, 26 Feb 2025 03:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740542399; cv=none; b=DPCwAhUVSN4FCrvhPkIp5PNigY5CAzIm4/kLiAZImz9pG7VLx/A2q5AWl4fptAjiJYl0TbnbJue0zL7DDsZ6oeUA1nu/0oMyYInDy8qgPKKHXQEYXcM8KL91Hyt69NgZiwF5Q1jyiA1zJnvzuhaOnA51RxQXuRoXE8guqSQ3oTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740542399; c=relaxed/simple; bh=xjAbjP7MWtf249OT42Fp45CBfMuhM+wV5wqkuWdnVXo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dGAciZnShIg54TxuKiFUWONrgV0Kh8He/agHMg9U4c2hAafwHkUp45EfulLeyShHq1MitWCh71DkUfb++gXhiKCGrZF8/7Ubf1pYw9woLU/n2t+3SnQqXKOzthWk1sKnprJHv3kuYzJjRx/kzvL20T+HiHKrWT+7fnIHLknW8Lw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=ihAR/+lY; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=ihAR/+lY; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ihAR/+lY"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ihAR/+lY" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id B560121193 for ; Wed, 26 Feb 2025 03:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1740542385; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ksmf5yRK+jmwzYn0vPzSmhsdy9l3pDdKF5mD2XeZf14=; b=ihAR/+lY6kBDIrWiStE8TpZWoTIGUSs/laTvKKMwGljMqC7oF7/Zm3HP/Dt9OowlbcWNZ2 vwqLAZfDGafVK1d6w3rKcHAc1zJO5FmQl14dL0TLOHXMKH37e8O/KblA/5EEOOml2NJZY9 97LqKIa4ta3+KQCT71vz6WXQsfMqnDw= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1740542385; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ksmf5yRK+jmwzYn0vPzSmhsdy9l3pDdKF5mD2XeZf14=; b=ihAR/+lY6kBDIrWiStE8TpZWoTIGUSs/laTvKKMwGljMqC7oF7/Zm3HP/Dt9OowlbcWNZ2 vwqLAZfDGafVK1d6w3rKcHAc1zJO5FmQl14dL0TLOHXMKH37e8O/KblA/5EEOOml2NJZY9 97LqKIa4ta3+KQCT71vz6WXQsfMqnDw= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DE63913404 for ; Wed, 26 Feb 2025 03:59:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WJEmJ7CRvmdOegAAD6G6ig (envelope-from ) for ; Wed, 26 Feb 2025 03:59:44 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/3] btrfs-progs: convert: check the sectorsize against BTRFS_MIN_BLOCKSIZE Date: Wed, 26 Feb 2025 14:29:17 +1030 Message-ID: <4a0875f0bcfc7182bf9ba13be752eea948b666ce.1740542229.git.wqu@suse.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Level: This allow experimental btrfs-convert builds to handle 2K block sized ext4, which is needed to pass convert related test cases in fstests. Signed-off-by: Qu Wenruo --- convert/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert/main.c b/convert/main.c index edc2c0d97c29..0dc75c9eb1c6 100644 --- a/convert/main.c +++ b/convert/main.c @@ -1201,7 +1201,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize, UASSERT(cctx.total_bytes != 0); blocksize = cctx.blocksize; - if (blocksize < 4096) { + if (blocksize < BTRFS_MIN_BLOCKSIZE) { error("block size is too small: %u < 4096", blocksize); goto fail; }