Whamcloud - gitweb
b=1028 drop SOM dependency on quota
authorVitaly Fertman <Vitaly.Fertman@Sun.COM>
Thu, 11 Feb 2010 20:39:36 +0000 (12:39 -0800)
committerRobert Read <rread@sun.com>
Thu, 11 Feb 2010 20:39:36 +0000 (12:39 -0800)
once SOM attributes are moved to EA, there is no need to disabled quota when SOM is enabled

i=fanyong
i=tappro

lustre/include/lustre/lustre_user.h
lustre/include/lustre_quota.h
lustre/mdt/mdt_lproc.c
lustre/osd/osd_handler.c
lustre/quota/lproc_quota.c
lustre/quota/quota_master.c
lustre/tests/sanity-quota.sh
lustre/tests/test-framework.sh

index 03a4423..8948c7f 100644 (file)
@@ -342,8 +342,6 @@ typedef struct lu_fid lustre_fid;
 #define LUSTRE_Q_FINVALIDATE 0x80000c     /* invalidate filter quota data */
 
 #define UGQUOTA 2       /* set both USRQUOTA and GRPQUOTA */
 #define LUSTRE_Q_FINVALIDATE 0x80000c     /* invalidate filter quota data */
 
 #define UGQUOTA 2       /* set both USRQUOTA and GRPQUOTA */
