Whamcloud - gitweb
obk->freeing changed to obj->state and O_FREEING flag is added instead.
authoryury <yury>
Mon, 21 Jun 2004 12:16:29 +0000 (12:16 +0000)
committeryury <yury>
Mon, 21 Jun 2004 12:16:29 +0000 (12:16 +0000)
lustre/lmv/lmv_internal.h
lustre/lmv/lmv_objmgr.c

index 35d4ab3..6bf7fa3 100644 (file)
@@ -14,10 +14,12 @@ struct lmv_inode {
         int                flags;
 };
 
+#define O_FREEING          (1 << 0)
+
 struct lmv_obj {
         struct list_head   list;
        struct semaphore   guard;
-       int                freeing;        /* object is freeing. */
+       int                state;          /* object state. */
         atomic_t           count;
         struct ll_fid      fid;            /* master fid of dir */
         void               *update;        /* bitmap of status (uptodate) */
index 50763dc..d00877d 100644 (file)
@@ -66,8 +66,8 @@ lmv_alloc_obj(struct obd_device *obd, struct ll_fid *fid,
                 return NULL;
 
         obj->obd = obd;
+        obj->state = 0;
         obj->fid = *fid;
-        obj->freeing = 0;
           
         init_MUTEX(&obj->guard);
         atomic_set(&obj->count, 0);
@@ -130,6 +130,9 @@ lmv_add_obj(struct lmv_obj *obj)
 static void
 __del_obj(struct lmv_obj *obj)
 {
+        if (!(obj->state & O_FREEING))
+                LBUG();
+        
         list_del(&obj->list);
         lmv_free_obj(obj);
 }
@@ -193,7 +196,7 @@ __grab_obj(struct obd_device *obd, struct ll_fid *fid)
 
                 /* check if object is in progress of destroying. If so - skip
                  * it. */
-                if (obj->freeing)
+                if (obj->state & O_FREEING)
                         continue;
 
                 /* check if this is waht we're looking for. */
@@ -337,7 +340,8 @@ lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid)
         
         obj = __grab_obj(obd, fid);
         if (obj) {
-                obj->freeing = 1;
+                obj->state |= O_FREEING;
+                
                 __put_obj(obj);
                 __put_obj(obj);
                 rc = 1;
@@ -371,6 +375,7 @@ lmv_cleanup_mgr(struct obd_device *obd)
                 if (obj->obd != obd)
                         continue;
 
+                obj->state |= O_FREEING;
                 __put_obj(obj);
         }
         spin_unlock(&lmv_obj_list_lock);