From: Anand Jain <anand.jain@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
eguan@redhat.com, fdmanana@gmail.com
Subject: Re: [PATCH v6 1/3] xfstests: btrfs: add functions to create dm-error device
Date: Tue, 25 Aug 2015 12:40:50 +0800 [thread overview]
Message-ID: <55DBF1D2.2020708@oracle.com> (raw)
In-Reply-To: <20150820214511.GP3902@dastard>
Dave,
On 08/21/2015 05:45 AM, Dave Chinner wrote:
> On Thu, Aug 20, 2015 at 03:09:05PM +0800, Anand Jain wrote:
>>
>> (thanks for the off-ML emails from the people who helped me
>> to understand).
>>
>> Dave,
>>
>> looks like you are suggesting something like..
>>
>> -------
>> +_dmerror_mount_options()
>> +{
>> + _scratch_options mount
>> + echo $SCRATCH_OPTIONS $MOUNT_OPTIONS $SELINUX_MOUNT_OPTIONS \
>> + $* $DMERROR_DEV $SCRATCH_MNT
>> +}
>> +
>> +_dmerror_mount()
>> +{
>> + _mount -t $FSTYP `_dmerror_mount_options $*`
>> +}
>> --------
>
> Very close. :)
>
> You've got the structure right, but missed one more thing: the
> options are still cut'n'paste from _scratch_mount_options, and so
> should be /factored/ into a common function...
>
> _scratch_options is only useful to XFS to set external log/realtime
> devices, and we don't want to do that for the dmerror device.
> Everthing else is almost the same as _scratch_mount_options(),
> however. So:
>
> # Used for mounting non-scratch devices (e.g. loop, dm constructs)
> # with the safe set of scratch mount options (e.g. loop image may be
> # hosted on $SCRATCH_DEV, so can't use external scratch devices).
> _common_dev_mount_options()
> {
> echo $MOUNT_OPTIONS $SELINUX_MOUNT_OPTIONS $*
> }
>
> _scratch_mount_options()
> {
> _scratch_options mount
>
> echo `_common_dev_mount_options $*` $SCRATCH_OPTIONS \
> $SCRATCH_DEV $SCRATCH_MNT
>
> }
> _dmerror_mount_options()
> {
> echo `_common_dev_mount_options $*` $DMERROR_DEV $SCRATCH_MNT
> }
this would make test cases nice and sleek. Thanks. I have this in v8.
> And to demonstrate why factoring like this is useful, this can also
> be applied to _mount_flakey(), and we could also replace most of the
> open-coded loop device mounts with a generic "mount device" function
> like:
yes indeed. I suggest if these could be handled in a separate patch
as this would deviate from the intentions of this patch set ?
Thanks, Anand
> _mount_dev()
> {
> _mount `_common_dev_mount_options $*`
> }
>
> and call it like:
>
> _mount_dev $LOOP_DEV $MNT_POINT
>
> or even
>
> _mount_dev -o loop $MNT_POINT
>
> We can then take it further: if we have a _mount_dev() wrapper we
> can factor _common_dev_mount_options() from all the
> _*_mount_options() functions. i.e:
>
> _scratch_mount_options()
> {
> _scratch_options mount
>
> echo $SCRATCH_OPTIONS $SCRATCH_DEV $SCRATCH_MNT
> }
>
> _scratch_mount()
> {
> _mount_dev $* `_scratch_mount_options`
> }
>
> The result is we end up with a much cleaner set of mount functions
> that are more generic, more extensible and easier to use, as well as
> being more maintainable....
>
>> Sorry that the word 'should mirror _scratch_mount()' confused me.
>
> Ok, I'll try to be more clear in future.
>
> Cheers,
>
> Dave.
>
next prev parent reply other threads:[~2015-08-25 4:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-14 10:47 [PATCH v5 0/3] dm error based test cases Anand Jain
2015-08-14 10:47 ` [PATCH v5 1/3] xfstests: btrfs: add functions to create dm-error device Anand Jain
2015-08-14 11:03 ` Eryu Guan
2015-08-14 10:47 ` [PATCH v5 2/3] xfstests: btrfs: test device replace, with EIO on the src dev Anand Jain
2015-08-14 11:07 ` Eryu Guan
2015-08-14 11:14 ` Filipe David Manana
2015-08-14 10:47 ` [PATCH v5 3/3] xfstests: btrfs: test device delete with EIO on " Anand Jain
2015-08-14 11:09 ` Eryu Guan
2015-08-14 15:31 ` [PATCH v6 0/3] dm error based test cases Anand Jain
2015-08-14 15:31 ` [PATCH v6 1/3] xfstests: btrfs: add functions to create dm-error device Anand Jain
2015-08-16 23:52 ` Dave Chinner
2015-08-18 4:26 ` anand jain
2015-08-18 22:11 ` Dave Chinner
2015-08-19 3:16 ` anand jain
2015-08-19 6:45 ` Dave Chinner
2015-08-20 7:09 ` Anand Jain
2015-08-20 21:45 ` Dave Chinner
2015-08-25 4:40 ` Anand Jain [this message]
2015-08-14 15:31 ` [PATCH v6 2/3] xfstests: btrfs: test device replace, with EIO on the src dev Anand Jain
2015-08-14 15:31 ` [PATCH v6 3/3] xfstests: btrfs: test device delete with EIO on " Anand Jain
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=55DBF1D2.2020708@oracle.com \
--to=anand.jain@oracle.com \
--cc=david@fromorbit.com \
--cc=eguan@redhat.com \
--cc=fdmanana@gmail.com \
--cc=fstests@vger.kernel.org \
--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.