-#define IMMQUOTA 0x4    /* set immutable quota flag, cannot be turned on/off
-                         * on-fly. temporary used by SOM */
 
 struct if_quotacheck {
         char                    obd_type[16];
 
 struct if_quotacheck {
         char                    obd_type[16];
index a271ebf..03db1da 100644 (file)
@@ -264,16 +264,12 @@ struct lustre_quota_ctxt {
                                          * 0:Off, 1:On
                                          */
                       lqc_valid:1,      /** this qctxt is valid or not */
                                          * 0:Off, 1:On
                                          */
                       lqc_valid:1,      /** this qctxt is valid or not */
-                      lqc_setup:1,      /**
+                      lqc_setup:1;      /**
                                          * tell whether of not quota_type has
                                          * been processed, so that the master
                                          * knows when it can start processing
                                          * incoming acq/rel quota requests
                                          */
                                          * tell whether of not quota_type has
                                          * been processed, so that the master
                                          * knows when it can start processing
                                          * incoming acq/rel quota requests
                                          */
-                      lqc_immutable:1;  /**
-                                         * cannot be turned on/off on-fly;
-                                         * temporary used by SOM.
-                                         */
         /** }@ */
         /**
          * original unit size of file quota and
         /** }@ */
         /**
          * original unit size of file quota and
index 34553d1..cb8ff1f 100644 (file)
@@ -688,26 +688,6 @@ static int lprocfs_rd_mdt_som(char *page, char **start, off_t off,
                         mdt->mdt_som_conf ? "en" : "dis");
 }
 
                         mdt->mdt_som_conf ? "en" : "dis");
 }
 
-#ifdef HAVE_QUOTA_SUPPORT
-static int mdt_quota_off(struct mdt_device *mdt)
-{
-        struct md_device *next = mdt->mdt_child;
-        const struct md_quota_operations *mqo = &next->md_ops->mdo_quota;
-        struct lu_env env;
-        int rc;
-
-        lu_env_init(&env, LCT_MD_THREAD);
-        rc = mqo->mqo_off(&env, next, UGQUOTA | IMMQUOTA);
-        lu_env_fini(&env);
-        return rc;
-}
-#else
-static int mdt_quota_off(struct mdt_device *mdt)
-{
-        return 0;
-}
-#endif
-
 static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
                               unsigned long count, void *data)
 {
 static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
                               unsigned long count, void *data)
 {
@@ -716,7 +696,6 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
         struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
         char kernbuf[16];
         unsigned long val = 0;
         struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
         char kernbuf[16];
         unsigned long val = 0;
-        int rc;
 
         if (count > (sizeof(kernbuf) - 1))
                 return -EINVAL;
 
         if (count > (sizeof(kernbuf) - 1))
                 return -EINVAL;
@@ -753,13 +732,6 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
                 return count;
         }
 
                 return count;
         }
 
-        if ((rc = mdt_quota_off(mdt))) {
-                if (rc == -EALREADY)
-                        rc = 0;
-                else
-                        return rc;
-        }
-
         mdt->mdt_som_conf = val;
         LCONSOLE_INFO("Enabling SOM\n");
 
         mdt->mdt_som_conf = val;
         LCONSOLE_INFO("Enabling SOM\n");
 
index 18b9539..302923c 100644 (file)
@@ -1287,13 +1287,12 @@ static int osd_inode_setattr(const struct lu_env *env,
                 i_size_write(inode, attr->la_size);
         }
 
                 i_size_write(inode, attr->la_size);
         }
 
+#if 0
         /* OSD should not change "i_blocks" which is used by quota.
         /* OSD should not change "i_blocks" which is used by quota.
-         * "i_blocks" should be changed by ldiskfs only.
-         * Enable this assignment for SOM purpose now, until it is
-         * stored in SOM EA. */
+         * "i_blocks" should be changed by ldiskfs only. */
         if (bits & LA_BLOCKS)
                 inode->i_blocks = attr->la_blocks;
         if (bits & LA_BLOCKS)
                 inode->i_blocks = attr->la_blocks;
-
+#endif
         if (bits & LA_MODE)
                 inode->i_mode   = (inode->i_mode & S_IFMT) |
                         (attr->la_mode & ~S_IFMT);
         if (bits & LA_MODE)
                 inode->i_mode   = (inode->i_mode & S_IFMT) |
                         (attr->la_mode & ~S_IFMT);
index 6ac0bc2..d911365 100644 (file)
@@ -225,12 +225,6 @@ static int auto_quota_on(struct obd_device *obd, int type,
         if ((obt->obt_qctxt.lqc_flags & id) == id)
                 GOTO(out, rc);
 
         if ((obt->obt_qctxt.lqc_flags & id) == id)
                 GOTO(out, rc);
 
-        if (obt->obt_qctxt.lqc_immutable) {
-                LCONSOLE_ERROR("Failed to turn Quota on, immutable mode "
-                               "(is SOM enabled?)\n");
-                GOTO(out, rc = -ECANCELED);
-        }
-
         oqctl->qc_type = type;
         oqctl->qc_cmd = Q_QUOTAON;
         oqctl->qc_id = obt->obt_qfmt;
         oqctl->qc_type = type;
         oqctl->qc_cmd = Q_QUOTAON;
         oqctl->qc_id = obt->obt_qfmt;
index 180e4cd..cc90f76 100644 (file)
@@ -852,13 +852,6 @@ int mds_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
                 RETURN(-EINVAL);
 
         cfs_down(&obt->obt_quotachecking);
                 RETURN(-EINVAL);
 
         cfs_down(&obt->obt_quotachecking);
-        if (obt->obt_qctxt.lqc_immutable) {
-                LCONSOLE_ERROR("Failed to turn Quota on, immutable mode "
-                               "(is SOM enabled?)\n");
-                cfs_up(&obt->obt_quotachecking);
-                RETURN(-ECANCELED);
-        }
-
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         cfs_down(&mds->mds_qonoff_sem);
         rc2 = mds_admin_quota_on(obd, oqctl);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         cfs_down(&mds->mds_qonoff_sem);
         rc2 = mds_admin_quota_on(obd, oqctl);
@@ -916,14 +909,11 @@ int do_mds_quota_off(struct obd_device *obd, struct obd_quotactl *oqctl)
         struct obd_device_target *obt = &obd->u.obt;
         struct lustre_quota_ctxt *qctxt = &obt->obt_qctxt;
         struct lvfs_run_ctxt saved;
         struct obd_device_target *obt = &obd->u.obt;
         struct lustre_quota_ctxt *qctxt = &obt->obt_qctxt;
         struct lvfs_run_ctxt saved;
-        int rc = 0, rc1 = 0, rc2 = 0, imm;
+        int rc = 0, rc1 = 0, rc2 = 0;
         ENTRY;
 
         LASSERT_SEM_LOCKED(&obt->obt_quotachecking);
 
         ENTRY;
 
         LASSERT_SEM_LOCKED(&obt->obt_quotachecking);
 
-        imm = oqctl->qc_type & IMMQUOTA;
-        oqctl->qc_type &= ~IMMQUOTA;
-
         if (oqctl->qc_type != USRQUOTA &&
             oqctl->qc_type != GRPQUOTA &&
             oqctl->qc_type != UGQUOTA)
         if (oqctl->qc_type != USRQUOTA &&
             oqctl->qc_type != GRPQUOTA &&
             oqctl->qc_type != UGQUOTA)
@@ -940,8 +930,6 @@ int do_mds_quota_off(struct obd_device *obd, struct obd_quotactl *oqctl)
 
         rc1 = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
         if (!rc1) {
 
         rc1 = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
         if (!rc1) {
-                if (imm)
-                        obt->obt_qctxt.lqc_immutable = 1;
                 obt->obt_qctxt.lqc_flags &= ~UGQUOTA2LQC(oqctl->qc_type);
         } else if (quota_is_off(qctxt, oqctl)) {
                 CWARN("mds local quota[%d] is off already\n", oqctl->qc_type);
                 obt->obt_qctxt.lqc_flags &= ~UGQUOTA2LQC(oqctl->qc_type);
         } else if (quota_is_off(qctxt, oqctl)) {
                 CWARN("mds local quota[%d] is off already\n", oqctl->qc_type);
@@ -966,8 +954,6 @@ int do_mds_quota_off(struct obd_device *obd, struct obd_quotactl *oqctl)
                         mds_admin_quota_on(obd, oqctl);
                 if (rc1 != -EALREADY) {
                         fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
                         mds_admin_quota_on(obd, oqctl);
                 if (rc1 != -EALREADY) {
                         fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
-                        if (imm)
-                                obt->obt_qctxt.lqc_immutable = 0;
                         qctxt->lqc_flags |= UGQUOTA2LQC(oqctl->qc_type);
                 }
                 oqctl->qc_cmd = Q_QUOTAOFF;
                         qctxt->lqc_flags |= UGQUOTA2LQC(oqctl->qc_type);
                 }
                 oqctl->qc_cmd = Q_QUOTAOFF;
index b3abd20..589bc6a 100644 (file)
@@ -70,13 +70,6 @@ export QUOTA_AUTO=0
 
 check_and_setup_lustre
 
 
 check_and_setup_lustre
 
-if [ x"$(som_check)" = x"enabled" ]; then
-        echo "Som is enabled, Quota is temporary conflicts with it"
-        check_and_cleanup_lustre
-        export QUOTA_AUTO=$QUOTA_AUTO_OLD
-        exit 0
-fi
-
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
 
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
 
index cf13aed..1f4a50c 100644 (file)
@@ -1875,11 +1875,6 @@ osc_ensure_active () {
     [ $period -lt $timeout ] || log "$count OST are inactive after $timeout seconds, give up"
 }
 
     [ $period -lt $timeout ] || log "$count OST are inactive after $timeout seconds, give up"
 }
 
-som_check() {
-    SOM_ENABLED=$(do_facet $SINGLEMDS "$LCTL get_param mdt.*.som" | awk -F= ' {print $2}' | head -n 1)
-    echo $SOM_ENABLED
-}
-
 init_param_vars () {
     if ! remote_ost_nodsh && ! remote_mds_nodsh; then
         export MDSVER=$(do_facet $SINGLEMDS "lctl get_param version" | cut -d. -f1,2)
 init_param_vars () {
     if ! remote_ost_nodsh && ! remote_mds_nodsh; then
         export MDSVER=$(do_facet $SINGLEMDS "lctl get_param version" | cut -d. -f1,2)
@@ -1895,10 +1890,6 @@ init_param_vars () {
     osc_ensure_active $SINGLEMDS M $TIMEOUT
     osc_ensure_active client c $TIMEOUT
 
     osc_ensure_active $SINGLEMDS M $TIMEOUT
     osc_ensure_active client c $TIMEOUT
 
-    if [ x"$(som_check)" = x"enabled" ]; then
-        ENABLE_QUOTA=""
-        echo "disable quota temporary when SOM enabled"
-    fi
     if [ $QUOTA_AUTO -ne 0 ]; then
         if [ "$ENABLE_QUOTA" ]; then
             echo "enable quota as required"
     if [ $QUOTA_AUTO -ne 0 ]; then
         if [ "$ENABLE_QUOTA" ]; then
             echo "enable quota as required"