* 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.
*/
/*
* emulation + race with upcoming bl_ast. */
#define LDLM_FL_FAIL_LOC 0x100000000ULL
+/* Used while processing the unused list to know that we have already
+ * handled this lock and decided to skip it */
+#define LDLM_FL_SKIPPED 0x200000000ULL
+
/* The blocking callback is overloaded to perform two functions. These flags
* indicate which operation should be performed. */
#define LDLM_CB_BLOCKING 1
*/
cfs_atomic_t pl_cancel_rate;
/**
- * Grant speed (GR-CR) per T.
- */
- cfs_atomic_t pl_grant_speed;
- /**
* Server lock volume. Protected by pl_lock.
*/
__u64 pl_server_lock_volume;
void *req_cookie, ldlm_mode_t mode, int flags,
void *data);
+typedef int (*ldlm_cancel_for_recovery)(struct ldlm_lock *lock);
+
struct ldlm_valblock_ops {
int (*lvbo_init)(struct ldlm_resource *res);
int (*lvbo_update)(struct ldlm_resource *res,
struct ptlrpc_request *r,
int increase);
+ int (*lvbo_free)(struct ldlm_resource *res);
};
typedef enum {
struct obd_device *ns_obd;
struct adaptive_timeout ns_at_estimate;/* estimated lock callback time*/
+
+ /* callback to cancel locks before replaying it during recovery */
+ ldlm_cancel_for_recovery ns_cancel_for_recovery;
};
static inline int ns_is_client(struct ldlm_namespace *ns)
return !!(ns->ns_connect_flags & OBD_CONNECT_LRU_RESIZE);
}
+static inline void ns_register_cancel(struct ldlm_namespace *ns,
+ ldlm_cancel_for_recovery arg)
+{
+ LASSERT(ns != NULL);
+ ns->ns_cancel_for_recovery = arg;
+}
+
/*
*
* Resource hash table
* Protected by lock and resource locks.
*/
__u8 l_destroyed;
-
+ /**
+ * flag whether this is a server namespace lock
+ */
+ __u8 l_ns_srv;
/**
* If the lock is granted, a process sleeps on this waitq to learn when
* it's no longer in use. If the lock is not granted, a process sleeps
void *l_lvb_data;
void *l_ast_data;
- cfs_spinlock_t l_extents_list_lock;
- cfs_list_t l_extents_list;
-
- cfs_list_t l_cache_locks_list;
/*
* Server-side-only members.
/* protected by ns_hash_lock */
cfs_list_t lr_hash;
- struct ldlm_resource *lr_parent; /* 0 for a root resource */
- cfs_list_t lr_children; /* list head for child resources */
cfs_list_t lr_childof; /* part of ns_root_list if root res,
* part of lr_children if child */
cfs_spinlock_t lr_lock;
* List of references to this resource. For debugging.
*/
struct lu_ref lr_reference;
+
+ struct inode *lr_lvb_inode;
};
+static inline struct ldlm_namespace *
+ldlm_res_to_ns(struct ldlm_resource *res)
+{
+ return res->lr_namespace;
+}
+
+static inline struct ldlm_namespace *
+ldlm_lock_to_ns(struct ldlm_lock *lock)
+{
+ return ldlm_res_to_ns(lock->l_resource);
+}
+
+static inline char *
+ldlm_lock_to_ns_name(struct ldlm_lock *lock)
+{
+ return ldlm_lock_to_ns(lock)->ns_name;
+}
+
+static inline struct adaptive_timeout *
+ldlm_lock_to_ns_at(struct ldlm_lock *lock)
+{
+ return &ldlm_lock_to_ns(lock)->ns_at_estimate;
+}
+
struct ldlm_ast_work {
struct ldlm_lock *w_lock;
int w_blocking;
static inline int ldlm_res_lvbo_update(struct ldlm_resource *res,
struct ptlrpc_request *r, int increase)
{
- if (res->lr_namespace->ns_lvbo &&
- res->lr_namespace->ns_lvbo->lvbo_update) {
- return res->lr_namespace->ns_lvbo->lvbo_update(res, r,
- increase);
+ if (ldlm_res_to_ns(res)->ns_lvbo &&
+ ldlm_res_to_ns(res)->ns_lvbo->lvbo_update) {
+ return ldlm_res_to_ns(res)->ns_lvbo->lvbo_update(res, r,
+ increase);
}
return 0;
}
ldlm_policy_data_t *policy,
ldlm_mode_t mode, int lock_flags,
ldlm_cancel_flags_t cancel_flags, void *opaque);
+int ldlm_cli_cancel_list_local(cfs_list_t *cancels, int count,
+ ldlm_cancel_flags_t flags);
int ldlm_cli_cancel_list(cfs_list_t *head, int count,
struct ptlrpc_request *req, ldlm_cancel_flags_t flags);