Whamcloud - gitweb
LU-1214 quota: don't compile quota module for client
authorLiu Xuezhao <xuezhao.liu@emc.com>
Wed, 4 Apr 2012 06:01:53 +0000 (14:01 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 22 May 2012 14:20:50 +0000 (10:20 -0400)
1. Only and always compile lquota module for server, and needs not
   compile quota library for liblustre.
2. HAVE_QUOTA_SUPPORT macro is no more needed in quota source files
3. Removes several un-used function declarations in quota_internal.h

Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Change-Id: Ibf94ba6f37b43721cc53c2d7bde017b039581bbd
Reviewed-on: http://review.whamcloud.com/2363
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
18 files changed:
lustre/Makefile.in
lustre/autoMakefile.am
lustre/autoconf/lustre-core.m4
lustre/liblustre/Makefile.am
lustre/liblustre/genlib.sh
lustre/lvfs/Makefile.in
lustre/mdd/mdd_dir.c
lustre/mdd/mdd_object.c
lustre/quota/autoMakefile.am
lustre/quota/lproc_quota.c
lustre/quota/quota_adjust_qunit.c
lustre/quota/quota_check.c
lustre/quota/quota_context.c
lustre/quota/quota_ctl.c
lustre/quota/quota_interface.c
lustre/quota/quota_internal.h
lustre/quota/quota_master.c
lustre/tests/test-framework.sh

index 04441db..7e4fe64 100644 (file)
@@ -6,9 +6,8 @@ subdir-m += ptlrpc
 subdir-m += osc
 subdir-m += obdecho
 subdir-m += mgc
-subdir-m += quota
 
-@SERVER_TRUE@subdir-m += mds obdfilter ost mgs mdt cmm mdd osd-ldiskfs
+@SERVER_TRUE@subdir-m += mds obdfilter ost mgs mdt cmm mdd osd-ldiskfs quota
 @CLIENT_TRUE@subdir-m += mdc lmv llite fld
 
 @INCLUDE_RULES@
index 7559ef2..f542f3e 100644 (file)
@@ -42,12 +42,10 @@ AUTOMAKE_OPTIONS = foreign
 ALWAYS_SUBDIRS := include lvfs obdclass ldlm ptlrpc osc lov obdecho \
        mgc fid fld doc utils tests scripts autoconf contrib conf
 
-SERVER_SUBDIRS := obdfilter ost mds mgs mdt cmm mdd osd-ldiskfs
+SERVER_SUBDIRS := obdfilter ost mds mgs mdt cmm mdd osd-ldiskfs quota
 
 CLIENT_SUBDIRS := mdc lmv llite lclient
 
-QUOTA_SUBDIRS := quota
-
 LIBLUSTRE_SUBDIRS := liblustre
 
 SUBDIRS := $(ALWAYS_SUBDIRS)
@@ -60,8 +58,6 @@ if CLIENT
 SUBDIRS += $(CLIENT_SUBDIRS)
 endif
 
-SUBDIRS += $(QUOTA_SUBDIRS)
-
 # this needs to be after the client subdirs
 if LIBLUSTRE
 if !CLIENT
@@ -71,7 +67,7 @@ SUBDIRS += $(LIBLUSTRE_SUBDIRS)
 endif
 
 DIST_SUBDIRS := $(ALWAYS_SUBDIRS) $(SERVER_SUBDIRS) $(CLIENT_SUBDIRS)  \
-       $(LIBLUSTRE_SUBDIRS) $(QUOTA_SUBDIRS)
+       $(LIBLUSTRE_SUBDIRS)
 
 EXTRA_DIST = BUGS FDL kernel_patches BUILDING
 
index 0ac3957..a63a2fc 100644 (file)
@@ -209,17 +209,13 @@ if test x$enable_lru_resize != xno; then
 fi
 ])
 
