Whamcloud - gitweb
Branch HEAD
authortianzy <tianzy>
Tue, 6 Jan 2009 04:23:41 +0000 (04:23 +0000)
committertianzy <tianzy>
Tue, 6 Jan 2009 04:23:41 +0000 (04:23 +0000)
Additional patch for HEAD
b=16542
i=yong.fan

lustre/include/dt_object.h
lustre/include/lustre_quota.h
lustre/mdd/mdd_dir.c
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_object.c
lustre/obdfilter/filter_io_26.c
lustre/osd/osd_handler.c
lustre/quota/quota_interface.c
lustre/tests/sanity-quota.sh

index 536273d..4d33e83 100644 (file)
@@ -371,6 +371,13 @@ struct dt_object_operations {
                                         struct lustre_capa *old,
                                         __u64 opc);
         int (*do_object_sync)(const struct lu_env *, struct dt_object *);
                                         struct lustre_capa *old,
                                         __u64 opc);
         int (*do_object_sync)(const struct lu_env *, struct dt_object *);
+        /**
+         * Get object info of next level. Currently, only get inode from osd.
+         * This is only used by quota b=16542
+         * precondition: dt_object_exists(dt);
+         */
+        int (*do_data_get)(const struct lu_env *env, struct dt_object *dt,
+                           void **data);
 };
 
 /**
 };
 
 /**
index 9dd419c..1823fec 100644 (file)
@@ -754,7 +754,7 @@ static inline int lquota_chkquota(quota_interface_t *interface,
                                   struct obd_device *obd,
                                   unsigned int uid, unsigned int gid, int count,
                                   int *flag, struct obd_trans_info *oti,
                                   struct obd_device *obd,
                                   unsigned int uid, unsigned int gid, int count,
                                   int *flag, struct obd_trans_info *oti,
-                                  int isblk, struct inode *inode, int frags)
+                                  int isblk, void *data, int frags)
 {
         int rc;
         ENTRY;
 {
         int rc;
         ENTRY;
@@ -763,7 +763,7 @@ static inline int lquota_chkquota(quota_interface_t *interface,
         QUOTA_CHECK_OP(interface, acquire);
         rc = QUOTA_OP(interface, chkquota)(obd, uid, gid, count, flag,
                                            QUOTA_OP(interface, acquire), oti,
         QUOTA_CHECK_OP(interface, acquire);
         rc = QUOTA_OP(interface, chkquota)(obd, uid, gid, count, flag,
                                            QUOTA_OP(interface, acquire), oti,
-                                           isblk, inode, frags);
+                                           isblk, (struct inode *)data, frags);
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
index d3edabc..03a9e86 100644 (file)
@@ -675,13 +675,15 @@ static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj,
 
                 rc = mdd_la_get(env, mdd_tobj, la_tmp, BYPASS_CAPA);
                 if (!rc) {
 
                 rc = mdd_la_get(env, mdd_tobj, la_tmp, BYPASS_CAPA);
                 if (!rc) {
+                        void *data = NULL;
+                        mdd_data_get(env, mdd_tobj, &data);
                         quota_opc = FSFILT_OP_LINK;
                         mdd_quota_wrapper(la_tmp, qids);
                         /* get block quota for parent */
                         lquota_chkquota(mds_quota_interface_ref, obd,
                                         qids[USRQUOTA], qids[GRPQUOTA], 1,
                                         &rec_pending, NULL, LQUOTA_FLAGS_BLK,
                         quota_opc = FSFILT_OP_LINK;
                         mdd_quota_wrapper(la_tmp, qids);
                         /* get block quota for parent */
                         lquota_chkquota(mds_quota_interface_ref, obd,
                                         qids[USRQUOTA], qids[GRPQUOTA], 1,
                                         &rec_pending, NULL, LQUOTA_FLAGS_BLK,
-                                        NULL, 0);
+                                        data, 1);
                 }
         }
 #endif
                 }
         }
 #endif
