Please don't reply to lustre-devel. Instead, comment in Bugzilla by using the
following link:
https://bugzilla.lustre.org/show_bug.cgi?id=11013
What |Removed |Added
----------------------------------------------------------------------------
Comment|(From update of attachment |(From update of attachment
|9224) |9224)
|>diff -Nupr |>diff -Nupr
|lustre.orig/lustre/include/c|lustre.orig/lustre/include/c
|lass_hash.h |lass_hash.h
|lustre/lustre/include/class_|lustre/lustre/include/class_
|hash.h |hash.h
|>--- |>---
|lustre.orig/lustre/include/c|lustre.orig/lustre/include/c
|lass_hash.h 1970-01-01 |lass_hash.h 1970-01-01
|08:00:00.000000000 +0800 |08:00:00.000000000 +0800
|>+++ |>+++
|lustre/lustre/include/class_|
|hash.h 2006-12-27 |
Comment|17:38:14.000000000 +0800 |lustre/lustre/include/class_
|>@@ -0,0 +1 |hash.h 2006-12-27
| |17:38:14.000000000 +0800
| |>@@ -0,0 +1
Comment|130 @@ |130 @@
|>+/* -*- mode: c; c-basic- |>+/* -*- mode: c; c-basic-
|offset: 8; indent-tabs-mode:|offset: 8; indent-tabs-mode:
|nil; -*- |nil; -*-
|>+ * |>+ *
|vim:expandtab:shiftwidth=8:t|vim:expandtab:shiftwidth=8:t
|abstop=8: |abstop=8:
|>+ */ |>+ */
|>+ |>+
|>+#ifndef __CLASS_HASH_H |>+#ifndef __CLASS_HASH_H
|>+#define __CLASS_HASH_H |>+#define __CLASS_HASH_H
|>+ |>+
|>+#include <lustre_lib.h> |>+#include <lustre_lib.h>
|>+ |>+
|>+#ifndef __KERNEL__ |>+#ifndef __KERNEL__
|>+#define |>+#define
Comment|hlist_add_head_rcu |hlist_add_head_rcu
|hlist_add_head |hlist_add_head
|>+#define hlist_for_each_rcu|>+#define hlist_for_each_rcu
|hlist_for_each |hlist_for_each
|in Linux kernel 2.6.18, it |in Linux kernel 2.6.18, it
|seems that there is no more |seems that there is no more
|hlist_for_each_rcu |hlist_for_each_rcu
Comment|only |only
|has hlist_for_each_entry_rcu|has hlist_for_each_entry_rcu
|>+#define rcu_read_lock() |>+#define rcu_read_lock()
|>+#define rcu_read_unlock() |>+#define rcu_read_unlock()
|>+#endif |>+#endif
|>+ |>+
|<snip>... |<snip>...
|>diff -Nupr |>diff -Nupr
|lustre.orig/lustre/include/o|lustre.orig/lustre/include/o
|bd.h |bd.h
|lustre/lustre/include/obd.h |lustre/lustre/include/obd.h
|>--- |>---
|lustre.orig/lustre/include/o|lustre.orig/lustre/include/o
|bd.h 2006-12-19 |bd.h 2006-12-19
Comment|08:28:43.000000000 +0800 |08:28:43.000000000 +0800
|>+++ |>+++
|lustre/lustre/include/obd.h |lustre/lustre/include/obd.h
|2006-12-27 |2006-12-27
|17:38:14.000000000 +0800 |17:38:14.000000000 +0800
|>@@ -31,6 +31 |>@@ -31,6 +31
Comment|7 @@ |7 @@
|> #include |> #include
|<lustre/lustre_idl.h> |<lustre/lustre_idl.h>
|> #include <lustre_export.h>|> #include <lustre_export.h>
|> #include <lustre_quota.h> |> #include <lustre_quota.h>
|>+#include <class_hash.h> |>+#include <class_hash.h>
|> |>
|> #define MAX_OBD_DEVICES |> #define MAX_OBD_DEVICES
|8192 |8192
|> |>
|>@@ -729,6 +730,10 @@ struct|>@@ -729,6 +730,10 @@ struct
|obd_device { |obd_device {
|> |>
|obd_fail:1 |obd_fail:1
Comment|/* cleanup with failover */ |/* cleanup with failover */
|> |>
|obd_async_recov:1; /* |obd_async_recov:1; /*
|allow asyncronous orphan |allow asyncronous orphan
|cleanup */ |cleanup */
|> atomic_t |> atomic_t
|obd_refcount; |obd_refcount;
|>+ /* uuid-export |>+ /* uuid-export
|hash body */ |hash body */
|>+ struct |>+ struct
|lustre_class_hash_body |lustre_class_hash_body
|*obd_uuid_hash_body; |*obd_uuid_hash_body;
|>+ |>+
Comment|/* uuid-export hash body */ |/* uuid-export hash body */
|wrong comment. |wrong comment.
|>+ struct |>+ struct
|lustre_class_hash_body |lustre_class_hash_body
|*obd_nid_hash_body; |*obd_nid_hash_body;
|> cfs_waitq_t |> cfs_waitq_t
|obd_refcount_waitq; |obd_refcount_waitq;
|> struct list_head |> struct list_head
|obd_exports; |obd_exports;
|> int |> int
Comment|obd_num_exports; |obd_num_exports;
|<snip>... |<snip>...
|>diff -Nupr |>diff -Nupr
|lustre.orig/lustre/obdclass/|lustre.orig/lustre/obdclass/
|class_hash.c |class_hash.c
|lustre/lustre/obdclass/class|lustre/lustre/obdclass/class
|_hash.c |_hash.c
|>--- |>---
|lustre.orig/lustre/obdclass/|lustre.orig/lustre/obdclass/
|class_hash.c 1970-01-01 |class_hash.c 1970-01-01
|08:00:00.000000000 +0800 |08:00:00.000000000 +0800
|>+++ |>+++
Comment|lustre/lustre/obdclass/class|lustre/lustre/obdclass/class
|_hash.c 2006-12-27 |_hash.c 2006-12-27
|17:38:14.000000000 +0800 |17:38:14.000000000 +0800
|<snip>... |<snip>...
|>+ |>+
|>+/* |>+/*
|>+ * only allow unique @key |>+ * only allow unique @key
|in hashtables, if the same |in hashtables, if the same
|@key has existed in |@key has existed in
|hashtables |hashtables
Comment|>+ * it will return with |>+ * it will return with
|fails. |fails.
|>+ */ |>+ */
|>+int |>+int
|lustre_hash_additem_unique(s|lustre_hash_additem_unique(s
|truct lustre_class_hash_body|truct lustre_class_hash_body
|*hash_body, |*hash_body,
|>+ |>+
|void *key |void *key
Comment|struct hlist_node |struct hlist_node
|*actual_hnode) |*actual_hnode)
|>+{ |>+{
|>+ int hashent; |>+ int hashent;
|>+ struct |>+ struct
|lustre_hash_bucket *bucket =|lustre_hash_bucket *bucket =
|NULL; |NULL;
|>+ struct |>+ struct
|lustre_hash_operations *hop |lustre_hash_operations *hop
|= hash_body- |= hash_body-
|>lchb_hash_operations; |>lchb_hash_operations;
|>+ ENTRY; |>+ ENTRY;
|>+ |>+
|>+ hashent = |>+ hashent =
Comment|hop- |hop-
|>lustre_hashfn(hash_body, |>lustre_hashfn(hash_body,
|key); |key);
|>+ |>+
|>+ if ( hashent == -1|>+ if ( hashent == -1
|) { |) {
|>+ |>+
|CERROR("Cannot get correct |CERROR("Cannot get correct
|hash value , hashname = %s |hash value , hashname = %s
|\n" |\n"
Comment|>+ |>+
|hash_body->hashname); |hash_body->hashname);
|>+ RETURN(- |>+ RETURN(-
|EINVAL); |EINVAL);
|>+ } |>+ }
|>+ |>+
|>+ /* get the hash- |>+ /* get the hash-
|bucket and lock it */ |bucket and lock it */
|>+ bucket = |>+ bucket =
|&hash_body- |&hash_body-
|>lchb_hash_tables[hashent]; |>lchb_hash_tables[hashent];
|>+ |>+
Comment|spin_lock(&bucket- |spin_lock(&bucket-
|>lhb_lock); |>lhb_lock);
|>+ |>+
|>+ if ( |>+ if (
|(lustre_hash_getitem_in_buck|(lustre_hash_getitem_in_buck
|et_nolock(hash_body, |et_nolock(hash_body,
|hashent, key)) != NULL) { |hashent, key))
|>+ /* the |!= NULL) {
|added-item exist in |>+ /* the
|hashtables |added-item exist in
| |hashtables
Comment|so cannot add it again */ |so cannot add it again */
|>+ |>+
|spin_unlock(&bucket- |spin_unlock(&bucket-
|>lhb_lock); |>lhb_lock);
|>+ |>+
|>+ |>+
|CWARN("Object exist\n"); |CWARN("Object exist\n");
|>+ RETURN(- |>+ RETURN(-
|EALREADY); |EALREADY);
|>+ } |>+ }
|>+ |>+
|>+ |>+
|hlist_add_head(actual_hnode |hlist_add_head(actual_hnode
Comment|&(bucket->lhb_head)); |&(bucket->lhb_head));
|should it be |should it be
|"hlist_add_head_rcu" ? |"hlist_add_head_rcu" ?
|>+ |>+
|>+#ifdef LUSTRE_HASH_DEBUG |>+#ifdef LUSTRE_HASH_DEBUG
|>+ /* hash distribute|>+ /* hash distribute
|debug */ |debug */
|>+ hash_body- |>+ hash_body-
|>lchb_hash_tables[hashent]- |>lchb_hash_tables[hashent]-
|>lhb_item_count++; |>lhb_item_count++;
|>+ CDEBUG(D_INFO |>+ CDEBUG(D_INFO
Comment|"hashname[%s] bucket[%d] has|"hashname[%s] bucket[%d] has
|[%d] hashitem\n", |[%d] hashitem\n",
|>+ |>+
|hash_body->hashname, hashent|hash_body->hashname, hashent
Comment|>+ |>+
|hash_body- |hash_body-
|>lchb_hash_tables[hashent]- |>lchb_hash_tables[hashent]-
|>lhb_item_count); |>lhb_item_count);
|>+#endif |>+#endif
|>+ hop- |>+ hop-
|>lustre_hash_object_refcount|>lustre_hash_object_refcount
|_get(actual_hnode); |_get(actual_hnode);
|>+ |>+
|>+ |>+
|spin_unlock(&bucket- |spin_unlock(&bucket-
|>lhb_lock); |>lhb_lock);
|>+ |>+
|>+ |>+
Comment|RETURN(0); |RETURN(0);
|>+} |>+}
|>+EXPORT_SYMBOL(lustre_hash_|>+EXPORT_SYMBOL(lustre_hash_
|additem_unique); |additem_unique);
|>+ |>+
|>+/* |>+/*
|>+ * this version of |>+ * this version of
|additem, it allow multi same|additem, it allow multi same
|@key <key, value> in |@key <key, value> in
|hashtables. * in this |hashtables. * in this
|additem version, we don't |additem version, we don't
|need to check if exist same |need to check if exist same
|@key in hash |@key
|>+ * tables |in hash
| |>+ * tables
2007-1-11 Status Update : imporved code per code review result, do RCU object
free improve now.
_______________________________________________
Lustre-devel mailing list
[email protected]
https://mail.clusterfs.com/mailman/listinfo/lustre-devel