fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / fs / afs / vlocation.c
index 9cff6b6..782ee7c 100644 (file)
@@ -29,6 +29,7 @@
 static void afs_vlocation_update_timer(struct afs_timer *timer);
 static void afs_vlocation_update_attend(struct afs_async_op *op);
 static void afs_vlocation_update_discard(struct afs_async_op *op);
+static void __afs_put_vlocation(struct afs_vlocation *vlocation);
 
 static void __afs_vlocation_timeout(struct afs_timer *timer)
 {
@@ -56,7 +57,7 @@ static const struct afs_async_op_ops afs_vlocation_update_op_ops = {
 
 static LIST_HEAD(afs_vlocation_update_pendq);  /* queue of VLs awaiting update */
 static struct afs_vlocation *afs_vlocation_update;     /* VL currently being updated */
-static spinlock_t afs_vlocation_update_lock = SPIN_LOCK_UNLOCKED; /* lock guarding update queue */
+static DEFINE_SPINLOCK(afs_vlocation_update_lock); /* lock guarding update queue */
 
 #ifdef AFS_CACHING_SUPPORT
 static cachefs_match_val_t afs_vlocation_cache_match(void *target,
@@ -280,11 +281,10 @@ int afs_vlocation_lookup(struct afs_cell *cell,
        spin_unlock(&cell->vl_gylock);
 
        /* not in the cell's in-memory lists - create a new record */
-       vlocation = kmalloc(sizeof(struct afs_vlocation), GFP_KERNEL);
+       vlocation = kzalloc(sizeof(struct afs_vlocation), GFP_KERNEL);
        if (!vlocation)
                return -ENOMEM;
 
-       memset(vlocation, 0, sizeof(struct afs_vlocation));
        atomic_set(&vlocation->usage, 1);
        INIT_LIST_HEAD(&vlocation->link);
        rwlock_init(&vlocation->lock);
@@ -325,8 +325,7 @@ int afs_vlocation_lookup(struct afs_cell *cell,
        /* found in the graveyard - resurrect */
        _debug("found in graveyard");
        atomic_inc(&vlocation->usage);
-       list_del(&vlocation->link);
-       list_add_tail(&vlocation->link, &cell->vl_list);
+       list_move_tail(&vlocation->link, &cell->vl_list);
        spin_unlock(&cell->vl_gylock);
 
        afs_kafstimod_del_timer(&vlocation->timeout);
@@ -455,7 +454,7 @@ int afs_vlocation_lookup(struct afs_cell *cell,
  * finish using a volume location record
  * - caller must have cell->vol_sem write-locked
  */
-void __afs_put_vlocation(struct afs_vlocation *vlocation)
+static void __afs_put_vlocation(struct afs_vlocation *vlocation)
 {
        struct afs_cell *cell;
 
@@ -477,8 +476,7 @@ void __afs_put_vlocation(struct afs_vlocation *vlocation)
        }
 
        /* move to graveyard queue */
-       list_del(&vlocation->link);
-       list_add_tail(&vlocation->link,&cell->vl_graveyard);
+       list_move_tail(&vlocation->link,&cell->vl_graveyard);
 
        /* remove from pending timeout queue (refcounted if actually being
         * updated) */
@@ -906,7 +904,7 @@ static cachefs_match_val_t afs_vlocation_cache_match(void *target,
                if (!vlocation->valid ||
                    vlocation->vldb.rtime == vldb->rtime
                    ) {
-                       struct_cpy(&vlocation->vldb, vldb);
+                       vlocation->vldb = *vldb;
                        vlocation->valid = 1;
                        _leave(" = SUCCESS [c->m]");
                        return CACHEFS_MATCH_SUCCESS;
@@ -947,7 +945,7 @@ static void afs_vlocation_cache_update(void *source, void *entry)
 
        _enter("");
 
-       struct_cpy(vldb,&vlocation->vldb);
+       *vldb = vlocation->vldb;
 
 } /* end afs_vlocation_cache_update() */
 #endif