@@ -960,13 +962,15 @@ static int mdd_name_insert(const struct lu_env *env,
 
                         rc = mdd_la_get(env, mdd_obj, la_tmp, BYPASS_CAPA);
                         if (!rc) {
 
                         rc = mdd_la_get(env, mdd_obj, la_tmp, BYPASS_CAPA);
                         if (!rc) {
+                                void *data = NULL;
+                                mdd_data_get(env, mdd_obj, &data);
                                 quota_opc = FSFILT_OP_LINK;
                                 mdd_quota_wrapper(la_tmp, qids);
                                 /* get block quota for parent */
                                 lquota_chkquota(mds_quota_interface_ref, obd,
                                                 qids[USRQUOTA], qids[GRPQUOTA],
                                                 1, &rec_pending, NULL,
                                 quota_opc = FSFILT_OP_LINK;
                                 mdd_quota_wrapper(la_tmp, qids);
                                 /* get block quota for parent */
                                 lquota_chkquota(mds_quota_interface_ref, obd,
                                                 qids[USRQUOTA], qids[GRPQUOTA],
                                                 1, &rec_pending, NULL,
-                                                LQUOTA_FLAGS_BLK, NULL, 0);
+                                                LQUOTA_FLAGS_BLK, data, 1);
                         }
                 } else {
                         uc->mu_cap |= CFS_CAP_SYS_RESOURCE_MASK;
                         }
                 } else {
                         uc->mu_cap |= CFS_CAP_SYS_RESOURCE_MASK;
@@ -1184,13 +1188,15 @@ static int mdd_rename_tgt(const struct lu_env *env,
 
                 rc = mdd_la_get(env, mdd_tpobj, la_tmp, BYPASS_CAPA);
                 if (!rc) {
 
                 rc = mdd_la_get(env, mdd_tpobj, la_tmp, BYPASS_CAPA);
                 if (!rc) {
+                        void *data = NULL;
+                        mdd_data_get(env, mdd_tpobj, &data);
                         quota_opc = FSFILT_OP_LINK;
                         mdd_quota_wrapper(la_tmp, qpids);
                         /* get block quota for target parent */
                         lquota_chkquota(mds_quota_interface_ref, obd,
                                         qpids[USRQUOTA], qpids[GRPQUOTA], 1,
                                         &rec_pending, NULL, LQUOTA_FLAGS_BLK,
                         quota_opc = FSFILT_OP_LINK;
                         mdd_quota_wrapper(la_tmp, qpids);
                         /* get block quota for target parent */
                         lquota_chkquota(mds_quota_interface_ref, obd,
                                         qpids[USRQUOTA], qpids[GRPQUOTA], 1,
                                         &rec_pending, NULL, LQUOTA_FLAGS_BLK,
-                                        NULL, 0);
+                                        data, 1);
                 }
         }
 #endif
                 }
         }
 #endif
@@ -1985,6 +1991,8 @@ static int mdd_rename(const struct lu_env *env,
                                 rc = mdd_la_get(env, mdd_tpobj, la_tmp,
                                                 BYPASS_CAPA);
                                 if (!rc) {
                                 rc = mdd_la_get(env, mdd_tpobj, la_tmp,
                                                 BYPASS_CAPA);
                                 if (!rc) {
+                                        void *data = NULL;
+                                        mdd_data_get(env, mdd_tpobj, &data);
                                         quota_opc = FSFILT_OP_LINK;
                                         mdd_quota_wrapper(la_tmp, qtpids);
                                         /* get block quota for target parent */
                                         quota_opc = FSFILT_OP_LINK;
                                         mdd_quota_wrapper(la_tmp, qtpids);
                                         /* get block quota for target parent */
@@ -1993,7 +2001,7 @@ static int mdd_rename(const struct lu_env *env,
                                                         qtpids[GRPQUOTA], 1,
                                                         &rec_pending, NULL,
                                                         LQUOTA_FLAGS_BLK,
                                                         qtpids[GRPQUOTA], 1,
                                                         &rec_pending, NULL,
                                                         LQUOTA_FLAGS_BLK,
-                                                        NULL, 0);
+                                                        data, 1);
                                 }
                         }
                 }
                                 }
                         }
                 }
