Whamcloud - gitweb
LU-5975 quota: remove obsolete quota code
[fs/lustre-release.git] / lustre / utils / lfs.c
index bfffbd9..50d42b5 100644 (file)
@@ -86,9 +86,6 @@ static int lfs_df(int argc, char **argv);
 static int lfs_getname(int argc, char **argv);
 static int lfs_check(int argc, char **argv);
 #ifdef HAVE_SYS_QUOTA_H
-static int lfs_quotacheck(int argc, char **argv);
-static int lfs_quotaon(int argc, char **argv);
-static int lfs_quotaoff(int argc, char **argv);
 static int lfs_setquota(int argc, char **argv);
 static int lfs_quota(int argc, char **argv);
 #endif
@@ -249,16 +246,6 @@ command_t cmdlist[] = {
          "[for specified path only]\n"
          "Usage: getname [-h]|[path ...] "},
 #ifdef HAVE_SYS_QUOTA_H
-        {"quotacheck", lfs_quotacheck, 0,
-         "Scan the specified filesystem for disk usage, and create,\n"
-         "or update quota files. Deprecated as of 2.4.0.\n"
-         "usage: quotacheck [ -ug ] <filesystem>"},
-        {"quotaon", lfs_quotaon, 0, "Turn filesystem"
-         " quotas on. Deprecated as of 2.4.0.\n"
-         "usage: quotaon [ -ugf ] <filesystem>"},
-        {"quotaoff", lfs_quotaoff, 0, "Turn filesystem"
-         " quotas off. Deprecated as of 2.4.0.\n"
-         "usage: quotaoff [ -ug ] <filesystem>"},
         {"setquota", lfs_setquota, 0, "Set filesystem quotas.\n"
          "usage: setquota <-u|-g> <uname>|<uid>|<gname>|<gid>\n"
          "                -b <block-softlimit> -B <block-hardlimit>\n"
@@ -2224,206 +2211,6 @@ static int lfs_join(int argc, char **argv)
 }
 
 #ifdef HAVE_SYS_QUOTA_H