-# whether to enable quota support(kernel modules)
-AC_DEFUN([LC_QUOTA_MODULE],
-[if test x$enable_quota != xno; then
-    LB_LINUX_CONFIG([QUOTA],[
-       enable_quota_module='yes'
-       AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
-    ],[
-       enable_quota_module='no'
-       AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
-    ])
-fi
+#
+# Quota support. The kernel must support CONFIG_QUOTA.
+#
+AC_DEFUN([LC_QUOTA_CONFIG],
+[LB_LINUX_CONFIG_IM([QUOTA],[AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [support quota])],[
+       AC_MSG_ERROR([Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])
+])
 ])
 
 # truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
@@ -1983,7 +1979,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_CONFIG_LIBLUSTRE_RECOVERY
          LC_CONFIG_HEALTH_CHECK_WRITE
          LC_CONFIG_LRU_RESIZE
-         LC_QUOTA_MODULE
          LC_LLITE_LLOOP_MODULE
 
          # RHEL4 patches
@@ -2137,6 +2132,7 @@ AC_DEFUN([LC_PROG_LINUX],
              LC_FUNC_DEV_SET_RDONLY
              LC_STACK_SIZE
              LC_QUOTA64
+             LC_QUOTA_CONFIG
          fi
 ])
 
@@ -2529,7 +2525,6 @@ 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)
 AM_CONDITIONAL(SPLIT, test x$enable_split = 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)
index edf3126..9b6d69b 100644 (file)
@@ -22,10 +22,6 @@ LUSTRE_LIBS = libllite.a \
               $(top_builddir)/lustre/obdclass/liblustreclass.a \
               $(top_builddir)/lustre/lvfs/liblvfs.a
 
-if LIBLUSTRE
-QUOTA_LIBS = $(top_builddir)/lustre/quota/libquota.a
-endif
-
 LND_LIBS =
 if BUILD_USOCKLND
 LND_LIBS +=    $(top_builddir)/lnet/ulnds/socklnd/libsocklnd.a
@@ -66,8 +62,8 @@ libllite_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \
 liblustre_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \
                     llite_lib.h llite_cl.c
 
-liblustre.a : $(LUSTRE_LIBS) $(LND_LIBS) $(LNET_LIBS) $(SYSIO_LIBS) $(QUOTA_LIBS)
-       sh $(srcdir)/genlib.sh "$(SYSIO)" "$(LIBS)" "$(LND_LIBS)" "$(PTHREAD_LIBS)" "$(QUOTA_LIBS)" "$(CAP_LIBS)" "$(ZLIB)"
+liblustre.a : $(LUSTRE_LIBS) $(LND_LIBS) $(LNET_LIBS) $(SYSIO_LIBS)
+       sh $(srcdir)/genlib.sh "$(SYSIO)" "$(LIBS)" "$(LND_LIBS)" "$(PTHREAD_LIBS)" "$(CAP_LIBS)" "$(ZLIB)"
 
 EXTRA_DIST = genlib.sh
 
index dcfb67d..5059892 100755 (executable)
@@ -27,9 +27,8 @@ SYSIO=$1
 LIBS=$2
 LND_LIBS=$3
 PTHREAD_LIBS=$4
-QUOTA_LIBS=$5
-CAP_LIBS=$6
-ZLIB=$7
+CAP_LIBS=$5
+ZLIB=$6
 
 if [ ! -f $SYSIO/lib/libsysio.a ]; then
   echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist"
@@ -90,10 +89,6 @@ if $(echo "$LND_LIBS" | grep "ptllnd" >/dev/null) ; then
 fi
 build_obj_list ../../lnet/lnet liblnet.a
 
-if [ "x$QUOTA_LIBS" != "x" ]; then
-  build_obj_list ../quota libquota.a
-fi
-
 # create static lib lsupport
 rm -f $CWD/liblsupport.a
 $AR -cru $CWD/liblsupport.a $ALL_OBJS
index da9ed6d..f1f5c2f 100644 (file)
@@ -1,13 +1,13 @@
 MODULES := lvfs
 @SERVER_TRUE@MODULES += fsfilt_ldiskfs
