From dda5b7abcce1d8ed3de2abdad104d12a28cbc4c3 Mon Sep 17 00:00:00 2001
From: tianzy <tianzy>
Date: Wed, 8 Oct 2008 12:21:40 +0000
Subject: [PATCH] Branch b1_6 fix compiling error when CONFIG_QUOTA isn't set.
 b=16481 i=shadow i=panda

---
 lustre/autoMakefile.am         | 7 +++----
 lustre/autoconf/lustre-core.m4 | 3 ++-
 lustre/include/lustre_quota.h  | 6 ++++++
 lustre/liblustre/Makefile.am   | 2 +-
 lustre/mds/mds_lov.c           | 4 +---
 lustre/quota/autoMakefile.am   | 2 +-
 lustre/quota/quota_context.c   | 2 +-
 7 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/lustre/autoMakefile.am b/lustre/autoMakefile.am
index 866c1fc943..8db3ee06e6 100644
--- a/lustre/autoMakefile.am
+++ b/lustre/autoMakefile.am
@@ -58,12 +58,11 @@ if CLIENT
 SUBDIRS += $(CLIENT_SUBDIRS)
 endif
 
-if QUOTA
-SUBDIRS += $(QUOTA_SUBDIRS)
-endif
-
 # this needs to be after the client subdirs
 if LIBLUSTRE
+if QUOTA_LIBLUSTRE
+SUBDIRS += $(QUOTA_SUBDIRS)
+endif
 if !CLIENT
 SUBDIRS += $(CLIENT_SUBDIRS)
 endif
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 1559db3dd5..aa85fdfdd8 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -1756,7 +1756,8 @@ AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
-AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes -o x$enable_quota_liblustre = xyes)
+AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
+AM_CONDITIONAL(QUOTA_LIBLUSTRE, test x$enable_quota_liblustre = xyes)
 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h
index b8f24c17f9..97e93b813f 100644
--- a/lustre/include/lustre_quota.h
+++ b/lustre/include/lustre_quota.h
@@ -276,6 +276,9 @@ struct lustre_quota_ctxt {
         struct lprocfs_stats  *lqc_stats; /* lquota statistics */
 };
 
+#define QUOTA_MASTER_READY(qctxt)   (qctxt)->lqc_setup = 1
+#define QUOTA_MASTER_UNREADY(qctxt) (qctxt)->lqc_setup = 0
+
 struct lustre_qunit_size {
         struct hlist_node lqs_hash; /* the hash entry */
         unsigned int lqs_id;        /* id of user/group */
@@ -359,6 +362,9 @@ struct lustre_quota_info {
 struct lustre_quota_ctxt {
 };
 
+#define QUOTA_MASTER_READY(qctxt)
+#define QUOTA_MASTER_UNREADY(qctxt)
+
 #endif /* !HAVE_QUOTA_SUPPORT */
 
 /* If the (quota limit < qunit * slave count), the slave which can't
diff --git a/lustre/liblustre/Makefile.am b/lustre/liblustre/Makefile.am
index cf60902e3e..2a0f0e93b9 100644
--- a/lustre/liblustre/Makefile.am
+++ b/lustre/liblustre/Makefile.am
@@ -19,7 +19,7 @@ LUSTRE_LIBS = libllite.a \
               $(top_builddir)/lustre/obdclass/liblustreclass.a \
               $(top_builddir)/lustre/lvfs/liblvfs.a
 
-if QUOTA
+if QUOTA_LIBLUSTRE
 QUOTA_LIBS = $(top_builddir)/lustre/quota/libquota.a
 endif
 
diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c
index 815da94877..a77af7b523 100644
--- a/lustre/mds/mds_lov.c
+++ b/lustre/mds/mds_lov.c
@@ -1055,11 +1055,9 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
         case OBD_NOTIFY_CONFIG:
                 mds_allow_cli(obd, (unsigned long)data);
 
-#ifdef HAVE_QUOTA_SUPPORT
                 /* quota_type has been processed, we can now handle
                  * incoming quota requests */
-                obd->u.obt.obt_qctxt.lqc_setup = 1;
-#endif
+                QUOTA_MASTER_READY(&obd->u.obt.obt_qctxt);
         default:
                 RETURN(0);
         }
diff --git a/lustre/quota/autoMakefile.am b/lustre/quota/autoMakefile.am
index 66f7a0b067..9b83135158 100644
--- a/lustre/quota/autoMakefile.am
+++ b/lustre/quota/autoMakefile.am
@@ -41,7 +41,7 @@ libquota_a_CPPFLAGS = $(LLCPPFLAGS)
 libquota_a_CFLAGS = $(LLCFLAGS)
 endif
 
-if MODULES
+if QUOTA
 modulefs_DATA = lquota$(KMODEXT)
 endif
 
diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c
index bd22456e33..75d476246e 100644
--- a/lustre/quota/quota_context.c
+++ b/lustre/quota/quota_context.c
@@ -1136,7 +1136,7 @@ qctxt_init(struct obd_device *obd, dqacq_handler_t handler)
         qctxt->lqc_cqs_least_iunit = 2;
         qctxt->lqc_cqs_qs_factor = 2;
         qctxt->lqc_flags = 0;
-        qctxt->lqc_setup = 0;
+        QUOTA_MASTER_UNREADY(qctxt);
         qctxt->lqc_bunit_sz = default_bunit_sz;
         qctxt->lqc_btune_sz = default_bunit_sz / 100 * default_btune_ratio;
         qctxt->lqc_iunit_sz = default_iunit_sz;
-- 
GitLab