Whamcloud - gitweb
LU-1330 obdclass: add obd_target.h
[fs/lustre-release.git] / lustre / include / lustre_capa.h
index 73d7b72..6c31c45 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -85,13 +85,13 @@ struct obd_capa {
         struct lustre_capa        c_capa;       /* capa */
         cfs_atomic_t              c_refc;       /* ref count */
         cfs_time_t                c_expiry;     /* jiffies */
-        cfs_spinlock_t            c_lock;       /* protect capa content */
-        int                       c_site;
+       spinlock_t              c_lock; /* protect capa content */
+       int                     c_site;
 
-        union {
-                struct client_capa      cli;
-                struct target_capa      tgt;
-        } u;
+       union {
+               struct client_capa      cli;
+               struct target_capa      tgt;
+       } u;
 };
 
 enum {
@@ -135,9 +135,9 @@ static inline __u32 capa_keyid(struct lustre_capa *capa)
         return capa->lc_keyid;
 }
 
-static inline __u64 capa_key_mdsid(struct lustre_capa_key *key)
+static inline __u64 capa_key_seq(struct lustre_capa_key *key)
 {
-        return key->lk_mdsid;
+        return key->lk_seq;
 }
 
 static inline __u32 capa_key_keyid(struct lustre_capa_key *key)
@@ -155,28 +155,31 @@ static inline __u32 capa_expiry(struct lustre_capa *capa)
         return capa->lc_expiry;
 }
 
-#define DEBUG_CAPA(level, c, fmt, args...)                                     \
+void _debug_capa(struct lustre_capa *, struct libcfs_debug_msg_data *,
+                 const char *fmt, ... );
+#define DEBUG_CAPA(level, capa, fmt, args...)                                  \
 do {                                                                           \
-CDEBUG(level, fmt " capability@%p fid "DFID" opc "LPX64" uid "LPU64" gid "     \
-       LPU64" flags %u alg %d keyid %u timeout %u expiry %u\n",                \
-       ##args, c, PFID(capa_fid(c)), capa_opc(c), capa_uid(c), capa_gid(c),    \
-       capa_flags(c), capa_alg(c), capa_keyid(c), capa_timeout(c),             \
-       capa_expiry(c));                                                        \
+        if (((level) & D_CANTMASK) != 0 ||                                     \
+            ((libcfs_debug & (level)) != 0 &&                                  \
+             (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) {               \
+                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, NULL);              \
+                _debug_capa((capa), &msgdata, fmt, ##args);                    \
+        }                                                                      \
 } while (0)
 
 #define DEBUG_CAPA_KEY(level, k, fmt, args...)                                 \
 do {                                                                           \
-CDEBUG(level, fmt " capability key@%p mdsid "LPU64" keyid %u\n",               \
-       ##args, k, capa_key_mdsid(k), capa_key_keyid(k));                       \
+CDEBUG(level, fmt " capability key@%p seq "LPU64" keyid %u\n",                 \
+       ##args, k, capa_key_seq(k), capa_key_keyid(k));                         \
 } while (0)
 
 typedef int (* renew_capa_cb_t)(struct obd_capa *, struct lustre_capa *);
 
 /* obdclass/capa.c */
 extern cfs_list_t capa_list[];
-extern cfs_spinlock_t capa_lock;
+extern spinlock_t capa_lock;
 extern int capa_count[];
-extern cfs_mem_cache_t *capa_cachep;
+extern struct kmem_cache *capa_cachep;
 
 cfs_hlist_head_t *init_capa_hash(void);
 void cleanup_capa_hash(cfs_hlist_head_t *hash);
@@ -204,7 +207,7 @@ static inline struct obd_capa *alloc_capa(int site)
 
         CFS_INIT_LIST_HEAD(&ocapa->c_list);
         cfs_atomic_set(&ocapa->c_refc, 1);
-        cfs_spin_lock_init(&ocapa->c_lock);
+       spin_lock_init(&ocapa->c_lock);
         ocapa->c_site = site;
         if (ocapa->c_site == CAPA_SITE_CLIENT)
                 CFS_INIT_LIST_HEAD(&ocapa->u.cli.lli_list);