-@QUOTA_TRUE@MODULES += quotafmt_test
+@SERVER_TRUE@MODULES += quotafmt_test
 
 lvfs-objs := lvfs_common.o lvfs_linux.o fsfilt.o lvfs_lib.o
 
-@QUOTA_TRUE@quotafmt-objs := quotafmt_test.o
+@SERVER_TRUE@quotafmt-objs := quotafmt_test.o
 
 fsfilt_ldiskfs-objs := fsfilt-ldiskfs.o
-@QUOTA_TRUE@fsfilt_ldiskfs-objs += lustre_quota_fmt.o
+@SERVER_TRUE@fsfilt_ldiskfs-objs += lustre_quota_fmt.o
 
 $(obj)/fsfilt-%.c: $(obj)/fsfilt_%.c
        ln -s $< $@
index 125fe1f..0a08826 100644 (file)
@@ -1135,11 +1135,11 @@ static int mdd_name_insert(const struct lu_env *env,
         const char *name = lname->ln_name;
         struct lu_attr   *la = &mdd_env_info(env)->mti_la_for_fix;
         struct mdd_object *mdd_obj = md2mdd_obj(pobj);
-        struct mdd_device *mdd = mdo2mdd(pobj);
         struct dynlock_handle *dlh;
         struct thandle *handle;
         int is_dir = S_ISDIR(ma->ma_attr.la_mode);
 #ifdef HAVE_QUOTA_SUPPORT
+        struct mdd_device *mdd = mdo2mdd(pobj);
         struct md_ucred *uc = md_ucred(env);
         struct obd_device *obd = mdd->mdd_obd_dev;
         struct obd_export *exp = md_quota(env)->mq_exp;
index 2108ea3..cb86461 100644 (file)
@@ -1641,9 +1641,9 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
         struct llog_cookie *logcookies = NULL;
         int  rc, lmm_size = 0, cookie_size = 0;
         struct lu_attr *la_copy = &mdd_env_info(env)->mti_la_for_fix;
+#ifdef HAVE_QUOTA_SUPPORT
         struct obd_device *obd = mdd->mdd_obd_dev;
         struct mds_obd *mds = &obd->u.mds;
-#ifdef HAVE_QUOTA_SUPPORT
         unsigned int qnids[MAXQUOTAS] = { 0, 0 };
         unsigned int qoids[MAXQUOTAS] = { 0, 0 };
         int quota_opc = 0, block_count = 0;
index df2ec8b..61517fd 100644 (file)
 # Lustre is a trademark of Sun Microsystems, Inc.
 #
 
-if LIBLUSTRE
-noinst_LIBRARIES = libquota.a
-libquota_a_SOURCES = quota_check.c quota_ctl.c quota_interface.c quota_adjust_qunit.c
-libquota_a_CPPFLAGS = $(LLCPPFLAGS)
-libquota_a_CFLAGS = $(LLCFLAGS)
-endif
-
-if QUOTA
 modulefs_DATA = lquota$(KMODEXT)
-endif
 
 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
index 42fc7b8..d2319e0 100644 (file)
@@ -44,8 +44,6 @@
 
 #include "quota_internal.h"
 
-#ifdef HAVE_QUOTA_SUPPORT
-
 #ifdef LPROCFS
 int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count,
                            int *eof, void *data)
@@ -681,4 +679,3 @@ int lquota_proc_cleanup(struct lustre_quota_ctxt *qctxt)
 }
 
 #endif  /* LPROCFS */
-#endif
index 303ca61..05d2a95 100644 (file)
@@ -62,8 +62,6 @@
 #include <linux/lustre_quota.h>
 #include "quota_internal.h"
 
-#ifdef HAVE_QUOTA_SUPPORT
-
 #ifdef __KERNEL__
 /**
  * This function is charge of recording lqs_ino_rec and
@@ -284,4 +282,3 @@ int filter_quota_adjust_qunit(struct obd_export *exp,
         RETURN(rc);
 }
 #endif /* __KERNEL__ */
