Whamcloud - gitweb
- small cleanups, comments.
authoryury <yury>
Sun, 14 Nov 2004 14:32:33 +0000 (14:32 +0000)
committeryury <yury>
Sun, 14 Nov 2004 14:32:33 +0000 (14:32 +0000)
lustre/lmv/lmv_obd.c
lustre/lmv/lmv_objmgr.c
lustre/mds/mds_reint.c
lustre/tests/lmv.sh

index d41ad34..f9cd542 100644 (file)
@@ -690,11 +690,13 @@ static int lmv_getattr(struct obd_export *exp, struct lustre_id *id,
         CDEBUG(D_OTHER, "GETATTR for "DLID4" %s\n",
                OLID4(id), obj ? "(splitted)" : "");
 
-        /* if object is splitted, then we loop over all the slaves and gather
+        /*
+         * if object is splitted, then we loop over all the slaves and gather
          * size attribute. In ideal world we would have to gather also mds field
          * from all slaves, as object is spread over the cluster and this is
          * definitely interesting information and it is not good to loss it,
-         * but...*/
+         * but...
+         */
         if (obj) {
                 struct mds_body *body;
 
@@ -906,22 +908,23 @@ repeat:
                op_data->name, OLID4(&op_data->id1));
         
         rc = md_create(lmv->tgts[id_group(&op_data->id1)].ltd_exp, 
-                       op_data, data, datalen, mode, uid, gid, rdev, request);
+                       op_data, data, datalen, mode, uid, gid, rdev,
+                       request);
         if (rc == 0) {
                 if (*request == NULL)
                         RETURN(rc);
 
                 body = lustre_msg_buf((*request)->rq_repmsg, 0,
                                       sizeof(*body));
-                LASSERT(body != NULL);
+                if (body == NULL)
+                        RETURN(-ENOMEM);
                 
                 CDEBUG(D_OTHER, "created. "DLID4"\n", OLID4(&op_data->id1));
-                
-/*                LASSERT(body->valid & OBD_MD_MDS ||
-                        body->mds == id_group(&op_data->id1));*/
         } else if (rc == -ERESTART) {
-                /* directory got splitted. time to update local object and
-                 * repeat the request with proper MDS */
+                /*
+                 * directory got splitted. time to update local object and
+                 * repeat the request with proper MDS.
+                 */
                 rc = lmv_get_mea_and_update_object(exp, &op_data->id1);
                 if (rc == 0) {
                         ptlrpc_req_finished(*request);
@@ -1464,10 +1467,16 @@ int lmv_unlink_slaves(struct obd_export *exp, struct mdc_op_data *data,
         RETURN(rc);
 }
 
+/*
+ * commented for a while, as it will not work in the case when splitted dir is
+ * created from ll_mkdir_stripe(), because mds_reint_create() returns 0 inthis
+ * case even if there is created splitted dir with passed number of stripes. So
+ * mds_reint_create() and lmv_create() need to be fixed first.
+ */
 int lmv_put_inode(struct obd_export *exp, struct lustre_id *id)
 {
         ENTRY;
-        lmv_delete_obj(exp, id);
+//        lmv_delete_obj(exp, id);
         RETURN(0);
 }
 
@@ -1487,7 +1496,9 @@ int lmv_unlink(struct obd_export *exp, struct mdc_op_data *data,
                 /* mds asks to remove slave objects */
                 rc = lmv_unlink_slaves(exp, data, request);
                 RETURN(rc);
-        } else if (data->namelen != 0) {
+        }
+
+        if (data->namelen != 0) {
                 struct lmv_obj *obj;
                 
                 obj = lmv_grab_obj(obd, &data->id1);
@@ -1522,10 +1533,12 @@ struct obd_device *lmv_get_real_obd(struct obd_export *exp,
                RETURN(ERR_PTR(rc));
         obd = lmv->tgts[0].ltd_exp->exp_obd;
         EXIT;
+        
         return obd;
 }
 
-int lmv_init_ea_size(struct obd_export *exp, int easize, int cookiesize)
+int lmv_init_ea_size(struct obd_export *exp, int easize,
+                     int cookiesize)
 {
         struct obd_device *obd = exp->exp_obd;
         struct lmv_obd *lmv = &obd->u.lmv;
index b2f2e0c..ecce7a0 100644 (file)
@@ -70,7 +70,8 @@ lmv_alloc_obj(struct obd_device *obd,
         LASSERT(mea->mea_magic == MEA_MAGIC_LAST_CHAR
                 || mea->mea_magic == MEA_MAGIC_ALL_CHARS);
 
-        OBD_SLAB_ALLOC(obj, obj_cache, GFP_NOFS, sizeof(*obj));
+        OBD_SLAB_ALLOC(obj, obj_cache, GFP_NOFS,
+                       sizeof(*obj));
         if (!obj)
                 return NULL;
 
@@ -209,6 +210,16 @@ __grab_obj(struct obd_device *obd, struct lustre_id *id)
                 if (obj->state & O_FREEING)
                         continue;
 
+                /* 
+                 * we should make sure, that we have found object belong to
+                 * passed obd. It is possible that, object manager will have two
+                 * objects with the same fid belong to different obds, if client
+                 * and mds runs on the same host. May be it is good idea to have
+                 * objects list assosiated with obd.
+                 */
+                if (obj->obd != obd)
+                        continue;
+
                 /* check if this is what we're looking for. */
                 if (id_equal_fid(&obj->id, id))
                         return __get_obj(obj);
@@ -329,10 +340,12 @@ cleanup:
         return obj;
 }
 
-/* looks for object with @id and orders to destroy it. It is possible the
- * object will not be destroyed right now, because it is still using by
- * someone. In this case it will be marked as "freeing" and will not be
- * accessible anymore for subsequent callers of lmv_grab_obj(). */
+/*
+ * looks for object with @id and orders to destroy it. It is possible the object
+ * will not be destroyed right now, because it is still using by someone. In
+ * this case it will be marked as "freeing" and will not be accessible anymore
+ * for subsequent callers of lmv_grab_obj().
+ */
 int
 lmv_delete_obj(struct obd_export *exp, struct lustre_id *id)
 {
@@ -349,27 +362,29 @@ lmv_delete_obj(struct obd_export *exp, struct lustre_id *id)
                 __put_obj(obj);
                 rc = 1;
         }
-
         spin_unlock(&obj_list_lock);
+
         RETURN(rc);
 }
 
 int
 lmv_setup_mgr(struct obd_device *obd)
 {
+        ENTRY;
         LASSERT(obd != NULL);
         
         CDEBUG(D_INFO, "LMV object manager setup (%s)\n",
                obd->obd_uuid.uuid);
 
-        return 0;
+        RETURN(0);
 }
 
 void
 lmv_cleanup_mgr(struct obd_device *obd)
 {
-        struct lmv_obj *obj;
         struct list_head *cur, *tmp;
+        struct lmv_obj *obj;
+        ENTRY;
 
         CDEBUG(D_INFO, "LMV object manager cleanup (%s)\n",
                obd->obd_uuid.uuid);
@@ -389,4 +404,5 @@ lmv_cleanup_mgr(struct obd_device *obd)
                 __put_obj(obj);
         }
         spin_unlock(&obj_list_lock);
+        EXIT;
 }
index 498167b..f72e4a1 100644 (file)
@@ -741,10 +741,12 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                                 nstripes = *(u16 *)rec->ur_eadata;
 
                         if (rc == 0 && nstripes) {
-                                /* we pass LCK_EX to split routine to signal,
+                                /*
+                                 * we pass LCK_EX to split routine to signal,
                                  * that we have exclusive access to the
                                  * directory. Simple because nobody knows it
-                                 * already exists -bzzz */
+                                 * already exists -bzzz
+                                 */
                                 rc = mds_try_to_split_dir(obd, dchild,
                                                           NULL, nstripes,
                                                           LCK_EX);
index 21ab96e..f2ebf52 100755 (executable)
@@ -46,14 +46,13 @@ for num in `seq $MDSCOUNT`; do
 done
 
 ${LMC} -m $config --add lov --lov lov1 --lmv lmv1 --stripe_sz $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 || exit 20
+
 # configure ost
 for num in `seq $OSTCOUNT`; do
     OST=ost$num
     DEVPTR=OSTDEV$num
     eval $DEVPTR=${!DEVPTR:=$TMP/$OST-`hostname`}
-    echo "$OST -- ${!DEVPTR}"
     ${LMC} -m $config --add ost --node localhost --lov lov1 --ost $OST --fstype $FSTYPE --dev ${!DEVPTR} --size $OSTSIZE $JARG || exit 30
 done
 
 ${LMC} -m $config --add mtpt --node localhost --path $MOUNT --lmv lmv1 --lov lov1 || exit 40
-