linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <guan@eryu.me>
To: Anand Jain <anand.jain@oracle.com>
Cc: Nikolay Borisov <nborisov@suse.com>,
	fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
	josef@toxicpanda.com, guaneryu@gmail.com
Subject: Re: [PATCH v2] fstests: btrfs test if show_devname returns sprout device
Date: Sun, 19 Jul 2020 23:19:28 +0800	[thread overview]
Message-ID: <20200719151928.GB2557159@desktop> (raw)
In-Reply-To: <c334d1b4-5d68-f1ce-44b2-2c7501760f53@oracle.com>

On Mon, Jul 13, 2020 at 07:32:57PM +0800, Anand Jain wrote:
> 
> 
> 
> > > +# check if the show_devname() returns the sprout device instead of seed device.
> > > +cat /proc/self/mounts | grep $SCRATCH_MNT | awk '{print $1}' | \
> > > +							_filter_devs $sprout
> > 
> > Why does this have to be so complicated - 4 chained program executions,
> > 1 additional function...
> > 
> 
> For example:
>  /dev/sdb /btrfs btrfs ro,relatime,noacl,space_cache,subvolid=5,subvol=/ 0 0
> 
>  $1 to $3 remain constant, but $4 options might vary. So to avoid
>  unnecessary breakage of test case due to kernel updates or mount
>  options, I just used $1.
> 
> > dev=$(grep $SCRATCH_MOUNT /proc/mounts | awk '{printf $1}')

This looks simpler, just use $AWK_PROG instead of bare awk.

> > 
> > if [ $sprout != $dev ]; then
> >   _fail "Unexpected device"
> > fi
>  fstests prefers use of .out file to look for the expected string.
>  Will wait for Eryu comments.

Even $dev is not constant, we don't have to filter the device to
"SCRATCH_DEV" by _filter_devs. Just do

echo "Silence is golden"
if [ "$sprout" != "$dev" ]; then
	echo "Unexpected device: $dev"
fi

Thanks,
Eryu

  reply	other threads:[~2020-07-19 15:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  6:37 [PATCH] btrfs_show_devname don't traverse into the seed fsid Anand Jain
2020-07-10 14:32 ` Josef Bacik
2020-07-10 15:16   ` Anand Jain
2020-07-10 15:54 ` Martin K. Petersen
2020-07-13  5:48 ` [PATCH] fstests: btrfs test if show_devname returns sprout device Anand Jain
2020-07-13  7:03   ` Nikolay Borisov
2020-07-13 11:00     ` [PATCH v2] " Anand Jain
2020-07-13 11:15       ` Nikolay Borisov
2020-07-13 11:32         ` Anand Jain
2020-07-19 15:19           ` Eryu Guan [this message]
2020-07-20  3:55             ` [PATCH v3] " Anand Jain
2020-07-13 14:04 ` [PATCH] btrfs_show_devname don't traverse into the seed fsid Nikolay Borisov
2020-07-15 10:21 ` David Sterba

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=20200719151928.GB2557159@desktop \
    --to=guan@eryu.me \
    --cc=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).