Whamcloud - gitweb
fix:
authorlsy <lsy>
Fri, 9 Sep 2005 13:44:30 +0000 (13:44 +0000)
committerlsy <lsy>
Fri, 9 Sep 2005 13:44:30 +0000 (13:44 +0000)
* mds_id might be 0, so +1 when calculating hash.
* link new capa into its hash list head, not the capa_hash.

lustre/mds/mds_capa.c
lustre/mds/mds_lmv.c
lustre/obdclass/capa.c

index 26ea186..8a87a54 100644 (file)
@@ -258,8 +258,6 @@ mds_update_capa_key(struct obd_device *obd, struct mds_capa_key *mkey,
         if (rc2)
                 GOTO(out, rc2);
         
         if (rc2)
                 GOTO(out, rc2);
         
-        CDEBUG(D_INFO, "wrote capa keyid %u\n", keyid);
-
         spin_lock(&mds_capa_lock);
         list_del_init(&CUR_CAPA_KEY_LIST(mds));
         mds->mds_capa_key_idx = to_update;
         spin_lock(&mds_capa_lock);
         list_del_init(&CUR_CAPA_KEY_LIST(mds));
         mds->mds_capa_key_idx = to_update;
@@ -269,7 +267,7 @@ mds_update_capa_key(struct obd_device *obd, struct mds_capa_key *mkey,
         if (time_before(expiry, mds_eck_timer.expires) ||
             !timer_pending(&mds_eck_timer)) {
                 mod_timer(&mds_eck_timer, expiry);
         if (time_before(expiry, mds_eck_timer.expires) ||
             !timer_pending(&mds_eck_timer)) {
                 mod_timer(&mds_eck_timer, expiry);
-                CDEBUG(D_INFO, "mds_eck_timer %lu", expiry);
+                CDEBUG(D_INFO, "mds_eck_timer %lu\n", expiry);
         }
         spin_unlock(&mds_capa_lock);
 
         }
         spin_unlock(&mds_capa_lock);
 
index 11cce6e..332d43e 100644 (file)
@@ -935,7 +935,7 @@ int mds_choose_mdsnum(struct obd_device *obd, const char *name, int len, int fla
 
         if (local)
                 RETURN(mds->mds_num);
 
         if (local)
                 RETURN(mds->mds_num);
-        
+
         if (flags & REC_REINT_CREATE) {
                 i = mds->mds_num;
         } else if (mds->mds_md_exp != NULL && peer != NULL) {
         if (flags & REC_REINT_CREATE) {
                 i = mds->mds_num;
         } else if (mds->mds_md_exp != NULL && peer != NULL) {
index 2dc1532..3bd0a71 100644 (file)
@@ -70,8 +70,8 @@ EXPORT_SYMBOL(ll_capa_timer);
 static inline int const
 capa_hashfn(unsigned int uid, int capa_op, __u64 mdsid, unsigned long ino)
 {
 static inline int const
 capa_hashfn(unsigned int uid, int capa_op, __u64 mdsid, unsigned long ino)
 {
-        return (ino ^ uid) * (unsigned long)capa_op * (unsigned long)mdsid %
-               NR_CAPAHASH;
+        return (ino ^ uid) * (unsigned long)capa_op * (unsigned long)(mdsid + 1)
+               NR_CAPAHASH;
 }
 
 int capa_op(int flags)
 }
 
 int capa_op(int flags)
@@ -188,13 +188,14 @@ int capa_cache_init(void)
 
 void capa_cache_cleanup(void)
 {
 
 void capa_cache_cleanup(void)
 {
-        struct obd_capa *ocapa;
-        struct hlist_node *pos, *n;
+        struct obd_capa *ocapa, *tmp;
+        int i;
 
 
-        hlist_for_each_entry_safe(ocapa, pos, n, capa_hash, c_hash) {
-                LASSERT(ocapa->c_type != CLIENT_CAPA);
-                __capa_put(ocapa);
-                destroy_capa(ocapa);
+        for (i = MDS_CAPA; i <= FILTER_CAPA; i++) {
+                list_for_each_entry_safe(ocapa, tmp, &capa_list[i], c_list) {
+                        __capa_put(ocapa);
+                        destroy_capa(ocapa);
+                }
         }
 
         OBD_FREE(capa_hash, PAGE_SIZE);
         }
 
         OBD_FREE(capa_hash, PAGE_SIZE);
@@ -242,7 +243,7 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa)
                 do_update_capa(ocapa, capa);
                 ocapa->c_type = type;
                 list_add_capa(ocapa, &capa_list[type]);
                 do_update_capa(ocapa, capa);
                 ocapa->c_type = type;
                 list_add_capa(ocapa, &capa_list[type]);
-                hlist_add_head(&ocapa->c_hash, capa_hash);
+                hlist_add_head(&ocapa->c_hash, head);
                 if (type == CLIENT_CAPA)
                         INIT_LIST_HEAD(&ocapa->c_lli_list);
 
                 if (type == CLIENT_CAPA)
                         INIT_LIST_HEAD(&ocapa->c_lli_list);