From patchwork Tue May 14 18:22:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664352 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9AA01802CC for ; Tue, 14 May 2024 18:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711094; cv=none; b=KQxC3gfhp9BVjNWFY1Jw3Bh36Q5kqJWBtFv252fkreg8cqHfdoTIYfjLf0VeOkZLc/qOQvEu0mjC+ace4Hvsib105ItafkPxEp3ZIBswUDf2vmdyuxGPpPdgRwD5bxJ48XNmS7A56MA2Wru74XH50yM/tLhXfEwGbDLTugalVrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711094; c=relaxed/simple; bh=/yT8wMJxRbKuXdUUiSqN185WDRu4xmSSBnB3+dzr//A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UcBE7oTIxKhS3QmToQF4551I8pqGnn6SeFrvX+vDgGI9hISGQu4mmArRt7uRYLMufMCqVmVpLo31kt5r5mHm1UeuKaaRdvXaGdO6nj+FuIhgpXSCk9scPF4LF99mY7G+ZIrBK4lwXx1nhxL9VhQa4OZl+u2jzFcwG88SffyO9f4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=qBEDNIxr; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="qBEDNIxr" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711092; x=1747247092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/yT8wMJxRbKuXdUUiSqN185WDRu4xmSSBnB3+dzr//A=; b=qBEDNIxrqZHQF2HIS4kdLponZ5+mrHoTDMVRqST7pKTyvETB4XiU0XnW u4D0sbsm3n5qILYxzBjR6unx3UVcGZ/977qFMSReKPn7KkLpzWTekvZOr 3j+UCbY+ohEj6/TLBu8y7dI6LGv+oUsGZRrZPdsOqO3FbJLQzAeoq0ZQP 290jBsxG8R/xz6PBPgJLvlRm1KEzKk2yMgC+52nVrh2q/Cl0lX6eJRjs9 gNvnbke4MIy2kGtSFDGOzmyuY664QO4k7FPSuVU6wp2Yx018d+vc8krDw zfb3uZ68a0w0pOxcTJbLdQeNLLTgYT4Sn8kqEpkLuURRaLm0ypjkez+c8 g==; X-CSE-ConnectionGUID: LgamAS7ySTWlhf2pBFuysA== X-CSE-MsgGUID: /0nPzPNQQjWLCawrKXFhHQ== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162634" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:45 +0800 IronPort-SDR: 6643a02f_A31XvgEt5IVUoRef+VZrSEY+ikd/5o/FcKTb9xpfd2bHEpy X63dunyD6qxZQK5UK7j2k1yCs//nZBVHPwrPvcA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:32 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:44 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 1/8] btrfs-progs: rename block_count to byte_count Date: Tue, 14 May 2024 12:22:20 -0600 Message-ID: <20240514182227.1197664-2-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 block_count and dev_block_count are counting the size in bytes. And, comparing them with e.g, "min_dev_size" is confusing. Rename them to represent the unit better. Signed-off-by: Naohiro Aota --- common/device-utils.c | 28 +++++++++++----------- mkfs/main.c | 56 +++++++++++++++++++++---------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/common/device-utils.c b/common/device-utils.c index d086e9ea2564..86942e0c7041 100644 --- a/common/device-utils.c +++ b/common/device-utils.c @@ -222,11 +222,11 @@ out: * - reset zones * - delete end of the device */ -int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret, - u64 max_block_count, unsigned opflags) +int btrfs_prepare_device(int fd, const char *file, u64 *byte_count_ret, + u64 max_byte_count, unsigned opflags) { struct btrfs_zoned_device_info *zinfo = NULL; - u64 block_count; + u64 byte_count; struct stat st; int i, ret; @@ -236,13 +236,13 @@ int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret, return 1; } - block_count = device_get_partition_size_fd_stat(fd, &st); - if (block_count == 0) { + byte_count = device_get_partition_size_fd_stat(fd, &st); + if (byte_count == 0) { error("unable to determine size of %s", file); return 1; } - if (max_block_count) - block_count = min(block_count, max_block_count); + if (max_byte_count) + byte_count = min(byte_count, max_byte_count); if (opflags & PREP_DEVICE_ZONED) { ret = btrfs_get_zone_info(fd, file, &zinfo); @@ -276,18 +276,18 @@ int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret, if (discard_supported(file)) { if (opflags & PREP_DEVICE_VERBOSE) printf("Performing full device TRIM %s (%s) ...\n", - file, pretty_size(block_count)); - device_discard_blocks(fd, 0, block_count); + file, pretty_size(byte_count)); + device_discard_blocks(fd, 0, byte_count); } } - ret = zero_dev_clamped(fd, zinfo, 0, ZERO_DEV_BYTES, block_count); + ret = zero_dev_clamped(fd, zinfo, 0, ZERO_DEV_BYTES, byte_count); for (i = 0 ; !ret && i < BTRFS_SUPER_MIRROR_MAX; i++) ret = zero_dev_clamped(fd, zinfo, btrfs_sb_offset(i), - BTRFS_SUPER_INFO_SIZE, block_count); + BTRFS_SUPER_INFO_SIZE, byte_count); if (!ret && (opflags & PREP_DEVICE_ZERO_END)) - ret = zero_dev_clamped(fd, zinfo, block_count - ZERO_DEV_BYTES, - ZERO_DEV_BYTES, block_count); + ret = zero_dev_clamped(fd, zinfo, byte_count - ZERO_DEV_BYTES, + ZERO_DEV_BYTES, byte_count); if (ret < 0) { errno = -ret; @@ -302,7 +302,7 @@ int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret, } free(zinfo); - *block_count_ret = block_count; + *byte_count_ret = byte_count; return 0; err: diff --git a/mkfs/main.c b/mkfs/main.c index a467795d4428..950f76101058 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -80,8 +80,8 @@ static int opt_oflags = O_RDWR; struct prepare_device_progress { int fd; char *file; - u64 dev_block_count; - u64 block_count; + u64 dev_byte_count; + u64 byte_count; int ret; }; @@ -1159,8 +1159,8 @@ static void *prepare_one_device(void *ctx) } prepare_ctx->ret = btrfs_prepare_device(prepare_ctx->fd, prepare_ctx->file, - &prepare_ctx->dev_block_count, - prepare_ctx->block_count, + &prepare_ctx->dev_byte_count, + prepare_ctx->byte_count, (bconf.verbose ? PREP_DEVICE_VERBOSE : 0) | (opt_zero_end ? PREP_DEVICE_ZERO_END : 0) | (opt_discard ? PREP_DEVICE_DISCARD : 0) | @@ -1204,8 +1204,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv) bool metadata_profile_set = false; u64 data_profile = 0; bool data_profile_set = false; - u64 block_count = 0; - u64 dev_block_count = 0; + u64 byte_count = 0; + u64 dev_byte_count = 0; bool mixed = false; char *label = NULL; int nr_global_roots = sysconf(_SC_NPROCESSORS_ONLN); @@ -1347,7 +1347,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) sectorsize = arg_strtou64_with_suffix(optarg); break; case 'b': - block_count = arg_strtou64_with_suffix(optarg); + byte_count = arg_strtou64_with_suffix(optarg); opt_zero_end = false; break; case 'v': @@ -1623,34 +1623,34 @@ int BOX_MAIN(mkfs)(int argc, char **argv) * Block_count not specified, use file/device size first. * Or we will always use source_dir_size calculated for mkfs. */ - if (!block_count) - block_count = device_get_partition_size_fd_stat(fd, &statbuf); + if (!byte_count) + byte_count = device_get_partition_size_fd_stat(fd, &statbuf); source_dir_size = btrfs_mkfs_size_dir(source_dir, sectorsize, min_dev_size, metadata_profile, data_profile); - if (block_count < source_dir_size) { + if (byte_count < source_dir_size) { if (S_ISREG(statbuf.st_mode)) { - block_count = source_dir_size; + byte_count = source_dir_size; } else { warning( "the target device %llu (%s) is smaller than the calculated source directory size %llu (%s), mkfs may fail", - block_count, pretty_size(block_count), + byte_count, pretty_size(byte_count), source_dir_size, pretty_size(source_dir_size)); } } - ret = zero_output_file(fd, block_count); + ret = zero_output_file(fd, byte_count); if (ret) { error("unable to zero the output file"); close(fd); goto error; } /* our "device" is the new image file */ - dev_block_count = block_count; + dev_byte_count = byte_count; close(fd); } - /* Check device/block_count after the nodesize is determined */ - if (block_count && block_count < min_dev_size) { + /* Check device/byte_count after the nodesize is determined */ + if (byte_count && byte_count < min_dev_size) { error("size %llu is too small to make a usable filesystem", - block_count); + byte_count); error("minimum size for btrfs filesystem is %llu", min_dev_size); goto error; @@ -1661,9 +1661,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv) * 1 zone for a metadata block group * 1 zone for a data block group */ - if (opt_zoned && block_count && block_count < 5 * zone_size(file)) { + if (opt_zoned && byte_count && byte_count < 5 * zone_size(file)) { error("size %llu is too small to make a usable filesystem", - block_count); + byte_count); error("minimum size for a zoned btrfs filesystem is %llu", min_dev_size); goto error; @@ -1741,8 +1741,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv) /* Start threads */ for (i = 0; i < device_count; i++) { prepare_ctx[i].file = argv[optind + i - 1]; - prepare_ctx[i].block_count = block_count; - prepare_ctx[i].dev_block_count = block_count; + prepare_ctx[i].byte_count = byte_count; + prepare_ctx[i].dev_byte_count = byte_count; ret = pthread_create(&t_prepare[i], NULL, prepare_one_device, &prepare_ctx[i]); if (ret) { @@ -1763,16 +1763,16 @@ int BOX_MAIN(mkfs)(int argc, char **argv) goto error; } - dev_block_count = prepare_ctx[0].dev_block_count; - if (block_count && block_count > dev_block_count) { + dev_byte_count = prepare_ctx[0].dev_byte_count; + if (byte_count && byte_count > dev_byte_count) { error("%s is smaller than requested size, expected %llu, found %llu", - file, block_count, dev_block_count); + file, byte_count, dev_byte_count); goto error; } /* To create the first block group and chunk 0 in make_btrfs */ system_group_size = (opt_zoned ? zone_size(file) : BTRFS_MKFS_SYSTEM_GROUP_SIZE); - if (dev_block_count < system_group_size) { + if (dev_byte_count < system_group_size) { error("device is too small to make filesystem, must be at least %llu", system_group_size); goto error; @@ -1794,7 +1794,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) mkfs_cfg.label = label; memcpy(mkfs_cfg.fs_uuid, fs_uuid, sizeof(mkfs_cfg.fs_uuid)); memcpy(mkfs_cfg.dev_uuid, dev_uuid, sizeof(mkfs_cfg.dev_uuid)); - mkfs_cfg.num_bytes = dev_block_count; + mkfs_cfg.num_bytes = dev_byte_count; mkfs_cfg.nodesize = nodesize; mkfs_cfg.sectorsize = sectorsize; mkfs_cfg.stripesize = stripesize; @@ -1889,7 +1889,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) file); continue; } - dev_block_count = prepare_ctx[i].dev_block_count; + dev_byte_count = prepare_ctx[i].dev_byte_count; if (prepare_ctx[i].ret) { errno = -prepare_ctx[i].ret; @@ -1898,7 +1898,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) } ret = btrfs_add_to_fsid(trans, root, prepare_ctx[i].fd, - prepare_ctx[i].file, dev_block_count, + prepare_ctx[i].file, dev_byte_count, sectorsize, sectorsize, sectorsize); if (ret) { error("unable to add %s to filesystem: %d", From patchwork Tue May 14 18:22:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664350 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21AD21802DD for ; Tue, 14 May 2024 18:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711093; cv=none; b=HEbzk+3cNrSwqer0V2V8EZzL1Bze6kAz+BMBKex3mS2Ibe/410j26F5DKOjUvPEUpGtSdPhNV4108ZFh4UMioXj7EmjraSLCAXojAAC9iCH9t/eJFrYan3l86iXixwHaz7YSZzh8Od6dHM68bnJAeJXdNsrSPlvm57yyyHW5La0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711093; c=relaxed/simple; bh=TBUYJ3c6BS0lMAzA+zRpFALc0P5qHwaGeFmjh/qbv/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sbLspiC6xrzoarQpnHKEZiqdMGNMlqOsg9s2ZtLZ+FT/LdJ+Eb5fsh1D1jYdYeKZwsaHoPGuC3x350GuaXwgbREIio8jqU/cDZqffp7Rj3F/u3xzz6cG2sGoDcxVQyYd+T2b6I8sV7QV1QcvRujrVgI8MKDOj5C+6pB1dNfcDUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=TsGBjv3N; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="TsGBjv3N" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711092; x=1747247092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TBUYJ3c6BS0lMAzA+zRpFALc0P5qHwaGeFmjh/qbv/o=; b=TsGBjv3Nv7s6H0DKIog4wN4a0b4PHC8TOo8sZXISMaf3Z0zWhX+R5/xD liTCm2fnJ96R9qMUmubEP1DJCn3CPkZc+venXRaa5WplMqnRWMcCozdkO /8MTFlO4y3he1J1o4N6SnhDarJD5Tts1qyY12Nw0HmhfD4RzslanBDwpA 2T1uGl89+3/YpCDKmvIzE2nWaqnzbdd54Fnq540LpiZv0oHpCmQlh6rqD jcKYjF+K2fTbPq6pGlH3WdpIAK2l0eYDh4iV5yOYgoHxPULUWeksMRcYk LC+DQxil1YyD6ENPJ4s58Kv/hApX2uCPSG0OhpUW3t1Xd3hSfD9s5b5fn A==; X-CSE-ConnectionGUID: 1Ztb+vY/TleaeEz6EPDQ8Q== X-CSE-MsgGUID: OUMCUwWeQjG84DvBzCuEBQ== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162636" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:47 +0800 IronPort-SDR: 6643a030_vbkhKolijDfota61KtO5IZcnXqoddt7g8f6UktERxVuhCt2 B0M8kVMUYS+gl9osGHl3elA//n+k91aNvhON2NQ== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:33 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:45 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 2/8] btrfs-progs: mkfs: remove duplicated device size check Date: Tue, 14 May 2024 12:22:21 -0600 Message-ID: <20240514182227.1197664-3-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 test_minimum_size() already checks if each device can host the initial block groups. There is no need to check if the first device can host the initial system chunk again. Signed-off-by: Naohiro Aota --- mkfs/main.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mkfs/main.c b/mkfs/main.c index 950f76101058..f6f67abf3b0e 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1189,7 +1189,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv) struct prepare_device_progress *prepare_ctx = NULL; struct mkfs_allocation allocation = { 0 }; struct btrfs_mkfs_config mkfs_cfg; - u64 system_group_size; /* Options */ bool force_overwrite = false; struct btrfs_mkfs_features features = btrfs_mkfs_default_features; @@ -1770,14 +1769,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv) goto error; } - /* To create the first block group and chunk 0 in make_btrfs */ - system_group_size = (opt_zoned ? zone_size(file) : BTRFS_MKFS_SYSTEM_GROUP_SIZE); - if (dev_byte_count < system_group_size) { - error("device is too small to make filesystem, must be at least %llu", - system_group_size); - goto error; - } - if (btrfs_bg_type_to_tolerated_failures(metadata_profile) < btrfs_bg_type_to_tolerated_failures(data_profile)) warning("metadata has lower redundancy than data!\n"); From patchwork Tue May 14 18:22:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664351 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B0A1180A64 for ; Tue, 14 May 2024 18:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711094; cv=none; b=FzWArK/zywePhKwDqYTzMmQ5JgMPZriGzPYcQ/FwAvFEd9qsgA9aKEYdatydE9Z/uasruGlCUyEOYmXVflY509jUw8Pln2HUdifkgRgonikEamDr0yMpdFWngtdfpCo1wduTd9IQjQ7toW1sXBRwSnBwCDjbWBGnE1h09NVDDfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711094; c=relaxed/simple; bh=Ek0WCq6b/0O2vdSWF3CqjsqnmxmWFaX6kUGKL3z2U+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aFNH1eG+/d42106dUEWjsnqWfyvf9aS+5CETfi3IFv7Ho5LTFkBJAQPEGTLzAGm67OSrjbNiuogFkEma30XqKa6Onk6cOpEGVfoB/ULxGKOd7xhoDGIQxYWjUdbogpVAPCaXdD9kId/+m/f5F7YVapj3VIJTb1bKZmEM21qj3gw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=SmeOspU/; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="SmeOspU/" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711092; x=1747247092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ek0WCq6b/0O2vdSWF3CqjsqnmxmWFaX6kUGKL3z2U+I=; b=SmeOspU/5lQm8Ksk6rfasEJgvSOvEJCKHb5QNCMee4tdjU3GDOIHpmpz /u21o9IluGvQeixRh3JJ+XjiCGyvaH3ttRTLk8twgEd+zg+KJDpaEXfNL x2BIAwm/MbZBsfmp14vl4vMYNbrEVUm6781KbMqmoo+HG+aunLOW4Pkt+ jpF+jzBfj3QaelUoR0/L6kPv+7LMCUQWfiZSo8nrTunlRHvLrA5+389YJ fKPFmc6yVLQp9F4kCmuGIHXvXtL+fv7qdj2TLmMVmXjpJ4iU15TxFp8WV +GfHrlFFCVmfEVLMMSqfP3uwIt88QV/ZXM9f/ooVyBPeR9a6AWgmecfRX g==; X-CSE-ConnectionGUID: r2hifLoZSXuv//PwfjYDTg== X-CSE-MsgGUID: g/TEb5UgTSuUjwmYRNmUrA== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162639" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:49 +0800 IronPort-SDR: 6643a032_Pwci4xFsspUakuv5NJfZpPoGOml+RS52Jd2/LvpHNFTaCcs KuaJGMTENcC/urc3DjsuXwdvjeYI9r9iRepEXmw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:35 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:47 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 3/8] btrfs-progs: mkfs: unify zoned mode minimum size calc into btrfs_min_dev_size() Date: Tue, 14 May 2024 12:22:22 -0600 Message-ID: <20240514182227.1197664-4-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We are going to implement a better minimum size calculation for the zoned mode. Move the current logic to btrfs_min_dev_size() and unify the size checking path. Also, convert "int mixed" to "bool mixed" while at it. Signed-off-by: Naohiro Aota --- mkfs/common.c | 11 ++++++++++- mkfs/common.h | 2 +- mkfs/main.c | 22 +++++----------------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/mkfs/common.c b/mkfs/common.c index 3c48a6c120e7..af54089654a0 100644 --- a/mkfs/common.c +++ b/mkfs/common.c @@ -811,13 +811,22 @@ static u64 btrfs_min_global_blk_rsv_size(u32 nodesize) return (u64)nodesize << 10; } -u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile, +u64 btrfs_min_dev_size(u32 nodesize, bool mixed, u64 zone_size, u64 meta_profile, u64 data_profile) { u64 reserved = 0; u64 meta_size; u64 data_size; + /* + * 2 zones for the primary superblock + * 1 zone for the system block group + * 1 zone for a metadata block group + * 1 zone for a data block group + */ + if (zone_size) + return 5 * zone_size; + if (mixed) return 2 * (BTRFS_MKFS_SYSTEM_GROUP_SIZE + btrfs_min_global_blk_rsv_size(nodesize)); diff --git a/mkfs/common.h b/mkfs/common.h index d9183c997bb2..de0ff57beee8 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -105,7 +105,7 @@ struct btrfs_mkfs_config { int make_btrfs(int fd, struct btrfs_mkfs_config *cfg); int btrfs_make_root_dir(struct btrfs_trans_handle *trans, struct btrfs_root *root, u64 objectid); -u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile, +u64 btrfs_min_dev_size(u32 nodesize, bool mixed, u64 zone_size, u64 meta_profile, u64 data_profile); int test_minimum_size(const char *file, u64 min_dev_size); int is_vol_small(const char *file); diff --git a/mkfs/main.c b/mkfs/main.c index f6f67abf3b0e..a437ecc40c7f 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1588,8 +1588,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv) goto error; } - min_dev_size = btrfs_min_dev_size(nodesize, mixed, metadata_profile, - data_profile); + min_dev_size = btrfs_min_dev_size(nodesize, mixed, + opt_zoned ? zone_size(file) : 0, + metadata_profile, data_profile); /* * Enlarge the destination file or create a new one, using the size * calculated from source dir. @@ -1650,21 +1651,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv) if (byte_count && byte_count < min_dev_size) { error("size %llu is too small to make a usable filesystem", byte_count); - error("minimum size for btrfs filesystem is %llu", - min_dev_size); - goto error; - } - /* - * 2 zones for the primary superblock - * 1 zone for the system block group - * 1 zone for a metadata block group - * 1 zone for a data block group - */ - if (opt_zoned && byte_count && byte_count < 5 * zone_size(file)) { - error("size %llu is too small to make a usable filesystem", - byte_count); - error("minimum size for a zoned btrfs filesystem is %llu", - min_dev_size); + error("minimum size for a %sbtrfs filesystem is %llu", + opt_zoned ? "zoned mode " : "", min_dev_size); goto error; } From patchwork Tue May 14 18:22:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664353 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFFD6180A6D for ; Tue, 14 May 2024 18:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711095; cv=none; b=El/K6y92xUJgI00MqxVKgIQikEAXAxW5kQPyCzBaZ/NZcP1j+x6zUtR+F8WKjZ2SeZAzstjZXdjzi2wPzNzJDcDGVqZBwCwMlYL5jVD6+0hJAyO7m7+owFQBrOwIhcdWbNcUbR/lumE6O8kBwh78cPkjR7XoHlZ80AoOoOv7k64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711095; c=relaxed/simple; bh=HHFvQPD4YAmAebDuRTdtW6wNl8XhmAP67kIb8IGY+QE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ua1DCyI5AnwFQwzdgi2djSIp+nwMie2z9tywBDxpCcATRms0+jTJ6R85H1BjKDbQYgYDU5VZJuvUvQX1BuMnymrPrng4/9yVMDAq+HXZBJTdjojHSnROq8JbsfQEDlEnvKfVjwLAsMOKrYm0O0dqCxphvVE9ZdioMvAWJdRPbPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=HS08gQZF; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="HS08gQZF" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711094; x=1747247094; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HHFvQPD4YAmAebDuRTdtW6wNl8XhmAP67kIb8IGY+QE=; b=HS08gQZFqSaMXi93gElS5KFHIrnbr7qde+NprO7U+zevIDPhuoa3PBb8 0jt/hxGqY0zM+U7GJFxH3WNJGPSEJEnpKTd7sQWOctsLGZXB1l/zaA97k jHaiOUuy8oXZKnEN7hXnsjYeP8LpQ4VJDkmp6SEW6tEPiMUa6eR7cJ+75 gkZYiY4b1CpGEsk/njXEqwc37pzcTMN12LObRknPHn9N4UBaWy8T/s69v dCu89G3ALy8KooAAkKqp9yXEof7yE8QtDZwdeC8OuqHrlxdzhwBIWFWzR amDrOszxPapjDNCgxRlEoajCsAGWgWPJzA0EtdD4Y73chIjoB8wOX1+gG A==; X-CSE-ConnectionGUID: C8wrS42aSb6waInLzb6bpQ== X-CSE-MsgGUID: NJvcnx8dSQeqfraIbueWdw== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162661" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:50 +0800 IronPort-SDR: 6643a034_hUUeVc0wb7GL8+ZOO7o64jRA0x0pA+g2zHC1EyEDjLou7gG 436NBb1FgjeLvFnSZMJ1U84OsERXnbPrmVlReLQ== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:37 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:49 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 4/8] btrfs-progs: mkfs: fix minimum size calculation for zoned mode Date: Tue, 14 May 2024 12:22:23 -0600 Message-ID: <20240514182227.1197664-5-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently, we check if a device is larger than 5 zones to determine we can create btrfs on the device or not. Actually, we need more zones to create DUP block groups, so it fails with "ERROR: not enough free space to allocate chunk". Implement proper support for non-SINGLE profile. Also, current code does not ensure we can create tree-log BG and data relocation BG, which are essential for the real usage. Count them as requirement too. Signed-off-by: Naohiro Aota --- mkfs/common.c | 53 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/mkfs/common.c b/mkfs/common.c index af54089654a0..a5100b296f65 100644 --- a/mkfs/common.c +++ b/mkfs/common.c @@ -818,14 +818,51 @@ u64 btrfs_min_dev_size(u32 nodesize, bool mixed, u64 zone_size, u64 meta_profile u64 meta_size; u64 data_size; - /* - * 2 zones for the primary superblock - * 1 zone for the system block group - * 1 zone for a metadata block group - * 1 zone for a data block group - */ - if (zone_size) - return 5 * zone_size; + if (zone_size) { + /* 2 zones for the primary superblock. */ + reserved += 2 * zone_size; + + /* + * 1 zone each for the initial system, metadata, and data block + * group + */ + reserved += 3 * zone_size; + + /* + * non-SINGLE profile needs: + * 1 zone for system block group + * 1 zone for normal metadata block group + * 1 zone for tree-log block group + * + * SINGLE profile only need to add tree-log block group + */ + if (meta_profile & BTRFS_BLOCK_GROUP_PROFILE_MASK) + meta_size = 3 * zone_size; + else + meta_size = zone_size; + /* DUP profile needs two zones for each block group. */ + if (meta_profile & BTRFS_BLOCK_GROUP_DUP) + meta_size *= 2; + reserved += meta_size; + + /* + * non-SINGLE profile needs: + * 1 zone for data block group + * 1 zone for data relocation block group + * + * SINGLE profile only need to add data relocationblock group + */ + if (data_profile & BTRFS_BLOCK_GROUP_PROFILE_MASK) + data_size = 2 * zone_size; + else + data_size = zone_size; + /* DUP profile needs two zones for each block group. */ + if (data_profile & BTRFS_BLOCK_GROUP_DUP) + data_size *= 2; + reserved += data_size; + + return reserved; + } if (mixed) return 2 * (BTRFS_MKFS_SYSTEM_GROUP_SIZE + From patchwork Tue May 14 18:22:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664355 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 496AC180A71 for ; Tue, 14 May 2024 18:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711096; cv=none; b=Oy3UCeyMKAQnkLxLaqWVkpVO5QuClhqQhAqm3VKKogzHDCx1+O7qLImlVbEut/6enr9rNcrEcY6Tf6xaWpQ9XzBLfgof3wVPmfhHrmvkTzB0+mzSK2cNZbIgCZVl5FT6qwhe5I6laL3yvvjW3xHDlLhJ53IdhrYaGpLOIVc14gs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711096; c=relaxed/simple; bh=291spckHOc/OndRzbUKt1knBk+0K4i7rEvJSmzcNZQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HjgmTAa2xnadlKKpSn3EomqviF4p37e9xtQXotfPl+M6QXIF35Nj1C2g36fEKMZnE+s7xqj5ovu+/ZfA0BzhsyPw/1q/8E3W9kCz5PDOeGpLcTAVlpdUQtCptm/XcZQq1MnjNQpqCqgSfl6ipxYDKtoHrPRG4ePHcjkvlsSxskA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=Uq6IjmAg; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Uq6IjmAg" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711094; x=1747247094; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=291spckHOc/OndRzbUKt1knBk+0K4i7rEvJSmzcNZQA=; b=Uq6IjmAgVonU6uxI+llOz6iOwwX1Uxfi5s3fzUH4wiqmWh2w9ejz1UMw yNoZM9Z+bjXDM65cZIi5Cdhr7QQ8e6C0UMP7rNb1k1g9giZPXZFc9NkmU WbIzvJEgdr0DxTMXsPjmesIZjiK/dbklRQflgakXb+l5z5FT1uCizT9yb Amw7V9XY1im0idUykTlVGzP9cYtpiq0IgLGydg/DuLfWF8JkTT8LuhqQE JpCSbPAG/KLzToYOAL3z0vZ18H/xbPv90nfC3dMa28ZGLx2z8lcZyjgiO hRKfJVbYpT51OhSTdjCBGruiJBvaYCHc0Ot6keMi/TCmRZRj8rQ+c7cr4 w==; X-CSE-ConnectionGUID: zLSrvCZ2ROGurz9/Mou+qg== X-CSE-MsgGUID: aB6k4ZvmS3OFCvadVhwr0Q== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162686" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:52 +0800 IronPort-SDR: 6643a036_VkJ7vvCtC5ObYWvSidRRSKn5GxykuIyoVOU/eio87RbXmjV wHF631DnlPCEoQ9jgWSvjBDskPiKTG0+jRg3PrA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:39 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:51 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 5/8] btrfs-progs: mkfs: check if byte_count is zone size aligned Date: Tue, 14 May 2024 12:22:24 -0600 Message-ID: <20240514182227.1197664-6-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Creating a btrfs whose size is not aligned to the zone boundary is meaningless and allowing it can confuse users. Disallow creating it. Signed-off-by: Naohiro Aota --- mkfs/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkfs/main.c b/mkfs/main.c index a437ecc40c7f..faf397848cc4 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1655,6 +1655,11 @@ int BOX_MAIN(mkfs)(int argc, char **argv) opt_zoned ? "zoned mode " : "", min_dev_size); goto error; } + if (byte_count && opt_zoned && !IS_ALIGNED(byte_count, zone_size(file))) { + error("size %llu is not aligned to zone size %llu", byte_count, + zone_size(file)); + goto error; + } for (i = saved_optind; i < saved_optind + device_count; i++) { char *path; From patchwork Tue May 14 18:22:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664354 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D5FC180A77 for ; Tue, 14 May 2024 18:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711096; cv=none; b=UiHhdtUk73xUi79Pd85MFFhK2XlamoFLPDvFKPR5z954PY2sWZMTrZLrsLIuFkpYM9qLdb9F8uZ+f7FZueAeymv3C0YP0/dNZVtfpnvCwDnMXoaw8weT0KDtSr0CtKnNRPESFFpi7qy5Re9v1UKFLAXkGWTEUSEPzDjKfDeYF2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711096; c=relaxed/simple; bh=klr9/AUVZNtvfwteTzObnPP7VP0pV1dlrOUo7PAanQE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C8/PWBmqccE9sl3kH+jPNwmIPjG7Qii/Gb2ij9agvuZcCxOg4t8Y/8B1FnoxW6TFIqUQ0VbAP7kUDDh5k91IPQx6DjdQlg1XB7wmvU7UA/sio1BHUR1+QroktIiRnRvZgUKwDPG5MW4WV20wxJruJAy8UjWqhWL5gO/nauQDiy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=J02zkHXo; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="J02zkHXo" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711094; x=1747247094; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=klr9/AUVZNtvfwteTzObnPP7VP0pV1dlrOUo7PAanQE=; b=J02zkHXospehLsAu2dnI3GAzhcgHW6MH+pmf9xXMOq/uW56izY4kzoHU 3tQZlq/qJWpr2qFEfxZrSooVNmKmmjK4mgr7ICWbRju1E77VEMiEnIHV5 rW5BLmygRPxSqRSHydSztr4UCGuwaSmV370/SYskdoTQf0z4DZeK3GwxE naSCQ/kRAanXeCojqh26K+s2UCM/iyNzlhL7RRCdMr2EB3QyRIvmrSBIW tYj5tAB+sTWd/0fonZsM703v9PUtjTUqiYYFcVaXBrOdfCKvdyNrAJ/fi wKoXY4Hdcq0Psx+3MHlk1wqA+WdX7LCs0f9ikuFbN/k9aoTXC09R/ubdx A==; X-CSE-ConnectionGUID: 5UnV/yRgRaOoxK6uoped/A== X-CSE-MsgGUID: Fgc10bolTFC9Oga3pRr9cQ== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162688" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:54 +0800 IronPort-SDR: 6643a038_bzNZP6ph9vREVfHrz3Xw14H1s+4zYeGcG8NdJk3gCxXOzOv RbIn4r8EZTO0fCGyV1lcYOHQmikEAKjwzzJiioA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:41 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:53 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 6/8] btrfs-progs: support byte length for zone resetting Date: Tue, 14 May 2024 12:22:25 -0600 Message-ID: <20240514182227.1197664-7-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Even with "mkfs.btrfs -b", mkfs.btrfs resets all the zones on the device. Limit the reset target within the specified length. Also, we need to check that there is no active zone outside of the FS range. If there is one, btrfs fails to meet the active zone limit properly. Signed-off-by: Naohiro Aota Reviewed-by: Qu Wenruo --- common/device-utils.c | 17 ++++++++++++----- kernel-shared/zoned.c | 23 ++++++++++++++++++++++- kernel-shared/zoned.h | 7 ++++--- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/common/device-utils.c b/common/device-utils.c index 86942e0c7041..7df7d9ce39d8 100644 --- a/common/device-utils.c +++ b/common/device-utils.c @@ -254,16 +254,23 @@ int btrfs_prepare_device(int fd, const char *file, u64 *byte_count_ret, if (!zinfo->emulated) { if (opflags & PREP_DEVICE_VERBOSE) - printf("Resetting device zones %s (%u zones) ...\n", - file, zinfo->nr_zones); + printf("Resetting device zones %s (%llu zones) ...\n", + file, byte_count / zinfo->zone_size); /* * We cannot ignore zone reset errors for a zoned block * device as this could result in the inability to write * to non-empty sequential zones of the device. */ - if (btrfs_reset_all_zones(fd, zinfo)) { - error("zoned: failed to reset device '%s' zones: %m", - file); + ret = btrfs_reset_zones(fd, zinfo, byte_count); + if (ret) { + if (ret == EBUSY) { + error("zoned: device '%s' contains an active zone outside of the FS range", + file); + error("zoned: btrfs needs full control of active zones"); + } else { + error("zoned: failed to reset device '%s' zones: %m", + file); + } goto err; } } diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c index fb1e1388804e..b4244966ca36 100644 --- a/kernel-shared/zoned.c +++ b/kernel-shared/zoned.c @@ -395,16 +395,24 @@ static int report_zones(int fd, const char *file, * Discard blocks in the zones of a zoned block device. Process this with zone * size granularity so that blocks in conventional zones are discarded using * discard_range and blocks in sequential zones are reset though a zone reset. + * + * We need to ensure that zones outside of the FS is not active, so that + * the FS can use all the active zones. Return EBUSY if there is an active + * zone. */ -int btrfs_reset_all_zones(int fd, struct btrfs_zoned_device_info *zinfo) +int btrfs_reset_zones(int fd, struct btrfs_zoned_device_info *zinfo, u64 byte_count) { unsigned int i; int ret = 0; ASSERT(zinfo); + ASSERT(IS_ALIGNED(byte_count, zinfo->zone_size)); /* Zone size granularity */ for (i = 0; i < zinfo->nr_zones; i++) { + if (byte_count == 0) + break; + if (zinfo->zones[i].type == BLK_ZONE_TYPE_CONVENTIONAL) { ret = device_discard_blocks(fd, zinfo->zones[i].start << SECTOR_SHIFT, @@ -419,7 +427,20 @@ int btrfs_reset_all_zones(int fd, struct btrfs_zoned_device_info *zinfo) if (ret) return ret; + + byte_count -= zinfo->zone_size; } + for (; i < zinfo->nr_zones; i++) { + const enum blk_zone_cond cond = zinfo->zones[i].cond; + + if (zinfo->zones[i].type == BLK_ZONE_TYPE_CONVENTIONAL) + continue; + if (cond == BLK_ZONE_COND_IMP_OPEN || + cond == BLK_ZONE_COND_EXP_OPEN || + cond == BLK_ZONE_COND_CLOSED) + return EBUSY; + } + return fsync(fd); } diff --git a/kernel-shared/zoned.h b/kernel-shared/zoned.h index 6eba86d266bf..2bf24cbba62a 100644 --- a/kernel-shared/zoned.h +++ b/kernel-shared/zoned.h @@ -149,7 +149,7 @@ bool btrfs_redirty_extent_buffer_for_zoned(struct btrfs_fs_info *fs_info, u64 start, u64 end); int btrfs_reset_chunk_zones(struct btrfs_fs_info *fs_info, u64 devid, u64 offset, u64 length); -int btrfs_reset_all_zones(int fd, struct btrfs_zoned_device_info *zinfo); +int btrfs_reset_zones(int fd, struct btrfs_zoned_device_info *zinfo, u64 byte_count); int zero_zone_blocks(int fd, struct btrfs_zoned_device_info *zinfo, off_t start, size_t len); int btrfs_wipe_temporary_sb(struct btrfs_fs_devices *fs_devices); @@ -203,8 +203,9 @@ static inline int btrfs_reset_chunk_zones(struct btrfs_fs_info *fs_info, return 0; } -static inline int btrfs_reset_all_zones(int fd, - struct btrfs_zoned_device_info *zinfo) +static inline int btrfs_reset_zones(int fd, + struct btrfs_zoned_device_info *zinfo, + u64 byte_count) { return -EOPNOTSUPP; } From patchwork Tue May 14 18:22:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664356 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38BBB180A99 for ; Tue, 14 May 2024 18:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711097; cv=none; b=fyOByrgy4JEtkjll1XaNyj/4EAaqtjXpVDe+aLzO0j67S+gnnrx4hfRiTNCe7hqnM6KyPW4MGJEhvVSoZJp8JhFIALjVFAQq9Wisw+EGz+DvbAu9ix26I1FocxX5ORFkTuM/+w43thiR6OTfifi6REH0oTsP1ld3vhzR23kyJUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711097; c=relaxed/simple; bh=4gkCUrWahnbxiYjoyll7myhbF+jlCYVlnaoJjk7//Js=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K/Yj8xgyZx8qKU7Fpk9D3/BpBecxbsJLWVcQNHS2v4VlZU9TlBsPlOtvFNLA2VGRE4x01yA5q4rcc4EEAdfXC3lxwUGbqCO/qHmwkfnuWGMpclQemDUi7VezJ2G9JYwjCuPy9MjpRIfw3GmW/jNEWydX0hdztbsGfndMsppN12U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=YKJ78/ei; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="YKJ78/ei" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711096; x=1747247096; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4gkCUrWahnbxiYjoyll7myhbF+jlCYVlnaoJjk7//Js=; b=YKJ78/eiasBA0pMAAvwGQlW8p/2TbaIdtpLQHAxVebo/Xq6bmjDNoRW0 niE8vJbltFyK+bI0AK4sXjMfTuxJtJcl2QuTA4hCfmROLKB6UgZu50qxZ QTfhtQrLDA/m9fex6vk414ad/5sTqapTXthTVjpQH7vqz+NuxFgnSCQ1C IViz07qOXYWxQwdNeN20ysII4e/PXb3N9tHTzk2Xhdn62rPd1LQJ7xLvN vS4uKPNqzHlJDTGE9FeavYIgCVYTacJMtOJ7MGDoowon+ZRjBpYQikJsf nLa+EhmkEmKDkapaApfM3ISmpWe7ix9mNF5kWIPgliwhDsVJ1Zpu8RvS4 A==; X-CSE-ConnectionGUID: wjjbsDKlRFSlym15S03r2A== X-CSE-MsgGUID: dufCt2YdQa6rQuT2kwoNjw== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162691" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:56 +0800 IronPort-SDR: 6643a03a_9tc5jqZAznBRNVZagr+F7n0EVa0StqztlmdNW6wV0NEazAR 8MKEzU6QXXm3GNIjuf71rvyv9TUMnGlDkRWfGYQ== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:42 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:54 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 7/8] btrfs-progs: add test for zone resetting Date: Tue, 14 May 2024 12:22:26 -0600 Message-ID: <20240514182227.1197664-8-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add test for mkfs.btrfs's zone reset behavior to check if - it resets all the zones without "-b" option - it detects an active zone outside of the FS range - it do not reset a zone outside of the range Signed-off-by: Naohiro Aota --- tests/mkfs-tests/032-zoned-reset/test.sh | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 tests/mkfs-tests/032-zoned-reset/test.sh diff --git a/tests/mkfs-tests/032-zoned-reset/test.sh b/tests/mkfs-tests/032-zoned-reset/test.sh new file mode 100755 index 000000000000..6a599dd2874f --- /dev/null +++ b/tests/mkfs-tests/032-zoned-reset/test.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Verify mkfs for zoned devices support block-group-tree feature + +source "$TEST_TOP/common" || exit + +setup_root_helper +prepare_test_dev + +nullb="$TEST_TOP/nullb" +# Create one 128M device with 4M zones, 32 of them +size=128 +zone=4 + +run_mayfail $SUDO_HELPER "$nullb" setup +if [ $? != 0 ]; then + _not_run "cannot setup nullb environment for zoned devices" +fi + +# Record any other pre-existing devices in case creation fails +run_check $SUDO_HELPER "$nullb" ls + +# Last line has the name of the device node path +out=$(run_check_stdout $SUDO_HELPER "$nullb" create -s "$size" -z "$zone") +if [ $? != 0 ]; then + _fail "cannot create nullb zoned device $i" +fi +dev=$(echo "$out" | tail -n 1) +name=$(basename "${dev}") + +run_check $SUDO_HELPER "$nullb" ls + +TEST_DEV="${dev}" +last_zone_sector=$(( 4 * 31 * 1024 * 1024 / 512 )) +# Write some data to the last zone +run_check $SUDO_HELPER dd if=/dev/urandom of="${dev}" bs=1M count=4 seek=$(( 4 * 31 )) +# Use single as it's supported on more kernels +run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m single -d single "${dev}" +# Check if the lat zone is empty +$SUDO_HELPER blkzone report -o ${last_zone_sector} -c 1 "${dev}" | grep -Fq '(em)' +if [ $? != 0 ]; then + _fail "last zone is not empty" +fi + +# Write some data to the last zone +run_check $SUDO_HELPER dd if=/dev/urandom of="${dev}" bs=1M count=1 seek=$(( 4 * 31 )) +# Create a FS excluding the last zone +run_mayfail $SUDO_HELPER "$TOP/mkfs.btrfs" -f -b $(( 4 * 31 ))M -m single -d single "${dev}" +if [ $? == 0 ]; then + _fail "mkfs.btrfs should detect active zone outside of FS range" +fi + +# Fill the last zone to finish it +run_check $SUDO_HELPER dd if=/dev/urandom of="${dev}" bs=1M count=3 seek=$(( 4 * 31 + 1 )) +# Create a FS excluding the last zone +run_mayfail $SUDO_HELPER "$TOP/mkfs.btrfs" -f -b $(( 4 * 31 ))M -m single -d single "${dev}" +# Check if the lat zone is not empty +$SUDO_HELPER blkzone report -o ${last_zone_sector} -c 1 "${dev}" | grep -Fq '(em)' +if [ $? == 0 ]; then + _fail "last zone is empty" +fi + +run_check $SUDO_HELPER "$nullb" rm "${name}" From patchwork Tue May 14 18:22:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13664357 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC0F3180A71 for ; Tue, 14 May 2024 18:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711099; cv=none; b=T2eM/Nu8AFCZ3dgfIXlMbhCSL1Gmmaebq/8Zh81ySfagxfMCxrVGlERnL4/oAT0z/pW8L03WvMOYhenT3wjv5GvLOF5Z2JxD2hxoabI2pCVS0Ol4VLQg7YL/F1++bb1in+dVYrCm2wt6m+KxWXLmWcrvekogyMn0rH1BMrRE2UM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715711099; c=relaxed/simple; bh=08v2xyBmdJ3XAG4ZotMl4yNKbz9h2IXrSbM6HIDWuH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J6mUxmb5hyO7+gD4pTL6vM2xb49olJV6zFreK2VRDgxf2whVMPRk95b1NVJKB9XLYEg2Q1p5bX4l7afuHxGG5s/AGdwq7xL2LrYeHB1Jm1c0a3Gxq7wWiZ7KgUfi8/XD86NQk9PSp8YuIBT8STatOBYuaMsOw6YZHJM79aSMRtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=T1qwFK/j; arc=none smtp.client-ip=216.71.153.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="T1qwFK/j" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1715711098; x=1747247098; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=08v2xyBmdJ3XAG4ZotMl4yNKbz9h2IXrSbM6HIDWuH0=; b=T1qwFK/j3ttBV8uxc83eBIIYw1Jnu3mZbbu6bNWG4mZPJD7SBiYXDvd5 3ZFVvWxo5Pj3/57Ux95NXPDlSm/Xcrm+prU4qhkLL/jPLbqBv/GcSIchF 3XekVuJTa5jV+Gtu6YV4lEOs5VYwbI0rFYI9oI+SK67++E9smyRJCdQ91 BEOBim9Z2HR3cSjFFS2SlcG2VsH+QsUzjQWAKLNycpSJIL9zFcQ6Iw80F 5h4EgOxfDTn53rohip982pRdi3uyMZjN0qX9teJJlj4o5hIPaPLM5nxna wROSla6mxTr1aUqcy+mLBNjTFVxTZ8RWRxIc2Y3QYouhT3pJws16Szmkw Q==; X-CSE-ConnectionGUID: dBMPWFYVQIuuUDVsPptmlw== X-CSE-MsgGUID: 58oCQ5SkQSqZJG0/5c4PKA== X-IronPort-AV: E=Sophos;i="6.08,159,1712592000"; d="scan'208";a="17162695" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 May 2024 02:24:57 +0800 IronPort-SDR: 6643a03b_Qy9gvtO+gIVlUtilw4ygphvOrtxA6EoQhY9m9f1AGv9DDJM X6Ag8zN4qsnyefpEy/0kCPzj3nciTgPpjESpNgA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 May 2024 10:32:44 -0700 WDCIronportException: Internal Received: from unknown (HELO naota-x1.wdc.com) ([10.225.163.56]) by uls-op-cesaip02.wdc.com with ESMTP; 14 May 2024 11:24:56 -0700 From: Naohiro Aota To: linux-btrfs@vger.kernel.org Cc: Naohiro Aota Subject: [PATCH v2 8/8] btrfs-progs: test: use smaller emulated zone size Date: Tue, 14 May 2024 12:22:27 -0600 Message-ID: <20240514182227.1197664-9-naohiro.aota@wdc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514182227.1197664-1-naohiro.aota@wdc.com> References: <20240514182227.1197664-1-naohiro.aota@wdc.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 With the change of minimal number of zones, mkfs-tests/030-zoned-rst now fails because the loopback device is 2GB and can contain 8x 256MB zones. Use "--param zone-size=4M" to use 4MB zone size as same other nullb case. We also need to enable "--enable-experimental" configure option in the CI scripts to use that mkfs.btrfs option. Currently, it is limited to the place mkfs test is running, but it would be nice to have it in general, as we need to test development code anyway. Signed-off-by: Naohiro Aota --- .github/workflows/coverage.yml | 2 +- .github/workflows/devel.yml | 2 +- .github/workflows/pull-request.yml | 2 +- tests/mkfs-tests/030-zoned-rst/test.sh | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3aea8cd5f56b..b7f209b3fc51 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -16,7 +16,7 @@ jobs: - run: sudo modprobe btrfs - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq lcov - name: Configure - run: ./autogen.sh && ./configure --disable-documentation + run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 D=gcov - name: Tests cli diff --git a/.github/workflows/devel.yml b/.github/workflows/devel.yml index aca6ed975563..3ac85b0b32e4 100644 --- a/.github/workflows/devel.yml +++ b/.github/workflows/devel.yml @@ -71,7 +71,7 @@ jobs: - run: sudo modprobe btrfs - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev libaio-dev liburing-dev attr jq - name: Configure - run: ./autogen.sh && ./configure --disable-documentation + run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 - name: Tests mkfs diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 954e1ee5ffb0..9765ea24a2e4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,7 +20,7 @@ jobs: - run: sudo modprobe btrfs - run: sudo apt-get install -y pkg-config gcc liblzo2-dev libzstd-dev libblkid-dev uuid-dev zlib1g-dev libext2fs-dev e2fsprogs libudev-dev python3-sphinx libaio-dev liburing-dev attr jq - name: Configure - run: ./autogen.sh && ./configure --disable-documentation + run: ./autogen.sh && ./configure --disable-documentation --enable-experimental - name: Make run: make V=1 # - name: Musl build diff --git a/tests/mkfs-tests/030-zoned-rst/test.sh b/tests/mkfs-tests/030-zoned-rst/test.sh index 2e048cf79f20..9fa9c8c0d30b 100755 --- a/tests/mkfs-tests/030-zoned-rst/test.sh +++ b/tests/mkfs-tests/030-zoned-rst/test.sh @@ -9,17 +9,18 @@ prepare_loopdevs TEST_DEV=${loopdevs[1]} profiles="single dup raid1 raid1c3 raid1c4 raid10" +zoned_param="-O zoned --param zone-size=4M" for dprofile in $profiles; do for mprofile in $profiles; do # It's sufficient to specify only 'zoned', the rst will be enabled - run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d "$dprofile" -m "$mprofile" "${loopdevs[@]}" + run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f ${zoned_param} -d "$dprofile" -m "$mprofile" "${loopdevs[@]}" done done run_mustfail "unsupported profile raid56 created" \ - $SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d raid5 -m raid5 "${loopdevs[@]}" + $SUDO_HELPER "$TOP/mkfs.btrfs" -f ${zoned_param} -d raid5 -m raid5 "${loopdevs[@]}" run_mustfail "unsupported profile raid56 created" \ - $SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d raid6 -m raid6 "${loopdevs[@]}" + $SUDO_HELPER "$TOP/mkfs.btrfs" -f ${zoned_param} -d raid6 -m raid6 "${loopdevs[@]}" cleanup_loopdevs