From patchwork Mon Aug 3 19:25:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 11698631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 604AC913 for ; Mon, 3 Aug 2020 19:26:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5EC622BF3 for ; Mon, 3 Aug 2020 19:26:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20150623.gappssmtp.com header.i=@toxicpanda-com.20150623.gappssmtp.com header.b="CuCdhzUk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727779AbgHCT0C (ORCPT ); Mon, 3 Aug 2020 15:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbgHCT0C (ORCPT ); Mon, 3 Aug 2020 15:26:02 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91CAC061756 for ; Mon, 3 Aug 2020 12:26:01 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id d14so36205569qke.13 for ; Mon, 03 Aug 2020 12:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=TrKa6Patrk2ZaeVVHOdYE4RjP0EMxsYHbGx5hW6HHiE=; b=CuCdhzUkbJwYUyTsTyraU1G0bnFu8B+0F1x4kabBi7MhUxDPdSdqFDc13SKfl8G/mY ZLS5pjn1bpbsmP4WE9FUvIJbFHdWb2kZbTnBK2MS9NcbTcjjyZHiV7E90wkDaQ8Mag1G 5mk64yq8QAzv1jYNW7rQLwNI64fm5KxPzGxIdSos//3CKEwUHSkz77N49/FP8nN1Zfg8 lthUMghkSLKjstvH8yxK9ei6Ktz1r/RA5/Z97BQAMbrd9gnR7XeIu//ggF8yVnyiJoB3 23x388T3rmG/54p5krDhjf/DrbcVcFIAl/JLWs0vrVcuKHiG6JtmAtWfjhK7fuUNN1vN ZgCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=TrKa6Patrk2ZaeVVHOdYE4RjP0EMxsYHbGx5hW6HHiE=; b=nwfKE5rDEmpBSR4nifdVvD6c80HNbS57ft7jY7WmDwjq3QNRMcKVuPpgbWS5i0+x3P ImBNX+G2YiEXqJlEiwc4Nasfx2jV7r9TUfEzUL4jNHPk5HDflSvbeatiW0KslX59w6IZ son8iQ7tzHACUtWh/qDVqr69ctCU8xOpZX1d+c0P94Kw5cFxO2PT+emu/rx+yTmQWbiL rUfWbhRRu3Ug0vqNBRb7BdgwJTCLRa4tTK9bw/5QvE1Xxumyu6bdBjv8FHejiKm5yoOX XgeHx7H4yaS2+5cp8EvBVfpcdqLGaULw+8OjPgBevopgGKqQWkzCtW7X/2KvskB8LhTF MFjQ== X-Gm-Message-State: AOAM530derYE+xblqdsvL4g6cbqORIeSgIDgAYSRVgeyGeehL8EY+O7B h3nRmu69leLgwAwDGjo9co1TeA== X-Google-Smtp-Source: ABdhPJyw8vdLh8Eyro2RgVvkgZDrJmGnB95IGBZ6v5qKmAvF3vSkZfy3Qu/8bvv1tyQPsO5JeN+k1Q== X-Received: by 2002:a37:bc87:: with SMTP id m129mr17583286qkf.47.1596482760828; Mon, 03 Aug 2020 12:26:00 -0700 (PDT) Received: from localhost (cpe-174-109-172-136.nc.res.rr.com. [174.109.172.136]) by smtp.gmail.com with ESMTPSA id y50sm24745819qtk.29.2020.08.03.12.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 12:26:00 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH] fstests: btrfs/217 add a test for btrfs seed device stats Date: Mon, 3 Aug 2020 15:25:59 -0400 Message-Id: <20200803192559.18330-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org This is a regression test for the issue fixed by btrfs: init device stats for seed devices We create a seed device, add a sprout device, and then check the device stats after a remount to make sure it succeeds. Signed-off-by: Josef Bacik Reviewed-by: Filipe Manana --- tests/btrfs/217 | 71 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/217.out | 25 ++++++++++++++++ tests/btrfs/group | 1 + 3 files changed, 97 insertions(+) create mode 100755 tests/btrfs/217 create mode 100644 tests/btrfs/217.out diff --git a/tests/btrfs/217 b/tests/btrfs/217 new file mode 100755 index 00000000..204298bd --- /dev/null +++ b/tests/btrfs/217 @@ -0,0 +1,71 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Facebook. All Rights Reserved. +# +# FS QA Test 217 +# +# Regression test for the problem fixed by the patch +# +# btrfs: init device stats for seed devices +# +# Make a seed device, add a sprout to it, and then make sure we can still read +# the device stats for both devices after we remount with the new sprout device. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/filter.btrfs + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs btrfs +_supported_os Linux +_require_test +_require_scratch_dev_pool 2 + +_scratch_dev_pool_get 2 + +dev_seed=$(echo $SCRATCH_DEV_POOL | awk '{print $1}') +dev_sprout=$(echo $SCRATCH_DEV_POOL | awk '{print $2}') + +# Create the seed device +_mkfs_dev $dev_seed +run_check _mount $dev_seed $SCRATCH_MNT +$XFS_IO_PROG -f -d -c "pwrite -S 0xab 0 1M" $SCRATCH_MNT/foo > /dev/null +$BTRFS_UTIL_PROG filesystem show -m $SCRATCH_MNT | \ + _filter_btrfs_filesystem_show +_scratch_unmount +$BTRFS_TUNE_PROG -S 1 $dev_seed + +# Mount the seed device and add the rw device +run_check _mount $dev_seed $SCRATCH_MNT +_run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT +$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_scratch_pool +_scratch_unmount + +# Now remount, validate the device stats do not fail +run_check _mount $dev_sprout $SCRATCH_MNT +$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_scratch_pool + +# success, all done +status=0 +exit diff --git a/tests/btrfs/217.out b/tests/btrfs/217.out new file mode 100644 index 00000000..86c6e775 --- /dev/null +++ b/tests/btrfs/217.out @@ -0,0 +1,25 @@ +QA output created by 217 +Label: none uuid: + Total devices FS bytes used + devid size used path SCRATCH_DEV + +[SCRATCH_DEV].write_io_errs 0 +[SCRATCH_DEV].read_io_errs 0 +[SCRATCH_DEV].flush_io_errs 0 +[SCRATCH_DEV].corruption_errs 0 +[SCRATCH_DEV].generation_errs 0 +[SCRATCH_DEV].write_io_errs 0 +[SCRATCH_DEV].read_io_errs 0 +[SCRATCH_DEV].flush_io_errs 0 +[SCRATCH_DEV].corruption_errs 0 +[SCRATCH_DEV].generation_errs 0 +[SCRATCH_DEV].write_io_errs 0 +[SCRATCH_DEV].read_io_errs 0 +[SCRATCH_DEV].flush_io_errs 0 +[SCRATCH_DEV].corruption_errs 0 +[SCRATCH_DEV].generation_errs 0 +[SCRATCH_DEV].write_io_errs 0 +[SCRATCH_DEV].read_io_errs 0 +[SCRATCH_DEV].flush_io_errs 0 +[SCRATCH_DEV].corruption_errs 0 +[SCRATCH_DEV].generation_errs 0 diff --git a/tests/btrfs/group b/tests/btrfs/group index ca90818b..32604e25 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -219,3 +219,4 @@ 214 auto quick send snapshot 215 auto quick 216 auto quick seed +217 auto quick volume