index c5a0e64..c855f80 100644 (file)
@@ -222,6 +222,7 @@ int mdd_get_md(const struct lu_env *env, struct mdd_object *obj,
                void *md, int *md_size, const char *name);
 int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj,
                       void *md, int *md_size, const char *name);
                void *md, int *md_size, const char *name);
 int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj,
                       void *md, int *md_size, const char *name);
+int mdd_data_get(const struct lu_env *env, struct mdd_object *obj, void **data);
 int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
                struct lu_attr *la, struct lustre_capa *capa);
 int mdd_attr_set_internal(const struct lu_env *env,
 int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
                struct lu_attr *la, struct lustre_capa *capa);
 int mdd_attr_set_internal(const struct lu_env *env,
@@ -638,6 +639,15 @@ static inline int mdd_permission_internal_locked(const struct lu_env *env,
         return __mdd_permission_internal(env, obj, la, mask, role);
 }
 
         return __mdd_permission_internal(env, obj, la, mask, role);
 }
 
+static inline int mdo_data_get(const struct lu_env *env,
+                               struct mdd_object *obj,
+                               void **data)
+{
+        struct dt_object *next = mdd_object_child(obj);
+        next->do_ops->do_data_get(env, next, data);
+        return 0;
+}
+
 /* mdd inline func for calling osd_dt_object ops */
 static inline int mdo_attr_get(const struct lu_env *env, struct mdd_object *obj,
                                struct lu_attr *la, struct lustre_capa *capa)
 /* mdd inline func for calling osd_dt_object ops */
 static inline int mdo_attr_get(const struct lu_env *env, struct mdd_object *obj,
                                struct lu_attr *la, struct lustre_capa *capa)
index 588247d..0cf918a 100644 (file)
@@ -67,6 +67,15 @@ static int mdd_xattr_get(const struct lu_env *env,
                          struct md_object *obj, struct lu_buf *buf,
                          const char *name);
 
                          struct md_object *obj, struct lu_buf *buf,
                          const char *name);
 
+int mdd_data_get(const struct lu_env *env, struct mdd_object *obj,
+                 void **data)
+{
+        LASSERTF(mdd_object_exists(obj), "FID is "DFID"\n",
+                 PFID(mdd_object_fid(obj)));
+        mdo_data_get(env, obj, data);
+        return 0;
+}
+
 int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
                struct lu_attr *la, struct lustre_capa *capa)
 {
 int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
                struct lu_attr *la, struct lustre_capa *capa)
 {
@@ -1248,14 +1257,17 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
                                         qnids[USRQUOTA], qnids[GRPQUOTA], 1,
                                         &inode_pending, NULL, 0, NULL, 0);
                         block_count = (la_tmp->la_blocks + 7) >> 3;
                                         qnids[USRQUOTA], qnids[GRPQUOTA], 1,
                                         &inode_pending, NULL, 0, NULL, 0);
                         block_count = (la_tmp->la_blocks + 7) >> 3;
-                        if (block_count)
+                        if (block_count) {
+                                void *data = NULL;
+                                mdd_data_get(env, mdd_obj, &data);
                                 /* get block quota for new owner */
                                 lquota_chkquota(mds_quota_interface_ref, obd,
                                                 qnids[USRQUOTA],
                                                 qnids[GRPQUOTA],
                                                 block_count, &block_pending,
                                                 NULL, LQUOTA_FLAGS_BLK,
                                 /* get block quota for new owner */
                                 lquota_chkquota(mds_quota_interface_ref, obd,
                                                 qnids[USRQUOTA],
                                                 qnids[GRPQUOTA],
                                                 block_count, &block_pending,
                                                 NULL, LQUOTA_FLAGS_BLK,
-                                                NULL, 0);
+                                                data, 1);
+                        }
                 }
         }
 #endif
                 }
         }
 #endif