-#endif
index dc288f9..5bf0047 100644 (file)
@@ -64,7 +64,6 @@
 #include <lustre_quota.h>
 #include "quota_internal.h"
 
-#ifdef HAVE_QUOTA_SUPPORT
 #ifdef __KERNEL__
 static int target_quotacheck_callback(struct obd_export *exp,
                                       struct obd_quotactl *oqctl)
@@ -196,4 +195,3 @@ out:
 }
 
 #endif /* __KERNEL__ */
-#endif /* HAVE_QUOTA_SUPPORT */
index 015fa1b..e53929a 100644 (file)
@@ -64,8 +64,6 @@ static int hash_lqs_cur_bits = HASH_LQS_CUR_BITS;
 CFS_MODULE_PARM(hash_lqs_cur_bits, "i", int, 0444,
                 "the current bits of lqs hash");
 
-#ifdef HAVE_QUOTA_SUPPORT
-
 static cfs_hash_ops_t lqs_hash_ops;
 
 unsigned long default_bunit_sz = 128 * 1024 * 1024; /* 128M bytes */
@@ -1646,4 +1644,3 @@ static cfs_hash_ops_t lqs_hash_ops = {
         .hs_put_locked  = lqs_put_locked,
         .hs_exit        = lqs_exit
 };
-#endif /* HAVE_QUOTA_SUPPORT */
index 88b99fe..2ea126e 100644 (file)
@@ -62,7 +62,6 @@
 #include <lustre_quota.h>
 #include "quota_internal.h"
 
-#ifdef HAVE_QUOTA_SUPPORT
 #ifdef __KERNEL__
 
 int mds_quota_ctl(struct obd_device *obd, struct obd_export *unused,
@@ -289,4 +288,3 @@ adjust:
         RETURN(rc);
 }
 #endif /* __KERNEL__ */
-#endif
index 7240a25..c82e280 100644 (file)
@@ -65,8 +65,6 @@
 
 #ifdef __KERNEL__
 
-#ifdef HAVE_QUOTA_SUPPORT
-
 static cfs_time_t last_print = 0;
 static cfs_spinlock_t last_print_lock = CFS_SPIN_LOCK_UNLOCKED;
 
@@ -727,11 +725,6 @@ static int quota_acquire_common(struct obd_device *obd, const unsigned int id[],
         RETURN(rc);
 }
 
