Message ID | 20160914015527.10274-2-quwenruo@cn.fujitsu.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On Wed, Sep 14, 2016 at 09:55:22AM +0800, Qu Wenruo wrote: > Introduce _post_mount_hook(), which will be executed after mounting > scratch/test. > > It's quite useful for fs(OK, only btrfs yet, again) which needs to > use ioctl other than mount option to enable some of its feature. Just implement a _btrfs_mount() function (similar to _overlay_mount()) to do btrfs specific things at mount time. > Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> > --- > common/rc | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/common/rc b/common/rc > index 23c007a..631397f 100644 > --- a/common/rc > +++ b/common/rc > @@ -321,6 +321,27 @@ _overlay_scratch_unmount() > $UMOUNT_PROG $SCRATCH_MNT > } > > +_run_btrfs_post_mount_hook() > +{ > + mnt_point=$1 > + for n in $ALWAYS_ENABLE_BTRFS_FEATURE; do What's this magic, undefined, undocumented variable? Cheers, Dave.
At 09/15/2016 12:24 PM, Dave Chinner wrote: > On Wed, Sep 14, 2016 at 09:55:22AM +0800, Qu Wenruo wrote: >> Introduce _post_mount_hook(), which will be executed after mounting >> scratch/test. >> >> It's quite useful for fs(OK, only btrfs yet, again) which needs to >> use ioctl other than mount option to enable some of its feature. > > Just implement a _btrfs_mount() function (similar to > _overlay_mount()) to do btrfs specific things at mount time. >> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> >> --- >> common/rc | 23 +++++++++++++++++++++++ >> 1 file changed, 23 insertions(+) >> >> diff --git a/common/rc b/common/rc >> index 23c007a..631397f 100644 >> --- a/common/rc >> +++ b/common/rc >> @@ -321,6 +321,27 @@ _overlay_scratch_unmount() >> $UMOUNT_PROG $SCRATCH_MNT >> } >> >> +_run_btrfs_post_mount_hook() >> +{ >> + mnt_point=$1 >> + for n in $ALWAYS_ENABLE_BTRFS_FEATURE; do > > What's this magic, undefined, undocumented variable? Yes this reminds me. The biggest problem is, where is the document of all these variables? common/config and config/examples all lacks variables like TIME_FACTOR/LOAD_FACTOR. Or it's the time to doc them all? Thanks, Qu > > Cheers, > > Dave. > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/common/rc b/common/rc index 23c007a..631397f 100644 --- a/common/rc +++ b/common/rc @@ -321,6 +321,27 @@ _overlay_scratch_unmount() $UMOUNT_PROG $SCRATCH_MNT } +_run_btrfs_post_mount_hook() +{ + mnt_point=$1 + for n in $ALWAYS_ENABLE_BTRFS_FEATURE; do + if [ $n == "quota" -o $n == "qgroup" ]; then + # Quota can be enabled for several times + # and won't cause bug + _run_btrfs_util_prog quota enable $mnt_point + fi + done +} + +_post_mount_hook() +{ + mnt_point=$1 + + if [ $FSTYP == "btrfs" -a -v ALWAYS_ENABLE_BTRFS_FEATURE ]; then + _run_btrfs_post_mount_hook $mnt_point + fi +} + _scratch_mount() { if [ "$FSTYP" == "overlay" ]; then @@ -328,6 +349,7 @@ _scratch_mount() return $? fi _mount -t $FSTYP `_scratch_mount_options $*` + _post_mount_hook $SCRATCH_MNT } _scratch_unmount() @@ -377,6 +399,7 @@ _test_mount() fi _test_options mount _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR + _post_mount_hook $TEST_DIR } _test_unmount()
Introduce _post_mount_hook(), which will be executed after mounting scratch/test. It's quite useful for fs(OK, only btrfs yet, again) which needs to use ioctl other than mount option to enable some of its feature. Now only btrfs quota needs this hook to allow enabling quota to be enabled for *ALL* existing test cases. This should dramatically improve the test coverage to expose quota related bugs. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- common/rc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)