#define LDLM_FL_REPLAY 0x000100
#define LDLM_FL_INTENT_ONLY 0x000200 /* don't grant lock, just do intent */
-#define LDLM_FL_LOCAL_ONLY 0x000400 /* see ldlm_cli_cancel_unused */
+#define LDLM_FL_LOCAL_ONLY 0x000400
/* don't run the cancel callback under ldlm_cli_cancel_unused */
#define LDLM_FL_FAILED 0x000800
#define LDLM_FL_HAS_INTENT 0x001000 /* lock request has intent */
#define LDLM_FL_CANCELING 0x002000 /* lock cancel has already been sent */
#define LDLM_FL_LOCAL 0x004000 /* local lock (ie, no srv/cli split) */
-#define LDLM_FL_WARN 0x008000 /* see ldlm_cli_cancel_unused */
+/* was LDLM_FL_WARN until 1.8.4 0x008000 */
#define LDLM_FL_DISCARD_DATA 0x010000 /* discard (no writeback) on cancel */
#define LDLM_FL_NO_TIMEOUT 0x020000 /* Blocked by group lock - wait
struct interval_node *lit_root; /* actually ldlm_interval */
};
+/* Cancel flag. */
+typedef enum {
+ /* LCF_ASYNC = 0x1 is used in 2.0 to cancel locks asynchronously. */
+ LCF_LOCAL = 0x2, /* Cancel locks locally, not notifing server */
+ LCF_BL_AST = 0x4, /* Cancel locks marked as LDLM_FL_BL_AST
+ * in the same RPC */
+} ldlm_cancel_flags_t;
+
struct ldlm_lock {
struct portals_handle l_handle; // must be first in the structure
atomic_t l_refc;
int ldlm_cli_update_pool(struct ptlrpc_request *req);
int ldlm_cli_cancel(struct lustre_handle *lockh);
int ldlm_cli_cancel_unused(struct ldlm_namespace *, struct ldlm_res_id *,
- int flags, void *opaque);
+ ldlm_cancel_flags_t flags, void *opaque);
int ldlm_cli_cancel_req(struct obd_export *exp,
struct list_head *head, int count);
int ldlm_cli_join_lru(struct ldlm_namespace *, struct ldlm_res_id *, int join);
int ldlm_cancel_resource_local(struct ldlm_resource *res,
struct list_head *cancels,
- ldlm_policy_data_t *policy, ldlm_mode_t mode,
- int lock_flags, int cancel_flags, void *opaque);
+ 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(struct list_head *head, int count,
struct ptlrpc_request *req, int off);
__u32 mode, struct lustre_handle *, int flags,
obd_off end);
int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
- int flags, void *opaque);
+ ldlm_cancel_flags_t flags, void *opaque);
int (*o_join_lru)(struct obd_export *, struct lov_stripe_md *,
int join);
int (*o_init_export)(struct obd_export *exp);
}
static inline int obd_cancel_unused(struct obd_export *exp,
- struct lov_stripe_md *ea, int flags,
+ struct lov_stripe_md *ea,
+ ldlm_cancel_flags_t flags,
void *opaque)
{
int rc;
int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, ldlm_sync_t sync,
int flags);
-int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
- int count, int max, int cancel_flags, int flags);
+int ldlm_cancel_lru_local(struct ldlm_namespace *ns,
+ struct list_head *cancels, int count, int max,
+ ldlm_cancel_flags_t cancel_flags, int flags);
extern int ldlm_enqueue_min;
int ldlm_get_enq_timeout(struct ldlm_lock *lock);
if (obd->obd_namespace != NULL) {
/* obd_force == local only */
ldlm_cli_cancel_unused(obd->obd_namespace, NULL,
- obd->obd_force ? LDLM_FL_LOCAL_ONLY:0,
- NULL);
+ obd->obd_force ? LCF_LOCAL : 0, NULL);
ldlm_namespace_free_prior(obd->obd_namespace, imp,
obd->obd_force);
}
flags = ns_connect_lru_resize(ns) ?
LDLM_CANCEL_LRUR : LDLM_CANCEL_AGED;
count += ldlm_cancel_lru_local(ns, &cancels, 0, avail - 1,
- LDLM_FL_BL_AST, flags);
+ LCF_BL_AST, flags);
}
ldlm_cli_cancel_list(&cancels, count, NULL, 0);
RETURN(0);
/* XXX until we will have compound requests and can cut cancels from generic rpc
* we need send cancels with LDLM_FL_BL_AST flag as separate rpc */
-static int ldlm_cancel_list(struct list_head *cancels, int count, int flags)
+static int ldlm_cancel_list(struct list_head *cancels, int count,
+ ldlm_cancel_flags_t flags)
{
CFS_LIST_HEAD(head);
struct ldlm_lock *lock, *next;
if (left-- == 0)
break;
- if (flags & LDLM_FL_LOCAL_ONLY) {
+ if (flags & LCF_LOCAL) {
rc = LDLM_FL_LOCAL_ONLY;
ldlm_lock_cancel(lock);
} else {
rc = ldlm_cli_cancel_local(lock);
}
- if (!(flags & LDLM_FL_BL_AST) && (rc == LDLM_FL_BL_AST)) {
+ if (!(flags & LCF_BL_AST) && (rc == LDLM_FL_BL_AST)) {
LDLM_DEBUG(lock, "Cancel lock separately");
list_del_init(&lock->l_bl_ast);
list_add(&lock->l_bl_ast, &head);
* outstanding rpc to complete
*/
int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
- int count, int max, int cancel_flags, int flags)
+ int count, int max, ldlm_cancel_flags_t cancel_flags,
+ int flags)
{
ldlm_cancel_lru_policy_t pf;
struct ldlm_lock *lock, *next;
struct list_head *cancels,
ldlm_policy_data_t *policy,
ldlm_mode_t mode, int lock_flags,
- int cancel_flags, void *opaque)
+ ldlm_cancel_flags_t cancel_flags, void *opaque)
{
struct ldlm_lock *lock;
int count = 0;
continue;
}
- if (lock->l_readers || lock->l_writers) {
- if (cancel_flags & LDLM_FL_WARN) {
- LDLM_ERROR(lock, "lock in use");
- //LBUG();
- }
+ if (lock->l_readers || lock->l_writers)
continue;
- }
/* If somebody is already doing CANCEL, or blocking ast came,
* skip this lock. */
static int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
struct ldlm_res_id res_id,
- int flags, void *opaque)
+ ldlm_cancel_flags_t flags,
+ void *opaque)
{
struct ldlm_resource *res;
CFS_LIST_HEAD(cancels);
/* Cancel all locks on a namespace (or a specific resource, if given)
* that have 0 readers/writers.
*
- * If flags & LDLM_FL_LOCAL_ONLY, throw the locks away without trying
+ * If flags & LCF_LOCAL, throw the locks away without trying
* to notify the server. */
int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
- struct ldlm_res_id *res_id, int flags, void *opaque)
+ struct ldlm_res_id *res_id,
+ ldlm_cancel_flags_t flags, void *opaque)
{
int i;
ENTRY;
}
static int lov_cancel_unused(struct obd_export *exp,
- struct lov_stripe_md *lsm, int flags, void *opaque)
+ struct lov_stripe_md *lsm,
+ ldlm_cancel_flags_t flags, void *opaque)
{
struct lov_obd *lov;
struct lov_oinfo *loi;
}
static int osc_cancel_unused(struct obd_export *exp,
- struct lov_stripe_md *lsm, int flags, void *opaque)
+ struct lov_stripe_md *lsm,
+ ldlm_cancel_flags_t flags,
+ void *opaque)
{
struct obd_device *obd = class_exp2obd(exp);
struct ldlm_res_id res_id, *resp = NULL;
}
if (!has) {
- int count = 1;
+ int count;
err:
+ count = 1;
dprintf("node"__S":%llu Child list:\n",
node->in_extent.start,
node->in_extent.end,
{
struct kid_t *kid;
char oname[10], ename[10];
- int thread = (long)threadvp, dev;
+ int thread = (long)threadvp, dev = 0;
int rc = 0, err;
if (o_verbose > 2)