-#endif /* HAVE_QUOTA_SUPPORT */
-#endif /* __KERNEL__ */
-
-#ifdef __KERNEL__
-#ifdef HAVE_QUOTA_SUPPORT
 quota_interface_t mds_quota_interface = {
         .quota_init     = mds_quota_init,
         .quota_exit     = mds_quota_exit,
@@ -763,16 +756,11 @@ quota_interface_t filter_quota_interface = {
         .quota_adjust_qunit   = filter_quota_adjust_qunit,
         .quota_pending_commit = quota_pending_commit,
 };
-#endif
-#endif /* __KERNEL__ */
-
-#ifdef __KERNEL__
 
 cfs_proc_dir_entry_t *lquota_type_proc_dir = NULL;
 
 static int __init init_lustre_quota(void)
 {
-#ifdef HAVE_QUOTA_SUPPORT
         int rc = 0;
 
         lquota_type_proc_dir = lprocfs_register(OBD_LQUOTA_DEVICENAME,
@@ -790,13 +778,12 @@ static int __init init_lustre_quota(void)
 
         PORTAL_SYMBOL_REGISTER(filter_quota_interface);
         PORTAL_SYMBOL_REGISTER(mds_quota_interface);
-#endif
+
         return 0;
 }
 
 static void /*__exit*/ exit_lustre_quota(void)
 {
-#ifdef HAVE_QUOTA_SUPPORT
         PORTAL_SYMBOL_UNREGISTER(filter_quota_interface);
         PORTAL_SYMBOL_UNREGISTER(mds_quota_interface);
 
@@ -804,7 +791,6 @@ static void /*__exit*/ exit_lustre_quota(void)
 
         if (lquota_type_proc_dir)
                 lprocfs_remove(&lquota_type_proc_dir);
-#endif
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
@@ -813,8 +799,6 @@ MODULE_LICENSE("GPL");
 
 cfs_module(lquota, "1.0.0", init_lustre_quota, exit_lustre_quota);
 
-#ifdef HAVE_QUOTA_SUPPORT
 EXPORT_SYMBOL(mds_quota_interface);
 EXPORT_SYMBOL(filter_quota_interface);
-#endif
 #endif /* __KERNEL */
index b5e4b9d..002300e 100644 (file)
@@ -37,8 +37,6 @@
 
 #include <lustre_quota.h>
 
-#ifdef HAVE_QUOTA_SUPPORT
-
 /* QUSG covnert bytes to blocks when counting block quota */
 #define QUSG(count, isblk)      (isblk ? toqb(count) : count)
 
@@ -192,27 +190,3 @@ extern cfs_proc_dir_entry_t *lquota_type_proc_dir;
 #define QUOTA_REQ_RETURNED 1
 
 #endif
-int client_quota_adjust_qunit(struct obd_export *exp,
-                              struct quota_adjust_qunit *oqaq,
-                              struct lustre_quota_ctxt *qctxt,
-                              struct ptlrpc_request_set *set);
-
-int lov_quota_adjust_qunit(struct obd_export *exp,
-                           struct quota_adjust_qunit *oqaq,
-                           struct lustre_quota_ctxt *qctxt,
-                           struct ptlrpc_request_set *rqset);
-int client_quota_ctl(struct obd_device *unused, struct obd_export *exp,
-                     struct obd_quotactl *oqctl);
-int lmv_quota_ctl(struct obd_device *unused, struct obd_export *exp,
-                  struct obd_quotactl *oqctl);
-int lov_quota_ctl(struct obd_device *unused, struct obd_export *exp,
-                  struct obd_quotactl *oqctl);
-int client_quota_check(struct obd_device *unused, struct obd_export *exp,
-                       struct obd_quotactl *oqctl);
-int lmv_quota_check(struct obd_device *unused, struct obd_export *exp,
-                    struct obd_quotactl *oqctl);
-int lov_quota_check(struct obd_device *unused, struct obd_export *exp,
-                    struct obd_quotactl *oqctl);
-int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk);
-
-#endif
index 7f42508..d493a1d 100644 (file)
@@ -62,8 +62,6 @@
 
 #include "quota_internal.h"
 
-#ifdef HAVE_QUOTA_SUPPORT
-
 /* lock ordering: mds->mds_qonoff_sem > dquot->dq_mutex > lqs->lqs_lock */
 static cfs_list_t lustre_dquot_hash[NR_DQHASH];
 static cfs_rwlock_t dquot_hash_lock = CFS_RW_LOCK_UNLOCKED;
@@ -1770,5 +1768,3 @@ int mds_quota_recovery(struct obd_device *obd)
         cfs_wait_for_completion(&data.comp);
         RETURN(rc);
 }
-
-#endif /* HAVE_QUOTA_SUPPORT */
index 9f90481..06224f7 100644 (file)
@@ -377,7 +377,6 @@ load_modules_local() {
     load_module obdclass/obdclass
     load_module ptlrpc/ptlrpc
     load_module ptlrpc/gss/ptlrpc_gss
-    [ "$USE_QUOTA" = "yes" -a "$LQUOTA" != "no" ] && load_module quota/lquota $LQUOTAOPTS
     load_module fld/fld
     load_module fid/fid
     load_module lmv/lmv
@@ -395,6 +394,7 @@ load_modules_local() {
                 { modprobe exportfs 2> /dev/null || true; }
             load_module ../ldiskfs/ldiskfs/ldiskfs
         fi
+        [ "$USE_QUOTA" = "yes" -a "$LQUOTA" != "no" ] && load_module quota/lquota $LQUOTAOPTS
         load_module mgs/mgs
         load_module mds/mds
         load_module mdd/mdd