linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hou Tao <houtao1@huawei.com>
To: Eryu Guan <eguan@redhat.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>
Cc: fstests@vger.kernel.org, guaneryu@gmail.com,
	linux-xfs@vger.kernel.org, cmaiolino@redhat.com
Subject: Re: [PATCH v2 4/4] common/rc: factor out _get|set_xfs_scratch_sb_field()
Date: Thu, 9 Nov 2017 12:30:12 +0800	[thread overview]
Message-ID: <103f2a85-8acb-39c5-eea3-387d69e15593@huawei.com> (raw)
In-Reply-To: <20171109035325.GR17339@eguan.usersys.redhat.com>

Hi,

On 2017/11/9 11:53, Eryu Guan wrote:
> On Wed, Nov 08, 2017 at 08:49:08AM -0800, Darrick J. Wong wrote:
>> On Wed, Nov 08, 2017 at 04:02:50PM +0800, Hou Tao wrote:
>>> It's common to get and set the values of fields in XFS super block,
>>> so factor them out as _get|set_xfs_scratch_sb_field() and update the
>>> related test cases accordingly.
>>>
>>> Signed-off-by: Hou Tao <houtao1@huawei.com>
>>> ---
>>>  common/xfs    | 20 ++++++++++++++++++++
>>>  tests/xfs/007 |  6 ++----
>>>  tests/xfs/098 |  4 ++--
>>>  tests/xfs/186 |  3 +--
>>>  tests/xfs/199 | 13 ++++---------
>>>  tests/xfs/307 | 11 ++---------
>>>  tests/xfs/308 | 11 ++---------
>>>  tests/xfs/339 |  6 +++---
>>>  tests/xfs/340 |  2 +-
>>>  tests/xfs/999 |  8 --------
>>>  10 files changed, 37 insertions(+), 47 deletions(-)
>>>
>>> diff --git a/common/xfs b/common/xfs
>>> index d4fef94..82ddc24 100644
>>> --- a/common/xfs
>>> +++ b/common/xfs
>>> @@ -599,3 +599,23 @@ _require_no_xfs_debug()
>>>  		_notrun "Require XFS built without CONFIG_XFS_DEBUG"
>>>  	fi
>>>  }
>>> +
>>> +_get_xfs_scratch_sb_field()
>>> +{
>>> +	local field=$1
>>> +
>>> +	shift
>>> +
>>> +	_scratch_xfs_db -r -c 'sb 0' "$@" -c "print $field" | \
>>> +	awk -v field=$field '$0 ~ field {print $3}'
>>> +}
>>> +
>>> +_set_xfs_scratch_sb_field()
>>> +{
>>> +	local field=$1
>>> +	local value=$2
>>> +
>>> +	shift 2
>>> +
>>> +	_scratch_xfs_db -x -c 'sb 0' "$@" -c "write $field -- $value"
>>> +}
>>
>> FWIW we already have _scratch_xfs_[gs]et_metadata_field in common/fuzzy.
> 
> Ah, thanks for the reminder! I forgot about them.. Tao, are the existing
> helpers in common/fuzzy something you can use? And perhaps we should
> move them to common/xfs then.

Yes, _scratch_xfs_[gs]et_metadata_field can be used to implement _get|set_xfs_scratch_sb_field().
So we can move _scratch_xfs_[gs]et_metadata_field to common/xfs and implement wrappers for getting
and setting fields of XFS super block.

Regards,
Tao

> Thanks,
> Eryu
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


  reply	other threads:[~2017-11-09  4:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  8:02 [PATCH v2 0/4] test for XFS umount hang caused by the pending dquota log item in AIL Hou Tao
2017-11-08  8:02 ` [PATCH v2 1/4] dmflakey: support multiple dm targets for a dm-flakey device Hou Tao
2017-11-08  8:02 ` [PATCH v2 2/4] common/rc: support checking the version of dm-target in _require_dm_target() Hou Tao
2017-11-08  9:49   ` Eryu Guan
2017-11-08 13:39     ` Hou Tao
2017-11-08  8:02 ` [PATCH v2 3/4] xfs: test for umount hang caused by the pending dquota log item in AIL Hou Tao
2017-11-08  9:56   ` Eryu Guan
2017-11-08 13:37     ` Hou Tao
2017-11-08  8:02 ` [PATCH v2 4/4] common/rc: factor out _get|set_xfs_scratch_sb_field() Hou Tao
2017-11-08 16:49   ` Darrick J. Wong
2017-11-09  3:53     ` Eryu Guan
2017-11-09  4:30       ` Hou Tao [this message]
2017-11-08  9:20 ` [PATCH v2 0/4] test for XFS umount hang caused by the pending dquota log item in AIL Eryu Guan

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=103f2a85-8acb-39c5-eea3-387d69e15593@huawei.com \
    --to=houtao1@huawei.com \
    --cc=cmaiolino@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --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).