index 44178ee..960b097 100644 (file)
@@ -573,7 +573,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa,
          * decide if it is out of quota or not b=14783 */
         lquota_chkquota(filter_quota_interface_ref, obd, oa->o_uid,
                         oa->o_gid, niocount, &rec_pending, oti,
          * decide if it is out of quota or not b=14783 */
         lquota_chkquota(filter_quota_interface_ref, obd, oa->o_uid,
                         oa->o_gid, niocount, &rec_pending, oti,
-                        LQUOTA_FLAGS_BLK, inode, obj->ioo_bufcnt);
+                        LQUOTA_FLAGS_BLK, (void *)inode, obj->ioo_bufcnt);
 
         iobuf = filter_iobuf_get(&obd->u.filter, oti);
         if (IS_ERR(iobuf))
 
         iobuf = filter_iobuf_get(&obd->u.filter, oti);
         if (IS_ERR(iobuf))
index 9375453..97452a6 100644 (file)
@@ -2079,6 +2079,16 @@ static int osd_object_sync(const struct lu_env *env, struct dt_object *dt)
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
+static int osd_data_get(const struct lu_env *env, struct dt_object *dt,
+                        void **data)
+{
+        struct osd_object *obj = osd_dt_obj(dt);
+        ENTRY;
+
+        *data = (void *)obj->oo_inode;
+        RETURN(0);
+}
+
 static const struct dt_object_operations osd_obj_ops = {
         .do_read_lock    = osd_object_read_lock,
         .do_write_lock   = osd_object_write_lock,
 static const struct dt_object_operations osd_obj_ops = {
         .do_read_lock    = osd_object_read_lock,
         .do_write_lock   = osd_object_write_lock,
@@ -2097,6 +2107,7 @@ static const struct dt_object_operations osd_obj_ops = {
         .do_xattr_list   = osd_xattr_list,
         .do_capa_get     = osd_capa_get,
         .do_object_sync  = osd_object_sync,
         .do_xattr_list   = osd_xattr_list,
         .do_capa_get     = osd_capa_get,
         .do_object_sync  = osd_object_sync,
+        .do_data_get     = osd_data_get,
 };
 
 /**
 };
 
 /**
@@ -2121,6 +2132,7 @@ static const struct dt_object_operations osd_obj_ea_ops = {
         .do_xattr_list   = osd_xattr_list,
         .do_capa_get     = osd_capa_get,
         .do_object_sync  = osd_object_sync,
         .do_xattr_list   = osd_xattr_list,
         .do_capa_get     = osd_capa_get,
         .do_object_sync  = osd_object_sync,
+        .do_data_get     = osd_data_get,
 };
 
 /*
 };
 
 /*
index 5cf9505..f257cd5 100644 (file)
@@ -287,14 +287,17 @@ static int quota_check_common(struct obd_device *obd, unsigned int uid,
                                 /* in order to complete this write, we need extra
                                  * meta blocks. This function can get it through
                                  * data needed to be written b=16542 */
                                 /* in order to complete this write, we need extra
                                  * meta blocks. This function can get it through
                                  * data needed to be written b=16542 */
-                                mb = *pending;
-                                LASSERT(inode && frags > 0);
-                                if (fsfilt_get_mblk(obd, qctxt->lqc_sb, &mb,
-                                                    inode, frags) < 0)
-                                        CDEBUG(D_ERROR,
-                                               "can't get extra meta blocks.\n");
-                                else
-                                        *pending += mb;
+                                if (inode) {
+                                        mb = *pending;
+                                        rc = fsfilt_get_mblk(obd, qctxt->lqc_sb,
+                                                             &mb, inode,frags);
+                                        if (rc)
+                                                CDEBUG(D_ERROR,
+                                                       "can't get extra "
+                                                       "meta blocks.\n");
+                                        else
+                                                *pending += mb;
+                                }
                                 lqs->lqs_bwrite_pending += *pending;
                         } else {
                                 *pending = count;
                                 lqs->lqs_bwrite_pending += *pending;
                         } else {
                                 *pending = count;
index 1410a03..e1cb070 100644 (file)
@@ -18,7 +18,7 @@ export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
 ONLY=${ONLY:-"$*"}
 # enable test_23 after bug 16542 fixed.
 
 ONLY=${ONLY:-"$*"}
 # enable test_23 after bug 16542 fixed.
-ALWAYS_EXCEPT="10 23 $SANITY_QUOTA_EXCEPT"
+ALWAYS_EXCEPT="10 $SANITY_QUOTA_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 case `uname -r` in
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 case `uname -r` in