Commit 2885bdea authored by Andreas Dilger's avatar Andreas Dilger Committed by Greg Kroah-Hartman

staging: lustre: ldlm: remove ldlm_side_t typedef usage from code

Replace usage of ldlm_side_t with named enums
to conform to upstream coding style.
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142
Reviewed-on: http://review.whamcloud.com/15300
Reviewed-on: http://review.whamcloud.com/15301Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarBob Glossman <bob.glossman@intel.com>
Reviewed-by: default avatarfrank zago <fzago@cray.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3dea3478
...@@ -86,10 +86,10 @@ enum ldlm_error { ...@@ -86,10 +86,10 @@ enum ldlm_error {
* decisions about lack of conflicts or do any autonomous lock granting without * decisions about lack of conflicts or do any autonomous lock granting without
* first speaking to a server. * first speaking to a server.
*/ */
typedef enum { enum ldlm_side {
LDLM_NAMESPACE_SERVER = 1 << 0, LDLM_NAMESPACE_SERVER = 1 << 0,
LDLM_NAMESPACE_CLIENT = 1 << 1 LDLM_NAMESPACE_CLIENT = 1 << 1
} ldlm_side_t; };
/** /**
* The blocking callback is overloaded to perform two functions. These flags * The blocking callback is overloaded to perform two functions. These flags
...@@ -359,7 +359,7 @@ struct ldlm_namespace { ...@@ -359,7 +359,7 @@ struct ldlm_namespace {
struct obd_device *ns_obd; struct obd_device *ns_obd;
/** Flag indicating if namespace is on client instead of server */ /** Flag indicating if namespace is on client instead of server */
ldlm_side_t ns_client; enum ldlm_side ns_client;
/** Resource hash table for namespace. */ /** Resource hash table for namespace. */
struct cfs_hash *ns_rs_hash; struct cfs_hash *ns_rs_hash;
...@@ -1187,7 +1187,7 @@ void ldlm_unlink_lock_skiplist(struct ldlm_lock *req); ...@@ -1187,7 +1187,7 @@ void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);
/* resource.c */ /* resource.c */
struct ldlm_namespace * struct ldlm_namespace *
ldlm_namespace_new(struct obd_device *obd, char *name, ldlm_namespace_new(struct obd_device *obd, char *name,
ldlm_side_t client, enum ldlm_appetite apt, enum ldlm_side client, enum ldlm_appetite apt,
enum ldlm_ns_type ns_type); enum ldlm_ns_type ns_type);
int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags); int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags);
void ldlm_namespace_get(struct ldlm_namespace *ns); void ldlm_namespace_get(struct ldlm_namespace *ns);
...@@ -1206,7 +1206,7 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, ...@@ -1206,7 +1206,7 @@ void ldlm_resource_add_lock(struct ldlm_resource *res,
struct ldlm_lock *lock); struct ldlm_lock *lock);
void ldlm_resource_unlink_lock(struct ldlm_lock *lock); void ldlm_resource_unlink_lock(struct ldlm_lock *lock);
void ldlm_res2desc(struct ldlm_resource *res, struct ldlm_resource_desc *desc); void ldlm_res2desc(struct ldlm_resource *res, struct ldlm_resource_desc *desc);
void ldlm_dump_all_namespaces(ldlm_side_t client, int level); void ldlm_dump_all_namespaces(enum ldlm_side client, int level);
void ldlm_namespace_dump(int level, struct ldlm_namespace *); void ldlm_namespace_dump(int level, struct ldlm_namespace *);
void ldlm_resource_dump(int level, struct ldlm_resource *); void ldlm_resource_dump(int level, struct ldlm_resource *);
int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *, int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *,
...@@ -1331,7 +1331,7 @@ int ldlm_pools_init(void); ...@@ -1331,7 +1331,7 @@ int ldlm_pools_init(void);
void ldlm_pools_fini(void); void ldlm_pools_fini(void);
int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
int idx, ldlm_side_t client); int idx, enum ldlm_side client);
void ldlm_pool_fini(struct ldlm_pool *pl); void ldlm_pool_fini(struct ldlm_pool *pl);
void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock); void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock);
void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock); void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock);
......
...@@ -39,13 +39,13 @@ extern struct list_head ldlm_srv_namespace_list; ...@@ -39,13 +39,13 @@ extern struct list_head ldlm_srv_namespace_list;
extern struct mutex ldlm_cli_namespace_lock; extern struct mutex ldlm_cli_namespace_lock;
extern struct list_head ldlm_cli_active_namespace_list; extern struct list_head ldlm_cli_active_namespace_list;
static inline int ldlm_namespace_nr_read(ldlm_side_t client) static inline int ldlm_namespace_nr_read(enum ldlm_side client)
{ {
return client == LDLM_NAMESPACE_SERVER ? return client == LDLM_NAMESPACE_SERVER ?
ldlm_srv_namespace_nr : ldlm_cli_namespace_nr; ldlm_srv_namespace_nr : ldlm_cli_namespace_nr;
} }
static inline void ldlm_namespace_nr_inc(ldlm_side_t client) static inline void ldlm_namespace_nr_inc(enum ldlm_side client)
{ {
if (client == LDLM_NAMESPACE_SERVER) if (client == LDLM_NAMESPACE_SERVER)
ldlm_srv_namespace_nr++; ldlm_srv_namespace_nr++;
...@@ -53,7 +53,7 @@ static inline void ldlm_namespace_nr_inc(ldlm_side_t client) ...@@ -53,7 +53,7 @@ static inline void ldlm_namespace_nr_inc(ldlm_side_t client)
ldlm_cli_namespace_nr++; ldlm_cli_namespace_nr++;
} }
static inline void ldlm_namespace_nr_dec(ldlm_side_t client) static inline void ldlm_namespace_nr_dec(enum ldlm_side client)
{ {
if (client == LDLM_NAMESPACE_SERVER) if (client == LDLM_NAMESPACE_SERVER)
ldlm_srv_namespace_nr--; ldlm_srv_namespace_nr--;
...@@ -61,13 +61,13 @@ static inline void ldlm_namespace_nr_dec(ldlm_side_t client) ...@@ -61,13 +61,13 @@ static inline void ldlm_namespace_nr_dec(ldlm_side_t client)
ldlm_cli_namespace_nr--; ldlm_cli_namespace_nr--;
} }
static inline struct list_head *ldlm_namespace_list(ldlm_side_t client) static inline struct list_head *ldlm_namespace_list(enum ldlm_side client)
{ {
return client == LDLM_NAMESPACE_SERVER ? return client == LDLM_NAMESPACE_SERVER ?
&ldlm_srv_namespace_list : &ldlm_cli_active_namespace_list; &ldlm_srv_namespace_list : &ldlm_cli_active_namespace_list;
} }
static inline struct mutex *ldlm_namespace_lock(ldlm_side_t client) static inline struct mutex *ldlm_namespace_lock(enum ldlm_side client)
{ {
return client == LDLM_NAMESPACE_SERVER ? return client == LDLM_NAMESPACE_SERVER ?
&ldlm_srv_namespace_lock : &ldlm_cli_namespace_lock; &ldlm_srv_namespace_lock : &ldlm_cli_namespace_lock;
...@@ -79,10 +79,11 @@ static inline int ldlm_ns_empty(struct ldlm_namespace *ns) ...@@ -79,10 +79,11 @@ static inline int ldlm_ns_empty(struct ldlm_namespace *ns)
return atomic_read(&ns->ns_bref) == 0; return atomic_read(&ns->ns_bref) == 0;
} }
void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *, ldlm_side_t); void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *,
enum ldlm_side);
void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *, void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *,
ldlm_side_t); enum ldlm_side);
struct ldlm_namespace *ldlm_namespace_first_locked(ldlm_side_t); struct ldlm_namespace *ldlm_namespace_first_locked(enum ldlm_side);
/* ldlm_request.c */ /* ldlm_request.c */
/* Cancel lru flag, it indicates we cancel aged locks. */ /* Cancel lru flag, it indicates we cancel aged locks. */
......
...@@ -651,7 +651,7 @@ static void ldlm_pool_debugfs_fini(struct ldlm_pool *pl) ...@@ -651,7 +651,7 @@ static void ldlm_pool_debugfs_fini(struct ldlm_pool *pl)
} }
int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
int idx, ldlm_side_t client) int idx, enum ldlm_side client)
{ {
int rc; int rc;
...@@ -788,7 +788,7 @@ static struct completion ldlm_pools_comp; ...@@ -788,7 +788,7 @@ static struct completion ldlm_pools_comp;
* count locks from all namespaces (if possible). Returns number of * count locks from all namespaces (if possible). Returns number of
* cached locks. * cached locks.
*/ */
static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask) static unsigned long ldlm_pools_count(enum ldlm_side client, gfp_t gfp_mask)
{ {
unsigned long total = 0; unsigned long total = 0;
int nr_ns; int nr_ns;
...@@ -837,7 +837,8 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask) ...@@ -837,7 +837,8 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask)
return total; return total;
} }
static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, gfp_t gfp_mask) static unsigned long ldlm_pools_scan(enum ldlm_side client, int nr,
gfp_t gfp_mask)
{ {
unsigned long freed = 0; unsigned long freed = 0;
int tmp, nr_ns; int tmp, nr_ns;
...@@ -895,7 +896,7 @@ static unsigned long ldlm_pools_cli_scan(struct shrinker *s, ...@@ -895,7 +896,7 @@ static unsigned long ldlm_pools_cli_scan(struct shrinker *s,
sc->gfp_mask); sc->gfp_mask);
} }
static int ldlm_pools_recalc(ldlm_side_t client) static int ldlm_pools_recalc(enum ldlm_side client)
{ {
struct ldlm_namespace *ns; struct ldlm_namespace *ns;
struct ldlm_namespace *ns_old = NULL; struct ldlm_namespace *ns_old = NULL;
......
...@@ -612,7 +612,7 @@ static struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = { ...@@ -612,7 +612,7 @@ static struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = {
/** Register \a ns in the list of namespaces */ /** Register \a ns in the list of namespaces */
static void ldlm_namespace_register(struct ldlm_namespace *ns, static void ldlm_namespace_register(struct ldlm_namespace *ns,
ldlm_side_t client) enum ldlm_side client)
{ {
mutex_lock(ldlm_namespace_lock(client)); mutex_lock(ldlm_namespace_lock(client));
LASSERT(list_empty(&ns->ns_list_chain)); LASSERT(list_empty(&ns->ns_list_chain));
...@@ -625,7 +625,7 @@ static void ldlm_namespace_register(struct ldlm_namespace *ns, ...@@ -625,7 +625,7 @@ static void ldlm_namespace_register(struct ldlm_namespace *ns,
* Create and initialize new empty namespace. * Create and initialize new empty namespace.
*/ */
struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
ldlm_side_t client, enum ldlm_side client,
enum ldlm_appetite apt, enum ldlm_appetite apt,
enum ldlm_ns_type ns_type) enum ldlm_ns_type ns_type)
{ {
...@@ -954,7 +954,7 @@ void ldlm_namespace_free_prior(struct ldlm_namespace *ns, ...@@ -954,7 +954,7 @@ void ldlm_namespace_free_prior(struct ldlm_namespace *ns,
/** Unregister \a ns from the list of namespaces. */ /** Unregister \a ns from the list of namespaces. */
static void ldlm_namespace_unregister(struct ldlm_namespace *ns, static void ldlm_namespace_unregister(struct ldlm_namespace *ns,
ldlm_side_t client) enum ldlm_side client)
{ {
mutex_lock(ldlm_namespace_lock(client)); mutex_lock(ldlm_namespace_lock(client));
LASSERT(!list_empty(&ns->ns_list_chain)); LASSERT(!list_empty(&ns->ns_list_chain));
...@@ -1018,7 +1018,7 @@ void ldlm_namespace_put(struct ldlm_namespace *ns) ...@@ -1018,7 +1018,7 @@ void ldlm_namespace_put(struct ldlm_namespace *ns)
/** Should be called with ldlm_namespace_lock(client) taken. */ /** Should be called with ldlm_namespace_lock(client) taken. */
void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *ns, void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *ns,
ldlm_side_t client) enum ldlm_side client)
{ {
LASSERT(!list_empty(&ns->ns_list_chain)); LASSERT(!list_empty(&ns->ns_list_chain));
LASSERT(mutex_is_locked(ldlm_namespace_lock(client))); LASSERT(mutex_is_locked(ldlm_namespace_lock(client)));
...@@ -1027,7 +1027,7 @@ void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *ns, ...@@ -1027,7 +1027,7 @@ void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *ns,
/** Should be called with ldlm_namespace_lock(client) taken. */ /** Should be called with ldlm_namespace_lock(client) taken. */
void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *ns, void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *ns,
ldlm_side_t client) enum ldlm_side client)
{ {
LASSERT(!list_empty(&ns->ns_list_chain)); LASSERT(!list_empty(&ns->ns_list_chain));
LASSERT(mutex_is_locked(ldlm_namespace_lock(client))); LASSERT(mutex_is_locked(ldlm_namespace_lock(client)));
...@@ -1035,7 +1035,7 @@ void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *ns, ...@@ -1035,7 +1035,7 @@ void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *ns,
} }
/** Should be called with ldlm_namespace_lock(client) taken. */ /** Should be called with ldlm_namespace_lock(client) taken. */
struct ldlm_namespace *ldlm_namespace_first_locked(ldlm_side_t client) struct ldlm_namespace *ldlm_namespace_first_locked(enum ldlm_side client)
{ {
LASSERT(mutex_is_locked(ldlm_namespace_lock(client))); LASSERT(mutex_is_locked(ldlm_namespace_lock(client)));
LASSERT(!list_empty(ldlm_namespace_list(client))); LASSERT(!list_empty(ldlm_namespace_list(client)));
...@@ -1305,7 +1305,7 @@ void ldlm_res2desc(struct ldlm_resource *res, struct ldlm_resource_desc *desc) ...@@ -1305,7 +1305,7 @@ void ldlm_res2desc(struct ldlm_resource *res, struct ldlm_resource_desc *desc)
* Print information about all locks in all namespaces on this node to debug * Print information about all locks in all namespaces on this node to debug
* log. * log.
*/ */
void ldlm_dump_all_namespaces(ldlm_side_t client, int level) void ldlm_dump_all_namespaces(enum ldlm_side client, int level)
{ {
struct list_head *tmp; struct list_head *tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment