From patchwork Tue Feb 4 22:57:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13960138 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 537E721C16F; Tue, 4 Feb 2025 22:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709854; cv=none; b=gMDLzgkHPf0PhAgRJe2igXXBLGzPgyH7Zd/PlWBDYpI/55SVkhb009YLg7/evb8U1Yo+qT90h9badaITxkGcmS3iRauTrQE9z3ajqdln0ZxIhzwp2gg1pIFjhZZFLX1POTDH8uU2QmnaBtYKOAFjVxyXFqPTN3Di0s51WN1TFEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709854; c=relaxed/simple; bh=kO6f1O3HDdOalRErMblvO0RYv+5OS8N10AM+0kpGYos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tatqNzfVZ0qGts4Wr1x4iHXPBsAdZUb3NDIRD1QPlG+eCJTjxUCEv55QbXY64UIsOmug+/YambuxYD/U0FucYmG295qtp8pkRI74x3/J6k6iqKLz+p77nP73PXu/7aSf4IC0uu1azj/sBGcPUzzlggJhAE6UElL4sxP1pri4PDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=iPPVhclQ; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iPPVhclQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=YPetv4ik80Bce3zURVkwPK6SPctmLOIvLZPcpZz2oRw=; b=iPPVhclQkmipZWC0RD0kSGepZH 7NOOSozhmMzl7hdZJWy5npD354FpvcHGLt+D1yyCrAs0UqPxJOmKohMsfuiJigjzwVq3WPVzQV6qG Z51v3By8HvYHfbOlqX3wBOoLFNo9p4+Bnj4k26GIkvjI74Vwb8jxI0GTd6oxuplBMzWD/mRuSHhPW JpjLdS9VUzaQBiWKt3g+1TuK7dFMlkviYawRJRAvNOapIP8uu/X73AT9u6hW+GK63GHBadVAjgFlq lJhs270WqLFDwFCk+30zuR1iImyHgKdUP8c0rZxWYnK7W6yPW5RJbWoaV3kM1dyt+X+yLBuc7B1Xq e141YRoA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tfRrH-00000001m1z-1J9y; Tue, 04 Feb 2025 22:57:31 +0000 From: Luis Chamberlain To: shinichiro.kawasaki@wdc.com Cc: linux-block@vger.kernel.org, hare@suse.de, patches@lists.linux.dev, gost.dev@samsung.com, mcgrof@kernel.org Subject: [PATCH blktests v2 1/4] common: add and use min io for fio Date: Tue, 4 Feb 2025 14:57:26 -0800 Message-ID: <20250204225729.422949-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250204225729.422949-1-mcgrof@kernel.org> References: <20250204225729.422949-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Luis Chamberlain When using fio we should not issue IOs smaller than the device supports. Today a lot of places have in place 4k, but soon we will have devices which support bs > ps. For those devices we should check the minimum supported IO. However, since we also have a min optimal IO, we might as well use that as well. By using this we can also leverage the same lookup with stat whether or not the target file is a block device or a file. Signed-off-by: Luis Chamberlain --- common/fio | 23 +++++++++++++++++++++-- common/rc | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/common/fio b/common/fio index b9ea087fc6c5..557150656b29 100644 --- a/common/fio +++ b/common/fio @@ -189,15 +189,34 @@ _run_fio() { return $rc } +_fio_opts_to_min_io() { + local arg path + local -i min_io=4096 + + for arg in "$@"; do + [[ "$arg" =~ ^--filename= || "$arg" =~ --directory= ]] || continue + path="${arg##*=}" + min_io=$(_min_io "$path") + # Keep 4K minimum IO size for historical consistency + ((min_io < 4096)) && min_io=4096 + break + done + + echo "$min_io" +} + + # Wrapper around _run_fio used if you need some I/O but don't really care much # about the details _run_fio_rand_io() { - _run_fio --bs=4k --rw=randread --norandommap --numjobs="$(nproc)" \ + local bs=$(_fio_opts_to_min_io "$@") || return 1 + _run_fio --bs=$bs --rw=randread --norandommap --numjobs="$(nproc)" \ --name=reads --direct=1 "$@" } _run_fio_verify_io() { - _run_fio --name=verify --rw=randwrite --direct=1 --ioengine=libaio --bs=4k \ + local bs=$(_fio_opts_to_min_io "$@") || return 1 + _run_fio --name=verify --rw=randwrite --direct=1 --ioengine=libaio --bs=$bs \ --iodepth=16 --verify=crc32c --verify_state_save=0 "$@" } diff --git a/common/rc b/common/rc index bcb215d35114..e12ecd025868 100644 --- a/common/rc +++ b/common/rc @@ -387,6 +387,27 @@ _test_dev_is_partition() { [[ -n ${TEST_DEV_PART_SYSFS} ]] } +_min_io() { + local path_or_dev=$1 + if [ -z "$path_or_dev" ]; then + echo "path for min_io does not exist" + return 1 + fi + + if [ -c "$path_or_dev" ]; then + if [[ "$path_or_dev" == /dev/ng* ]]; then + path_or_dev="${path_or_dev/ng/nvme}" + fi + fi + + if [ -e "$path_or_dev" ]; then + stat --printf=%o "$path_or_dev" + else + echo "Error: '$path_or_dev' does not exist or is not accessible" + return 1 + fi +} + # Return max open zones or max active zones of the test target device. # If the device has both, return smaller value. _test_dev_max_open_active_zones() { From patchwork Tue Feb 4 22:57:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13960134 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 26AC421B8F7; Tue, 4 Feb 2025 22:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709853; cv=none; b=BK08vYjxvvaWGYHzyMCFXNiTLxZwGUlwRuxVczCAas9TT1hE6vpcmEvwJZHzOLxfAok09W8xqwCjcoQMjtmuc+E9ezGlVOxwc7ewNNbfEBRmdJP5d8GP+ymfWaokJePoOZqfktcPfMrXNH2ozLfu/ld/ELK1Jag0+ZfPh+tpU78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709853; c=relaxed/simple; bh=rGGmHFEY6+I2QsPlKgaRgK9IKJ9e/bHNPu0Y/4PxGFk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fRn02EoVe7Xnfo6aL308mtUnx6y5luP4giDhUeRNmcAXzaz1VjpRPydIoH34mRHedWhO70r0C3EuR7/esEB5YZ3FJdrVgGlOtgBmm0UQluvTOFNFUOhmPjRnaFrOsPhDOO5OWUO+sapF2lvlSYX9mLxRZ+gqT98IP7sRIOZUxPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=A8eVT3Yz; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="A8eVT3Yz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=/WSr4eK+w8nCw+zDhetQoEDG+PACdKmOWZPtoiEN+Zw=; b=A8eVT3YzKL3M3vkDHj6/+swUXh pKUwDHBnQD+sLQ8RDRChyea59dqB6Svafu8nvOftsfAERbDG9BOHKa7cym8MbxMqasKarANe5s7QM yJgGmSXexhW5uiXjuUvb3HCayTen19ZQJsICAx4BMvheg4Y5+udF1g//fFECx64wIQATOUecsimq5 HePyBeR6VK1s1yyVSBk9BmLocgmJLbowsrzDP073sV5LgCvWuwvJYF68KzRmjYSX17eoAXee1m9vZ wpBkJd+EvpE57koBjM+2EmLVXNWKi4PQTOB0oe08J/lLS4o9X9ikE5hd8DOegibrE0jSwhkhLVSMK 8SlQy1nQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tfRrH-00000001m21-1QEZ; Tue, 04 Feb 2025 22:57:31 +0000 From: Luis Chamberlain To: shinichiro.kawasaki@wdc.com Cc: linux-block@vger.kernel.org, hare@suse.de, patches@lists.linux.dev, gost.dev@samsung.com, mcgrof@kernel.org Subject: [PATCH blktests v2 2/4] common/xfs: use min io for fs blocksize Date: Tue, 4 Feb 2025 14:57:27 -0800 Message-ID: <20250204225729.422949-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250204225729.422949-1-mcgrof@kernel.org> References: <20250204225729.422949-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Luis Chamberlain Use the min io for the target block size. Likewise we need to increase the log size if using a bs > 4096. Signed-off-by: Luis Chamberlain --- common/xfs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/xfs b/common/xfs index 569770fecd53..8b068837fa37 100644 --- a/common/xfs +++ b/common/xfs @@ -13,10 +13,16 @@ _have_xfs() { _xfs_mkfs_and_mount() { local bdev=$1 local mount_dir=$2 + local bs=$(_min_io $bdev) + local xfs_logsize="64m" + + if [[ $bs -gt 4096 ]]; then + xfs_logsize="128m" + fi mkdir -p "${mount_dir}" umount "${mount_dir}" - mkfs.xfs -l size=64m -f "${bdev}" || return $? + mkfs.xfs -l size=$xfs_logsize -f "${bdev}" -b size=$bs || return $? mount "${bdev}" "${mount_dir}" } From patchwork Tue Feb 4 22:57:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13960136 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 26A5B21B181; Tue, 4 Feb 2025 22:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709853; cv=none; b=YXOI7YtRBXXMUv5s4wanBa1xFDb79ZVXyhhKIEd2bfHcp6p/+cEcTOs9fZfOAtpbxzx1Kn23iDpINcjZ3YjSCPpX1XCtxptn/Wn34eYL56UsCBOSROhNvNZV4C1IflMinU8n33kzZJAgBGFyaoIoR2UEMNbEmGkmd1wJSIqNKcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709853; c=relaxed/simple; bh=+sEXBuqmpbVuSN4Obp7rsVTc0g+gOMgqn8snZuHBnsc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FepDWgSVR5eJAlG8FKk1JLCSYMXPikuPXZSWfL0jNVBGRwLuDJtQ7w+xTB4Zk1BQgmFvCgpemUZ2Ut9QUerthxP68zh+uqD/z5MIM36izTf7mgIo0DUTZAOwXIO181in+KXtNH0JSvxN7ggCLOQoP4WSR8/PwXMcgEdQTySDRwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=OXBsfztz; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OXBsfztz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=QarJhWvhvzscEqk1hK64UZ1lx9htgiBiWPInl87qBdw=; b=OXBsfztzeCul4tIizLK9z2R8YD aD4IDFjh4gCmzOLNOXkZE05geFJ/HW3WyhDqpesS1tirqcj8ua1hcJ0dwH3ggBgB7jnMNKxXDCTpV 4xTLMwYV15TBXfNPX89cjgzh6N2txoe/T7c4HOZAg7KD1ti74N94831cjvpQySd1h3WSw7rSl6wYN d8dn7uX74ETR350GwuT2LWwy6vZkQ1aBZHq5k/OMRv5yvUZmXmyvcLkwsG4SG8VTjdsuxKOpl/aqo YMS9tuZwQqNBs3hB13+oHbrH0zA7y7pKhYW8iuhuf53LdKKHZZ3ZUQBsGkKTqDfceMsb1f9g+Yafa Fd3SX/YA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tfRrH-00000001m23-1YV9; Tue, 04 Feb 2025 22:57:31 +0000 From: Luis Chamberlain To: shinichiro.kawasaki@wdc.com Cc: linux-block@vger.kernel.org, hare@suse.de, patches@lists.linux.dev, gost.dev@samsung.com, mcgrof@kernel.org Subject: [PATCH blktests v2 3/4] tests: use test device min io to support bs > ps Date: Tue, 4 Feb 2025 14:57:28 -0800 Message-ID: <20250204225729.422949-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250204225729.422949-1-mcgrof@kernel.org> References: <20250204225729.422949-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Luis Chamberlain When a block device supports a minimum block size > ps we must ensure we don't issue IOs below what is supported. Just leverage the min optimal IO to also ensure we use the optimal IO as well. Signed-off-by: Luis Chamberlain --- tests/block/003 | 4 +++- tests/block/007 | 3 ++- tests/nvme/049 | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/block/003 b/tests/block/003 index 2af9b89ec3e5..d59f2eadd465 100755 --- a/tests/block/003 +++ b/tests/block/003 @@ -18,10 +18,12 @@ device_requires() { } test_device() { + local test_dev_bs=$(_min_io $TEST_DEV) + echo "Running ${TEST_NAME}" FIO_PERF_FIELDS=("trim iops") - _fio_perf --bsrange=4k-4g --rw=randtrim --norandommap --name=discards \ + _fio_perf --bsrange=${test_dev_bs}-4g --rw=randtrim --norandommap --name=discards \ --filename="$TEST_DEV" --number_ios=200k echo "Test complete" diff --git a/tests/block/007 b/tests/block/007 index 3b68d0deec35..8d4ee0758b12 100755 --- a/tests/block/007 +++ b/tests/block/007 @@ -31,13 +31,14 @@ cleanup_fallback_device() { } run_fio_job() { + local test_dev_bs=$(_min_io $TEST_DEV) if _test_dev_is_rotational; then size="32m" else size="1g" fi - _fio_perf --bs=4k --rw=randread --norandommap --name=reads \ + _fio_perf --bs=$test_dev_bs --rw=randread --norandommap --name=reads \ --filename="$TEST_DEV" --size="$size" --direct=1 \ --ioengine=pvsync2 --hipri="$1" } diff --git a/tests/nvme/049 b/tests/nvme/049 index 88d4fb122988..77bb4daf5b08 100755 --- a/tests/nvme/049 +++ b/tests/nvme/049 @@ -19,10 +19,12 @@ test_device() { echo "Running ${TEST_NAME}" local ngdev=${TEST_DEV/nvme/ng} + local test_dev_bs=$(_min_io $ngdev) + local target_size=4096 local common_args=( --size=1M --filename="$ngdev" - --bs=4k + --bs=$test_dev_bs --rw=randread --numjobs=1 --iodepth=16 @@ -34,8 +36,10 @@ test_device() { ) local fio_output + ((test_dev_bs > target_size)) && target_size=$test_dev_bs + # check security permission - if ! fio_output=$(fio --name=check --size=4k --filename="$ngdev" \ + if ! fio_output=$(fio --name=check --bs=$test_dev_bs --size=$target_size --filename="$ngdev" \ --rw=read --ioengine=io_uring_cmd 2>&1) && grep -q -e "Operation not permitted" \ -e "Permission denied" <<< "$fio_output"; then From patchwork Tue Feb 4 22:57:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13960137 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5384F21C172; Tue, 4 Feb 2025 22:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709854; cv=none; b=UVuX2/tntA6MNAjsFTfZ8LIQyJqfpjn8k2oI5zf2Y64oMFISG/GMJsd03hFHA5U1WojmXJfSGcjvcvOpgqGkllwD5GJsi3iLwEDsNJ3TAXKdBpG4ltTHKh+HeThjl+ZMTWPJ2bcOjz2LAKKgStqcIx1ZbvDQWySTGwtLRSV7OUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738709854; c=relaxed/simple; bh=BODiohmKm8cTDp97zKOTvksVUaNhvdRHT/PhjLPoDGg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M9bbI6e6Mm1qOLpmuQeO9ewClgISLzc6kXvTmWkFTsJDWj4pHY+QoCxT+pZeR533my2pz/NjpGzfW4/jPWgX2B7e+bt1MCcmW/CV5/Ccs7zOagHibieeo9a9EEVUA8RNjaaFOJ1SerFMa3hegdSsIHo+ZFeW8aPG4NeZmC3qdss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=JsrDsvXT; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JsrDsvXT" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=n5ePGnOybzLL4xMQV7kTXCqghOG4qwHDurKWjefDKY0=; b=JsrDsvXT4k/Tipfxf3PmLxNYl+ lBR7kvFpTAbr7OHpJOvZx2nPZ1d/rv+hqNLHbxMBrnT+F+ODkkH774uhs6RJ9j57opTT+9o911wXW T+uavWZrqohwJh3yuJ4d+aMGTxZTMZcDEyFOQ31LnikbBNKPnvQC9PLof/8h49xUfTsfhJjDALagm aHZ8gK6LNMEwoxeR6sFx4fiyMxyME9ipmpdDUx3vPLsqbhXf4yMZwJ1azIvZNExOUJ2qDGGO4P7eY JuQd+wAqfFnNCevTeKExGd13MA6QZHDMvkK79GFJ8wgr8Qt60M6ujz/zRPHN7m9D/P/7m6Yt9xdBN 6E5+zTrA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tfRrH-00000001m25-1fSz; Tue, 04 Feb 2025 22:57:31 +0000 From: Luis Chamberlain To: shinichiro.kawasaki@wdc.com Cc: linux-block@vger.kernel.org, hare@suse.de, patches@lists.linux.dev, gost.dev@samsung.com, mcgrof@kernel.org Subject: [PATCH blktests v2 4/4] common/xfs: check for max supported sector size Date: Tue, 4 Feb 2025 14:57:29 -0800 Message-ID: <20250204225729.422949-5-mcgrof@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250204225729.422949-1-mcgrof@kernel.org> References: <20250204225729.422949-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Luis Chamberlain mkfs.xfs will use the sector size exposed by the device, if this is larger than 32k this will fail as the largest sector size on XFS is 32k. Provide a sanity check to ensure we skip creating a filesystem if the sector size is larger than what XFS supports. Signed-off-by: Luis Chamberlain --- common/xfs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/xfs b/common/xfs index 8b068837fa37..dbae572e4390 100644 --- a/common/xfs +++ b/common/xfs @@ -15,11 +15,18 @@ _xfs_mkfs_and_mount() { local mount_dir=$2 local bs=$(_min_io $bdev) local xfs_logsize="64m" + local sysfs="/sys/block/${bdev#/dev/}" + local logical_block_size=$(cat $sysfs/queue/logical_block_size) if [[ $bs -gt 4096 ]]; then xfs_logsize="128m" fi + if [[ $logical_block_size -gt 32768 ]]; then + SKIP_REASONS+=("max sector size for XFS is 32768 but device $bdev has a larger sector size $logical_block_size") + return 1 + fi + mkdir -p "${mount_dir}" umount "${mount_dir}" mkfs.xfs -l size=$xfs_logsize -f "${bdev}" -b size=$bs || return $?