From aa78c1445c96480e6c6c244fb638c05b9ac3093d Mon Sep 17 00:00:00 2001
From: anserper <anserper>
Date: Wed, 15 Oct 2008 22:40:59 +0000
Subject: [PATCH] Branch b1_6 b=17302 i=Johann Lombardi i=ZhiYong Tian

pass QFMT through qc_id to be compatible with older Lustre versions
---
 lustre/include/lustre/lustre_user.h | 2 ++
 lustre/utils/lfs.c                  | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h
index 5c1d4d865f..8061f04f1b 100644
--- a/lustre/include/lustre/lustre_user.h
+++ b/lustre/include/lustre/lustre_user.h
@@ -270,6 +270,8 @@ struct mds_grp_downcall_data {
 
 #endif /* !__KERNEL__ */
 
+#define QFMT_LDISKFS 2 /* pre-1.6.6 compatibility */
+
 typedef enum lustre_quota_version {
         LUSTRE_QUOTA_V1 = 0,
         LUSTRE_QUOTA_V2 = 1
diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c
index 5594382cad..b1c6790f0c 100644
--- a/lustre/utils/lfs.c
+++ b/lustre/utils/lfs.c
@@ -1234,7 +1234,6 @@ static int lfs_quotachown(int argc, char **argv)
         return rc;
 }
 
-
 static int lfs_quotacheck(int argc, char **argv)
 {
         int c, check_type = 0;
@@ -1275,6 +1274,8 @@ static int lfs_quotacheck(int argc, char **argv)
         memset(&qctl, 0, sizeof(qctl));
         qctl.qc_cmd = LUSTRE_Q_QUOTAOFF;
         qctl.qc_type = check_type;
+        qctl.qc_id = QFMT_LDISKFS; /* compatibility: 1.6.5 and earliers
+                                    * take this parameter into account */
         rc = llapi_quotactl(mnt, &qctl);
         if (rc) {
                 fprintf(stderr, "quota off failed: %s\n", strerror(errno));
@@ -1299,6 +1300,8 @@ static int lfs_quotacheck(int argc, char **argv)
         memset(&qctl, 0, sizeof(qctl));
         qctl.qc_cmd = LUSTRE_Q_QUOTAON;
         qctl.qc_type = check_type;
+        qctl.qc_id = QFMT_LDISKFS; /* compatibility: 1.6.5 and earliers
+                                    * take this parameter into account */
         rc = llapi_quotactl(mnt, &qctl);
         if (rc) {
                 if (*obd_type)
@@ -1322,6 +1325,8 @@ static int lfs_quotaon(int argc, char **argv)
 
         memset(&qctl, 0, sizeof(qctl));
         qctl.qc_cmd = LUSTRE_Q_QUOTAON;
+        qctl.qc_id = QFMT_LDISKFS; /* compatibility: 1.6.5 and earliers
+                                    * take this parameter into account */
 
         optind = 0;
         while ((c = getopt(argc, argv, "ugf")) != -1) {
-- 
GitLab