fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Allison Henderson <allison.henderson@oracle.com>
Cc: Chandan Babu R <chandanrlinux@gmail.com>,
	fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH V6 03/13] common/xfs: Add helper to obtain fsxattr field value
Date: Wed, 10 Mar 2021 11:54:03 -0800	[thread overview]
Message-ID: <20210310195403.GE3419940@magnolia> (raw)
In-Reply-To: <148ab249-be7a-2686-7995-a256e34f292a@oracle.com>

On Tue, Mar 09, 2021 at 11:13:17PM -0700, Allison Henderson wrote:
> 
> 
> On 3/8/21 10:01 PM, Chandan Babu R wrote:
> > This commit adds a helper function to obtain the value of a particular field
> > of an inode's fsxattr fields.
> > 
> > Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
> > ---
> >   common/xfs | 9 +++++++++
> >   1 file changed, 9 insertions(+)
> > 
> > diff --git a/common/xfs b/common/xfs
> > index 26ae21b9..130b3232 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -194,6 +194,15 @@ _xfs_get_file_block_size()
> >   	$XFS_INFO_PROG "$path" | grep realtime | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g'
> >   }
> > +_xfs_get_fsxattr()
> > +{
> > +	local field="$1"
> > +	local path="$2"
> > +
> > +	local value=$($XFS_IO_PROG -c "stat" "$path" | grep "$field")
> > +	echo ${value##fsxattr.${field} = }
> > +}
> > +
> In fiddling with the commands here, I think I may have noticed a bug.  I
> think you want to grep whole words only, or you may mistakenly match sub
> words. Example:
> 
> root@garnet:/home/achender/work_area# field="extsize "
> root@garnet:/home/achender/work_area# xfs_io -c "stat" /mnt/scratch/test |
> grep "$field"
> fsxattr.extsize = 0
> fsxattr.cowextsize = 0
> 
> I think if you add the -w to the grep that fixes it:
> root@garnet:/home/achender/work_area# xfs_io -c "stat" /mnt/scratch/test |
> grep -w "$field"

Hey, that's a neat trick I didn't know about!

Oooh and it even exists in both busybox /and/ gnu grep! :)

/me madly goes digging through his shell scripts

<and that was the last we heard from djwong>

--D

> fsxattr.extsize = 0
> 
> I think that's what you meant to do right?
> 
> Allison
> 
> >   # xfs_check script is planned to be deprecated. But, we want to
> >   # be able to invoke "xfs_check" behavior in xfstests in order to
> >   # maintain the current verification levels.
> > 
> 

  reply	other threads:[~2021-03-10 19:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  5:01 [PATCH V6 00/13] xfs: Tests to verify inode fork extent count overflow detection Chandan Babu R
2021-03-09  5:01 ` [PATCH V6 01/13] _check_xfs_filesystem: sync fs before running scrub Chandan Babu R
2021-03-09  5:03   ` Darrick J. Wong
2021-03-10  6:12   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 02/13] common/xfs: Add a helper to get an inode fork's extent count Chandan Babu R
2021-03-09  5:04   ` Darrick J. Wong
2021-03-10  6:12   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 03/13] common/xfs: Add helper to obtain fsxattr field value Chandan Babu R
2021-03-09  5:04   ` Darrick J. Wong
2021-03-10  6:13   ` Allison Henderson
2021-03-10 19:54     ` Darrick J. Wong [this message]
2021-03-11  2:54     ` Chandan Babu R
2021-03-11  8:52   ` [PATCH V6.1] " Chandan Babu R
2021-03-11 18:36     ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 04/13] xfs: Check for extent overflow when trivally adding a new extent Chandan Babu R
2021-03-10 19:54   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 05/13] xfs: Check for extent overflow when growing realtime bitmap/summary inodes Chandan Babu R
2021-03-10 19:55   ` Allison Henderson
2021-03-22 17:56   ` Darrick J. Wong
2021-03-23 15:51     ` Chandan Babu R
2021-03-23 20:57       ` Darrick J. Wong
2021-03-24 10:46         ` Chandan Babu R
2021-03-24 14:17           ` Chandan Babu R
2021-03-09  5:01 ` [PATCH V6 06/13] xfs: Check for extent overflow when punching a hole Chandan Babu R
2021-03-10 19:55   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 07/13] xfs: Check for extent overflow when adding/removing xattrs Chandan Babu R
2021-03-10 19:55   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 08/13] xfs: Check for extent overflow when adding/removing dir entries Chandan Babu R
2021-03-10 22:41   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 09/13] xfs: Check for extent overflow when writing to unwritten extent Chandan Babu R
2021-03-10 22:41   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 10/13] xfs: Check for extent overflow when moving extent from cow to data fork Chandan Babu R
2021-03-10 22:41   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 11/13] xfs: Check for extent overflow when remapping an extent Chandan Babu R
2021-03-10 23:49   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 12/13] xfs: Check for extent overflow when swapping extents Chandan Babu R
2021-03-10 23:49   ` Allison Henderson
2021-03-09  5:01 ` [PATCH V6 13/13] xfs: Stress test with bmap_alloc_minlen_extent error tag enabled Chandan Babu R
2021-03-10 23:49   ` Allison Henderson
2021-03-22 18:54   ` Darrick J. Wong
2021-03-23  5:28     ` Chandan Babu R
2021-03-23 11:27       ` Chandan Babu R
2021-03-26  4:05       ` Chandan Babu R
2021-03-26  4:21         ` Darrick J. Wong
2021-04-15  9:33     ` Chandan Babu R
2021-04-17  0:26       ` Darrick J. Wong

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=20210310195403.GE3419940@magnolia \
    --to=djwong@kernel.org \
    --cc=allison.henderson@oracle.com \
    --cc=chandanrlinux@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@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 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).