From patchwork Sun Oct 22 21:55:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 13432101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D274C07545 for ; Sun, 22 Oct 2023 21:55:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232804AbjJVVzo (ORCPT ); Sun, 22 Oct 2023 17:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232723AbjJVVzm (ORCPT ); Sun, 22 Oct 2023 17:55:42 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691BEE7 for ; Sun, 22 Oct 2023 14:55:40 -0700 (PDT) Received: from cwcc.thunk.org (pool-173-48-111-143.bstnma.fios.verizon.net [173.48.111.143]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 39MLtXUF015862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 22 Oct 2023 17:55:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1698011735; bh=nsVJL90y0ciANW67opnVRb3ZmabQtsy92nTuMZfKPE0=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type; b=hMzCcKyY06PJzhmbKPsu3kUOhAq/M8moGWELzY27d/UYw0HLZK3FuN28lhVZ2jlJy Wx+OPhbaLVAICe7sZWDLEKdxvYPk6vZPtcEcyu6dvDkz3vcKfEuZ1psgmfy03sh5Xm Js0Q8s2Ib+bBNiW7LcV5ycDd8Ige/cyKUtEgzZ9c02vl+dukhEQ9OL020IwCFiSuRY 0mEB98CLp7YNTHoRhNSC1aCgt2fSwLRqhoMZlG6fAjnSKYWe6J2vfgbaZlS1VZKgr1 /WEWhkNMaF7txrKLwqvgiK3KWhqHP65MlOXcIcLUpDbGQ7QTS+CfiMjFJ0Zsombvu1 cqmKdPDwd5xnw== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 86CDA15C024D; Sun, 22 Oct 2023 17:55:33 -0400 (EDT) From: "Theodore Ts'o" To: fstests@vger.kernel.org Cc: "Theodore Ts'o" Subject: [PATCH 1/2] common: check if the scratch device can support 1024 block sizes Date: Sun, 22 Oct 2023 17:55:28 -0400 Message-Id: <20231022215529.2202150-2-tytso@mit.edu> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20231022215529.2202150-1-tytso@mit.edu> References: <20231022215529.2202150-1-tytso@mit.edu> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org If the scratch device has as logical blocksize larger than 512 --- for example, some SSD or HDD's may have a 4k logical blocksize, and so will not support a file system with a 1k block size. Add a new function, _require_scratch_support_blocksize so we can skip tests that use _scratch_mkfs_blocksized with a size less than the scratch device's logical block size. Signed-off-by: Theodore Ts'o --- common/rc | 12 ++++++++++++ tests/ext4/055 | 1 + tests/xfs/205 | 1 + tests/xfs/432 | 1 + tests/xfs/516 | 1 + 5 files changed, 16 insertions(+) diff --git a/common/rc b/common/rc index 7f5a9527c..8d7179567 100644 --- a/common/rc +++ b/common/rc @@ -1124,6 +1124,9 @@ _scratch_mkfs_blocksized() if [ $blocksize -lt $(_get_page_size) ]; then _exclude_scratch_mount_option dax fi + if [ $blocksize -lt $(blockdev --getss $SCRATCH_DEV) ]; then + _require_scratch_support_blocksize "$blocksize" + fi case $FSTYP in btrfs) @@ -4452,6 +4455,15 @@ _get_device_size() echo $(($(blockdev --getsz $1) >> 1)) } +_require_scratch_support_blocksize() +{ + local blocksize=$1 + + if [ $blocksize -lt $(blockdev --getss $SCRATCH_DEV) ]; then + _notrun "$SCRATCH_DEV does not support a block size of $blocksize." + fi +} + # Make sure we actually have dmesg checking set up. _require_check_dmesg() { diff --git a/tests/ext4/055 b/tests/ext4/055 index aa15cfe98..7025f6283 100755 --- a/tests/ext4/055 +++ b/tests/ext4/055 @@ -27,6 +27,7 @@ echo "Silence is golden" # The 1K blocksize is designed for debugfs. _exclude_scratch_mount_option dax +_require_scratch_support_blocksize 1024 _scratch_mkfs "-F -O quota -b 1024" > $seqres.full 2>&1 # Start from 0, fill block 1 with 6,replace the original 2. diff --git a/tests/xfs/205 b/tests/xfs/205 index 104f1f45a..84c099208 100755 --- a/tests/xfs/205 +++ b/tests/xfs/205 @@ -23,6 +23,7 @@ _require_scratch_nocheck unset SCRATCH_RTDEV fsblksz=1024 +_require_scratch_support_blocksize $fsblksz _scratch_mkfs_xfs -d size=$((32768*fsblksz)) -b size=$fsblksz >> $seqres.full 2>&1 _scratch_mount diff --git a/tests/xfs/432 b/tests/xfs/432 index 66315b039..2efa6230b 100755 --- a/tests/xfs/432 +++ b/tests/xfs/432 @@ -50,6 +50,7 @@ echo "Format and mount" # block. 8187 hashes/dablk / 248 dirents/dirblock = ~33 dirblocks per # dablock. 33 dirblocks * 64k mean that we can expand a directory by # 2112k before we have to allocate another da btree block. +_require_scratch_support_blocksize 1024 _scratch_mkfs -b size=1k -n size=64k > "$seqres.full" 2>&1 _scratch_mount >> "$seqres.full" 2>&1 diff --git a/tests/xfs/516 b/tests/xfs/516 index 9e1b99317..65fc635dd 100755 --- a/tests/xfs/516 +++ b/tests/xfs/516 @@ -23,6 +23,7 @@ _cleanup() # real QA test starts here _supported_fs xfs _require_scratch_nocheck +_require_scratch_support_blocksize 1024 # Assume that if we can run scrub on the test dev we can run it on the scratch # fs too. From patchwork Sun Oct 22 21:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 13432100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E591DC0032E for ; Sun, 22 Oct 2023 21:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232739AbjJVVzn (ORCPT ); Sun, 22 Oct 2023 17:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjJVVzm (ORCPT ); Sun, 22 Oct 2023 17:55:42 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69F1EE8 for ; Sun, 22 Oct 2023 14:55:40 -0700 (PDT) Received: from cwcc.thunk.org (pool-173-48-111-143.bstnma.fios.verizon.net [173.48.111.143]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 39MLtX9w015863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 22 Oct 2023 17:55:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1698011735; bh=bIJxKYYWEvmzrPBJlBztzLXBM/0djAnLErdIMoAc4O0=; h=From:Subject:Date:Message-Id:MIME-Version; b=mF9/nVe2eFwLqjvd2kCMCG2mbO6JQ37Ot5KZYcanRr3kez/xmBVR9XDAP4VKE4Udv IueTSptAIcKje/btiQlAfDRLtM95khZx4ahsEbhbrscG8eLh9USsENFiMlFtJsaQpU EiQGN0ICuQJWtZVcmZKi1DxWuVjqGWt5Dit+GaUc3MBx4y9Qw8LQShT/b2OiqiHYGb ezLSqE4MrSHcxVmMoc82/Wmbwv+enHGxknU5y+K3Uov7gRi6S0J/XFJIX+pa66snJX drvyFLzeP4/Ffs92ZnWHZnTasc5Rxk5YiKi0LvGb1ABKGw7kCc2pTxF+5KQwYj3jzJ 9NXdw8Pzhqv3w== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 887C015C029A; Sun, 22 Oct 2023 17:55:33 -0400 (EDT) From: "Theodore Ts'o" To: fstests@vger.kernel.org Cc: "Theodore Ts'o" Subject: [PATCH 2/2] generic/563: create the loop dev with the same block size as the scratch dev Date: Sun, 22 Oct 2023 17:55:29 -0400 Message-Id: <20231022215529.2202150-3-tytso@mit.edu> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20231022215529.2202150-1-tytso@mit.edu> References: <20231022215529.2202150-1-tytso@mit.edu> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org The generic/563 test creates the loop device using $SCRATCH_DEV directly. We need to create the loop device with the same logical block size. Otherwise, the loop device will always be created with the default logical block size of 512, and if its underlying backing store has a different logical block size, then mkfs may create a file system in the loop device that will fail to mount. Signed-off-by: Theodore Ts'o Reviewed-by: Darrick J. Wong --- common/rc | 10 ++++++++-- tests/generic/563 | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/rc b/common/rc index 8d7179567..01f065a9f 100644 --- a/common/rc +++ b/common/rc @@ -4246,9 +4246,15 @@ _require_userns() _create_loop_device() { - local file=$1 dev - dev=`losetup -f --show $file` || _fail "Cannot assign $file to a loop device" + local file=$1 + local blocksize=$2 + local dev + + if [ -n "$blocksize" ]; then + blocksize="-b $blocksize" + fi + dev=`losetup -f $blocksize --show $file` || _fail "Cannot assign $file to a loop device" # Try to enable asynchronous directio mode on the loopback device so # that writeback started by a filesystem mounted on the loop device # won't be throttled by buffered writes to the lower filesystem. This diff --git a/tests/generic/563 b/tests/generic/563 index f98c6e42b..7e6bab49e 100755 --- a/tests/generic/563 +++ b/tests/generic/563 @@ -89,7 +89,7 @@ reset() # cgroup I/O accounting doesn't work on partitions. Use a loop device to rule # that out. -LOOP_DEV=$(_create_loop_device $SCRATCH_DEV) +LOOP_DEV=$(_create_loop_device $SCRATCH_DEV $(blockdev --getss $SCRATCH_DEV)) smajor=$((0x`stat -L -c %t $LOOP_DEV`)) sminor=$((0x`stat -L -c %T $LOOP_DEV`))