All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, fstests@vger.kernel.org
Subject: Re: [PATCH v3] btrfs: test block group size class loading logic
Date: Mon, 30 Jan 2023 12:49:25 +0800	[thread overview]
Message-ID: <20230130044925.jv23enewzb5xpdrl@zlang-mailbox> (raw)
In-Reply-To: <16b9a9042169c25a10dd1867cedd14849d00dca5.1674755053.git.boris@bur.io>

On Thu, Jan 26, 2023 at 09:48:17AM -0800, Boris Burkov wrote:
> Add a new test which checks that size classes in freshly loaded block
> groups after a cycle mount match size classes before going down
> 
> Depends on the kernel patch:
> btrfs: add size class stats to sysfs
> 
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
> Changelog:
> v3:
> Re-add fixed_by_kernel_commit, but for the stats patch which is
> required, but not a fix in the strictest sense.
> 
> v2:
> Drop the fixed_by_kernel_commit since the fix is not out past the btrfs
> development tree, so the fix is getting rolled in to the original broken
> commit. Modified the commit message to note the dependency on the new
> sysfs counters.
> 
>  tests/btrfs/283     | 50 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/283.out |  2 ++
>  2 files changed, 52 insertions(+)
>  create mode 100755 tests/btrfs/283
>  create mode 100644 tests/btrfs/283.out
> 
> diff --git a/tests/btrfs/283 b/tests/btrfs/283
> new file mode 100755
> index 00000000..d250a389
> --- /dev/null
> +++ b/tests/btrfs/283
> @@ -0,0 +1,50 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Meta Platforms, Inc.  All Rights Reserved.
> +#
> +# FS QA Test 283
> +#
> +# Test that mounting a btrfs filesystem properly loads block group size classes.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick mount
> +fixed_by_kernel_commit xxxxxxxx "btrfs: add size class stats to sysfs".

    +/root/git/xfstests/tests/btrfs/283: line 11: fixed_by_kernel_commit: command not found

It's "_fixed_by_kernel_commit", you missed the "_" prefix.

> +
> +sysfs_size_classes() {
> +	local uuid="$(findmnt -n -o UUID "$SCRATCH_MNT")"
> +	cat "/sys/fs/btrfs/$uuid/allocation/data/size_classes"

I hit below error:
    +cat: /sys/fs/btrfs/7df0dfa8-b1cd-4646-bd30-8683bbf0a4f1/allocation/data/size_classes: No such file or directory
    +cat: /sys/fs/btrfs/7df0dfa8-b1cd-4646-bd30-8683bbf0a4f1/allocation/data/size_classes: No such file or directory

I think btrfs not always support the "allocation/data/size_classes" file. So
we need to check if current kernel supports that, and _notrun if not. The
_require_fs_sysfs might help you a bit.

Thanks,
Zorro

> +}
> +
> +_supported_fs btrfs
> +_require_scratch
> +_require_btrfs_fs_sysfs
> +
> +f="$SCRATCH_MNT/f"
> +small=$((16 * 1024))
> +medium=$((1024 * 1024))
> +large=$((16 * 1024 * 1024))
> +
> +_scratch_mkfs >/dev/null
> +_scratch_mount
> +# Write files with extents in each size class
> +$XFS_IO_PROG -fc "pwrite -q 0 $small" $f.small
> +$XFS_IO_PROG -fc "pwrite -q 0 $medium" $f.medium
> +$XFS_IO_PROG -fc "pwrite -q 0 $large" $f.large
> +# Sync to force the extent allocation
> +sync
> +pre=$(sysfs_size_classes)
> +
> +# cycle mount to drop the block group cache
> +_scratch_cycle_mount
> +
> +# Another write causes us to actually load the block groups
> +$XFS_IO_PROG -fc "pwrite -q 0 $large" $f.large.2
> +sync
> +
> +post=$(sysfs_size_classes)
> +diff <(echo $pre) <(echo $post)
> +
> +echo "Silence is golden"
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/283.out b/tests/btrfs/283.out
> new file mode 100644
> index 00000000..efb2c583
> --- /dev/null
> +++ b/tests/btrfs/283.out
> @@ -0,0 +1,2 @@
> +QA output created by 283
> +Silence is golden
> -- 
> 2.39.1
> 


      reply	other threads:[~2023-01-30  4:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 17:48 [PATCH v3] btrfs: test block group size class loading logic Boris Burkov
2023-01-30  4:49 ` Zorro Lang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230130044925.jv23enewzb5xpdrl@zlang-mailbox \
    --to=zlang@redhat.com \
    --cc=boris@bur.io \
    --cc=fstests@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.