* 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
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
* 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);