-static int lfs_quotacheck(int argc, char **argv)
-{
-        int c, check_type = 0;
-        char *mnt;
-        struct if_quotacheck qchk;
-        struct if_quotactl qctl;
-        char *obd_type = (char *)qchk.obd_type;
-        int rc;
-
-        memset(&qchk, 0, sizeof(qchk));
-
-        while ((c = getopt(argc, argv, "gu")) != -1) {
-                switch (c) {
-                case 'u':
-                        check_type |= 0x01;
-                        break;
-                case 'g':
-                        check_type |= 0x02;
-                        break;
-                default:
-                        fprintf(stderr, "error: %s: option '-%c' "
-                                        "unrecognized\n", argv[0], c);
-                        return CMD_HELP;
-                }
-        }
-
-        if (check_type)
-                check_type--;
-        else    /* do quotacheck for both user & group quota by default */
-                check_type = 0x02;
-
-        if (argc == optind)
-                return CMD_HELP;
-
-        mnt = argv[optind];
-
-        rc = llapi_quotacheck(mnt, check_type);
-       if (rc == -EOPNOTSUPP) {
-               fprintf(stderr, "error: quotacheck not supported by the quota "
-                       "master.\nPlease note that quotacheck is deprecated as "
-                       "of lustre 2.4.0 since space accounting is always "
-                       "enabled.\nFilesystems not formatted with 2.4 utils or "
-                       "beyond can be upgraded with tunefs.lustre --quota.\n");
-               return rc;
-       } else if (rc) {
-                fprintf(stderr, "quotacheck failed: %s\n", strerror(-rc));
-                return rc;
-        }
-
-        rc = llapi_poll_quotacheck(mnt, &qchk);
-        if (rc) {
-                if (*obd_type)
-                        fprintf(stderr, "%s %s ", obd_type,
-                                obd_uuid2str(&qchk.obd_uuid));
-                fprintf(stderr, "quota check failed: %s\n", strerror(-rc));
-                return rc;
-        }
-
-        memset(&qctl, 0, sizeof(qctl));
-        qctl.qc_cmd = LUSTRE_Q_QUOTAON;
-        qctl.qc_type = check_type;
-        rc = llapi_quotactl(mnt, &qctl);
-        if (rc && rc != -EALREADY) {
-                if (*obd_type)
-                        fprintf(stderr, "%s %s ", (char *)qctl.obd_type,
-                                obd_uuid2str(&qctl.obd_uuid));
-                fprintf(stderr, "%s turn on quota failed: %s\n",
-                        argv[0], strerror(-rc));
-                return rc;
-        }
-
-        return 0;
-}
-
-static int lfs_quotaon(int argc, char **argv)
-{
-        int c;
-        char *mnt;
-        struct if_quotactl qctl;
-        char *obd_type = (char *)qctl.obd_type;
-        int rc;
-
-        memset(&qctl, 0, sizeof(qctl));
-        qctl.qc_cmd = LUSTRE_Q_QUOTAON;
-
-        while ((c = getopt(argc, argv, "fgu")) != -1) {
-                switch (c) {
-                case 'u':
-                        qctl.qc_type |= 0x01;
-                        break;
-                case 'g':
-                        qctl.qc_type |= 0x02;
-                        break;
-                case 'f':
-                        qctl.qc_cmd = LUSTRE_Q_QUOTAOFF;
-                        break;
-                default:
-                        fprintf(stderr, "error: %s: option '-%c' "
-                                        "unrecognized\n", argv[0], c);
-                        return CMD_HELP;
-                }
-        }
-
-        if (qctl.qc_type)
-                qctl.qc_type--;
-        else /* by default, enable quota for both user & group */
-                qctl.qc_type = 0x02;
-
-        if (argc == optind)
-                return CMD_HELP;
-
-        mnt = argv[optind];
-
-        rc = llapi_quotactl(mnt, &qctl);
-        if (rc) {
-                if (rc == -EOPNOTSUPP) {
-                        fprintf(stderr, "error: quotaon not supported by the "
-                                "quota master.\nPlease note that quotaon/off is"
-                                " deprecated as of lustre 2.4.0.\nQuota "
-                                "enforcement should now be enabled on the MGS "
-                                "via:\nmgs# lctl conf_param ${FSNAME}.quota."
-                                "<ost|mdt>=<u|g|ug>\n(ost for block quota, mdt "
-                                "for inode quota, u for user and g for group"
-                                "\n");
-                } else if (rc == -EALREADY) {
-                        rc = 0;
-                } else if (rc == -ENOENT) {
-                        fprintf(stderr, "error: cannot find quota database, "
-                                        "make sure you have run quotacheck\n");
-                } else {
-                        if (*obd_type)
-                                fprintf(stderr, "%s %s ", obd_type,
-                                        obd_uuid2str(&qctl.obd_uuid));
-                        fprintf(stderr, "%s failed: %s\n", argv[0],
-                                strerror(-rc));
-                }
-        }
-
-        return rc;
-}
-
-static int lfs_quotaoff(int argc, char **argv)
-{
-        int c;
-        char *mnt;
-        struct if_quotactl qctl;
-        char *obd_type = (char *)qctl.obd_type;
-        int rc;
-
-        memset(&qctl, 0, sizeof(qctl));
-        qctl.qc_cmd = LUSTRE_Q_QUOTAOFF;
-
-        while ((c = getopt(argc, argv, "gu")) != -1) {
-                switch (c) {
-                case 'u':
-                        qctl.qc_type |= 0x01;
-                        break;
-                case 'g':
-                        qctl.qc_type |= 0x02;
-                        break;
-                default:
-                        fprintf(stderr, "error: %s: option '-%c' "
-                                        "unrecognized\n", argv[0], c);
-                        return CMD_HELP;
-                }
-        }
-
-        if (qctl.qc_type)
-                qctl.qc_type--;
-        else /* by default, disable quota for both user & group */
-                qctl.qc_type = 0x02;
-
-        if (argc == optind)
-                return CMD_HELP;
-
-        mnt = argv[optind];
-
-        rc = llapi_quotactl(mnt, &qctl);
-        if (rc) {
-                if (rc == -EOPNOTSUPP) {
-                        fprintf(stderr, "error: quotaoff not supported by the "
-                                "quota master.\nPlease note that quotaon/off is"
-                                " deprecated as of lustre 2.4.0.\nQuota "
-                                "enforcement can be disabled on the MGS via:\n"
-                                "mgs# lctl conf_param ${FSNAME}.quota.<ost|mdt>"
-                                "=\"\"\n");
-                } else if (rc == -EALREADY) {
-                        rc = 0;
-                } else {
-                        if (*obd_type)
-                                fprintf(stderr, "%s %s ", obd_type,
-                                        obd_uuid2str(&qctl.obd_uuid));
-                        fprintf(stderr, "quotaoff failed: %s\n",
-                                strerror(-rc));
-                }
-        }
-
-        return rc;
-}
-
 #define ARG2INT(nr, str, msg)                                           \
 do {                                                                    \
         char *endp;                                                     \