From patchwork Mon Jan 29 14:00:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 13535706 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 257B8657BC for ; Mon, 29 Jan 2024 14:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536880; cv=none; b=K63hhOCfEJ+Y+g6eWbhr78ROxOPE5xbZ+f2Sy8iKKVWTyRj8o2v7rrCExJrosIiiCSLlinzBP8oq7ErVLHnJgDUUFmAsdBWg2cpKClDXtiA1mbtanZuAiB6OljJpYQ4oPLxTb8DfUkVhdLC6h2hZbDrlpVDWv1HRGPMOFF8boQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536880; c=relaxed/simple; bh=jsB6Fb4jKChHeHmoRxJBZsDMl8u82PA/P4RbwHxVqdc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qxxERIvktH1GbvA4oujgSVbYmcIuYAmXl+3xxn6z3UfuBTQBXAUVil11ym+S03qEZtq4jXB/OBgMhL0VzeGaw2FyZWlRj9DVbt8kiim30OyOihpqSjAGnupzWD0M0k99CirAyyF/WHGGn4oZKWu82HAHKZQOCcRd5aa108qh2IM= 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 (2048-bit key) header.d=suse.com header.i=@suse.com header.b=aHPkzD7Y; arc=none smtp.client-ip=209.85.208.180 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 (2048-bit key) header.d=suse.com header.i=@suse.com header.b="aHPkzD7Y" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2cf0390eddbso31413921fa.3 for ; Mon, 29 Jan 2024 06:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1706536876; x=1707141676; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+kk9KCNAFqv/VBIv/yGuF7QaAZ/PCtsVd4gqpBBURvg=; b=aHPkzD7Yzp+wRQjBe2muatN69q6MbyZDQ5pxLudBvTuxtX3TDW+mmRmgHECmuxE/+D E1X2GSU7601UleAeFm5kz5qtSsWvNA9sWfolnX2yFvpReimZpe4fwIlRn7nxhxIhSF6l h5n6dZZ6YuJtVZFsL8GzxBCsPWvj5+iRySyhwcDXPrrcCqp3J+RboJNdzxbcfjB3lUFY GF6wCmo6D+pOM4MUcTiexEH16G++a7EhOxLsK3DNU6yGNGB8QUJE7I5abrR0pT6rr4sR dmaFdps5D3CJIIFmkuVjAuQcJPaGewXbyf2PJmqDewr/EHI4Bz1UnQx1lShzquvBqGGj gY1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706536876; x=1707141676; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+kk9KCNAFqv/VBIv/yGuF7QaAZ/PCtsVd4gqpBBURvg=; b=HohEy6oD4/ITmwcTrbEBDxbJvCNDJ6R8Yr1ibNnL3cL1RVFNh2iK602vtIQBww60pS 31NrscrAC6cpRtXqXMZIqOxralMZvM7dZ1zaPLQWCDIbHQOb6NcOBhLpOR4Y4vKPfOcq xJhl+AH2a3VRiBxjqUxkTVh0Gy8BYABmhV70JEiRSRIfPVJW9nj5gqv8wbuCUgSqcjiD ZntrmdJn+QaSWqdt8dRT40ck9VpZzwjJQcW81fIrXb6/BXIkFggXGxh+FjxzYOcqBIU7 ghOux1J/GfSvzh3pOT6MrWXpbaautl1rUGlhn6fTPxL5UTmbvXlc0b+hhRqGfUmHxR0w qeNw== X-Gm-Message-State: AOJu0YxGkPyXWF16vOQmSXPMBfHTKneefC0xbLi6AfPy0f4UeEOiY/oi fVv4q85XRExTRP56D0cHIsxAFfEdTNPdAYAnOuw63ZhFBuu7pRzcRvy7PmY2WqQk21btzx7RfDT 5Sx0= X-Google-Smtp-Source: AGHT+IGpb9VKxJR1vLHwUv4xKDtNC0nqzxRwZ4Q0lmfM9SMSXAHAFdb4K05OJ+4cgO5QgMRL4r9JWQ== X-Received: by 2002:a2e:8482:0:b0:2cf:1aa1:beaf with SMTP id b2-20020a2e8482000000b002cf1aa1beafmr4013575ljh.42.1706536875760; Mon, 29 Jan 2024 06:01:15 -0800 (PST) Received: from localhost.localdomain ([43.228.146.200]) by smtp.gmail.com with ESMTPSA id s3-20020a17090330c300b001d8e2618792sm1871900plc.106.2024.01.29.06.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:01:14 -0800 (PST) From: Su Yue X-Google-Original-From: Su Yue To: fstests@vger.kernel.org Cc: linux-bcachefs@vger.kernel.org, l@damenly.org, bfoster@redhat.com, Su Yue Subject: [PATCH v3 1/2] fstests: introduce MKFS_BCACHEFS_PROG for bcachefs Date: Mon, 29 Jan 2024 22:00:58 +0800 Message-ID: <20240129140101.4259-1-l@damenly.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Su Yue mkfs.bcachefs supports force overwrite when option '-f' is given: $ mkfs.bcachefs --help | grep force -f, --force There are some tests which call _scratch_mkfs multiple times e.g. tests/generic/171. Without '-f' in MKFS_OPTIONS, these tests just hang in overwrite confirmation. After this commit, MKFS_BCACHEFS_PROG will contains ' -f' so we don't have to add '-f' to MKFS_OPTIONS manually to make these tests pass. It also fixes generic/466 which unsets MKFS_OPTIONS causing that test hangs in mfks.bcachefs waiting for confirmation of the force overwrite. Signed-off-by: Su Yue Reviewed-by: Brian Foster --- changelog: v3: Add Brian's Reviewed-by. v2: Add more details about why MKFS_BCACHEFS_PROG should contain '-f'. common/config | 3 ++- common/rc | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/config b/common/config index c9771ff934cb..1f9edceec57a 100644 --- a/common/config +++ b/common/config @@ -105,7 +105,7 @@ set_mkfs_prog_path_with_opts() # Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't # matter since it also prints the help when an invalid option is given. if [ "$p" != "" ] && \ - $p --help |& grep -q "[[:space:]]-f[[:space:]|]"; then + $p --help |& grep -q "[[:space:]]-f[[:space:]|,]"; then echo "$p -f" else echo $p @@ -313,6 +313,7 @@ export MKFS_REISER4_PROG=$(type -P mkfs.reiser4) export E2FSCK_PROG=$(type -P e2fsck) export TUNE2FS_PROG=$(type -P tune2fs) export FSCK_OVERLAY_PROG=$(type -P fsck.overlay) +export MKFS_BCACHEFS_PROG=$(set_mkfs_prog_path_with_opts bcachefs) # SELinux adds extra xattrs which can mess up our expected output. # So, mount with a context, and they won't be created. diff --git a/common/rc b/common/rc index 524ffa02aa6a..31c21d2a8360 100644 --- a/common/rc +++ b/common/rc @@ -611,6 +611,9 @@ _test_mkfs() xfs) $MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $* $TEST_DEV ;; + bcachefs) + $MKFS_BCACHEFS_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null + ;; *) yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* $TEST_DEV ;; @@ -753,6 +756,10 @@ _scratch_mkfs() mkfs_cmd="yes | $MKFS_PROG -t $FSTYP --" mkfs_filter="grep -v -e ^mkfs\.ocfs2" ;; + bcachefs) + mkfs_cmd="$MKFS_BCACHEFS_PROG" + mkfs_filter="cat" + ;; *) mkfs_cmd="yes | $MKFS_PROG -t $FSTYP --" mkfs_filter="cat" @@ -1044,7 +1051,7 @@ _scratch_mkfs_sized() export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS" ;; bcachefs) - $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV + $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized" @@ -1128,8 +1135,7 @@ _scratch_mkfs_blocksized() -C $blocksize $SCRATCH_DEV ;; bcachefs) - ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \ - $SCRATCH_DEV + _scratch_mkfs --block_size=$blocksize ;; udf) _scratch_mkfs -b $blocksize From patchwork Mon Jan 29 14:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 13535707 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 9683A657C3 for ; Mon, 29 Jan 2024 14:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536883; cv=none; b=mo3U8mKozWUxT7C+vFUAX7K9Nll2qnFqdDpfTNbIq/zRUzq9CmiMiAOXb4aNU+liI9sPwKweufa48c81tqgXzNtAL89PCzMpbFaDwM+JXZKs5H+wl2T1u5TQjCqhNl95dh/RkdO0xhEYwZMYIhoccQzk8wQ3hkYem3QkmYZe4kc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536883; c=relaxed/simple; bh=UWgSDhKosR9FGCdd6IKUFEPvSGWcGH5pubSyKyf+Nrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tMjr7rdmo/nOAnhR8rNDuahik6m1G7/nkdIF4M2aAtfmDSrOsnDTm5xxAjItGQnWO/DYUIDbSHeSxcTzJ62QspY2axFY4i1SdiQ1dsDzI3MdT99XykiEQZduMzIaNzEBAQGSTi8HwcI/3AHDxNkw1lsuNta3r/suKWqkY7ETw5o= 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 (2048-bit key) header.d=suse.com header.i=@suse.com header.b=IPRUjMGO; arc=none smtp.client-ip=209.85.208.182 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 (2048-bit key) header.d=suse.com header.i=@suse.com header.b="IPRUjMGO" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2cf591b5db7so20997501fa.2 for ; Mon, 29 Jan 2024 06:01:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1706536878; x=1707141678; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Db4Va7IrNtH54GBgsvXVUPtYzE1Cf7tUcn2FCv/sF5c=; b=IPRUjMGOkc8Zc00JSYmh3ojEMuVEe5t8wwxauVuUWI4klhOXrBBHFkkFy07akLnfAr 1o4plSJccmIlsisU33y0qPEOp6Jj64eUkEUEIkUGfDhoIAFC1ZBWKVxvwX5LB03HUdQ8 iRfEnsw1r/jyWhTKv7m/T1qJxB6EcgIArop1Z7IuFVK9DNuzjGTiurln+eABdBvzhWeg WfVwmryxlC2M+A31T2XEErv3yLORP43nLvhqC2edL6VLTuM0EXa/SPw98NtcwMnleD92 lGEt3Tfe0PEJ+6I6wnhhvwonVN5f84hV7X+imbuJpBvNhLYcYcU2KSleQQSpUFB4YN7n OKWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706536878; x=1707141678; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Db4Va7IrNtH54GBgsvXVUPtYzE1Cf7tUcn2FCv/sF5c=; b=lphHhe76rF0tYoBsZ1oSwAd3rRhmsliPQgTSayz6HGGhxcBIKBwDhDTo4qoeO7XGuN /rreSJ9odCYeo0SxDaCXjBGjWvOMxGugURusuEpa7pNejhv3MBzBYAoZVeyAjKt9+kNg F7L+msX0WVDYK5VrrJfKCDBa2QDYIUgrXG3mnv7DJAiIeN0aKlQ+SofbKs7bYw8I+UEN /xYgUqiyRNBEdnWC221NCLE7jbwx2vWBV7DR/83AmKfKmuItMjkqUvvc5Q/73B5xMbeR puW3sw1kWnGWLNw12LEeNWb5pWlRGrwn5fVcBMNnWLSOXUjI063Mx+VgFfLr1sJor92E vipQ== X-Gm-Message-State: AOJu0Yz0+eUtxgmNhQq2cXr4w6pDjHJPrzn5EbjUY1JnVSR1i0Ebj+C+ 0qXbMGdSKtpZOZSTNwHwVCPPNQcGVVSxDepmY4VKzfoaf0jIz4owbTl/EOVckW9nznnlwKB2Lzr CEBM= X-Google-Smtp-Source: AGHT+IGSGrHQAHUk7GV1sowY4IqMHOSG4oP2JlV0DtFW8S6U1pqZPiL5f/EZTZlwQ9x0woe7CSraow== X-Received: by 2002:a2e:b8d1:0:b0:2cf:457e:61fa with SMTP id s17-20020a2eb8d1000000b002cf457e61famr4528963ljp.37.1706536878011; Mon, 29 Jan 2024 06:01:18 -0800 (PST) Received: from localhost.localdomain ([43.228.146.200]) by smtp.gmail.com with ESMTPSA id s3-20020a17090330c300b001d8e2618792sm1871900plc.106.2024.01.29.06.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:01:17 -0800 (PST) From: Su Yue X-Google-Original-From: Su Yue To: fstests@vger.kernel.org Cc: linux-bcachefs@vger.kernel.org, l@damenly.org, bfoster@redhat.com, Su Yue Subject: [PATCH v3 2/2] common/rc: improve block_size support for bcachefs Date: Mon, 29 Jan 2024 22:00:59 +0800 Message-ID: <20240129140101.4259-2-l@damenly.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129140101.4259-1-l@damenly.org> References: <20240129140101.4259-1-l@damenly.org> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Su Yue mkfs.bcachefs now supports option '--block_size' to allow custom block_size. Add the pattern to set def_blksz if MKFS_OPTIONS contains the option in _scratch_mkfs_sized. Also let mkfs.bcachefs decide blocksize if no option is given in local.config or _scratch_mkfs_sized parameter. Signed-off-by: Su Yue --- changelog: v3: Add logic to Let mkfs.bcachefs decide blocksize if no option is given in local.config or _scratch_mkfs_sized parameter. v2: Born. --- common/rc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 31c21d2a8360..315a2413f963 100644 --- a/common/rc +++ b/common/rc @@ -930,6 +930,7 @@ _scratch_mkfs_sized() local fssize=$1 local blocksize=$2 local def_blksz + local blocksize_opt case $FSTYP in xfs) @@ -950,6 +951,13 @@ _scratch_mkfs_sized() jfs) def_blksz=4096 ;; + bcachefs) + def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(--block_size)[ =]?+([0-9]+).*/\2/p'` + [ -n "$def_blksize" ] && blocksize_opt="--block_size=$def_blksize" + [ -n "$blocksize" ] && blocksize_opt="--block_size=$blocksize" + # If no block size is given by local.confg or parameter, blocksize_opt is empty. + # Let MKFS_BCACHEFS_PROG decide block size on its own. + ;; esac [ -n "$def_blksz" ] && blocksize=$def_blksz @@ -1051,7 +1059,7 @@ _scratch_mkfs_sized() export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS" ;; bcachefs) - $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV + $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt $SCRATCH_DEV ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"