common/quota: adapt _require_prjquota() for f2fs
authorChao Yu <yuchao0@huawei.com>
Sun, 30 Sep 2018 09:26:53 +0000 (17:26 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 6 Oct 2018 09:36:59 +0000 (17:36 +0800)
In _require_prjquota(), let's check project quota support as below
for f2fs:

- For image support, check 'project_quota' on enabled feature list
  of specified device.
- For kernel support, check /sys/fs/f2fs/features/project_quota
  sysfs entry status.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/quota

index 0ea1922b7c1f458e7a6d634b7b5bc16a0b30f861..993ff5de90ea6e9d3fef35d1f2d73b1c671af863 100644 (file)
@@ -77,6 +77,13 @@ _require_prjquota()
        dumpe2fs -h $_dev 2>&1 | grep -qw project || \
                _notrun "Project quota not available on this $FSTYP"
     fi
+    if [ "$FSTYP" == "f2fs" ]; then
+       dump.f2fs $_dev 2>&1 | grep -qw project_quota
+       [ $? -ne 0 ] && _notrun "Project quota not enabled in this device $_dev"
+       cat /sys/fs/f2fs/features/project_quota | grep -qw supported
+       [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
+       return
+    fi
     src/feature -P $_dev
     [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
     if [ "$USE_EXTERNAL" = yes -a ! -z "$_dev" ]; then