/* Flags flags inherited from parent lock when doing intents. */
#define LDLM_INHERIT_FLAGS (LDLM_FL_CANCEL_ON_BLOCK)
-/* These are flags that are mapped into the flags and ASTs of blocking locks */
-#define LDLM_AST_DISCARD_DATA 0x80000000 /* Add FL_DISCARD to blocking ASTs */
-/* Flags sent in AST lock_flags to be mapped into the receiving lock. */
-#define LDLM_AST_FLAGS (LDLM_FL_DISCARD_DATA)
-
/* completion ast to be executed */
#define LDLM_FL_CP_REQD 0x1000000
/* measure lock contention and return -EUSERS if locking contention is high */
#define LDLM_FL_DENY_ON_CONTENTION 0x40000000
+/* These are flags that are mapped into the flags and ASTs of blocking locks */
+#define LDLM_AST_DISCARD_DATA 0x80000000 /* Add FL_DISCARD to blocking ASTs */
+
+/* Flags sent in AST lock_flags to be mapped into the receiving lock. */
+#define LDLM_AST_FLAGS (LDLM_FL_DISCARD_DATA)
+
+/*
+ * --------------------------------------------------------------------------
+ * NOTE! Starting from this point, that is, LDLM_FL_* flags with values above
+ * 0x80000000 will not be sent over the wire.
+ * --------------------------------------------------------------------------
+ */
+
+/* Used for marking lock as an target for -EINTR while cp_ast sleep
+ * emulation + race with upcoming bl_ast. */
+#define LDLM_FL_FAIL_LOC 0x100000000ULL
+
/* The blocking callback is overloaded to perform two functions. These flags
* indicate which operation should be performed. */
#define LDLM_CB_BLOCKING 1
} ldlm_appetite_t;
/*
- * Default value for ->ns_shrink_thumb. If lock is not extent one its cost
- * is one page. Here we have 256 pages which is 1M on i386. Thus by default
- * all extent locks which have more than 1M long extent will be kept in lru,
- * others (including ibits locks) will be canceled on memory pressure event.
- */
-#define LDLM_LOCK_SHRINK_THUMB 256
-
-/*
* Default values for the "max_nolock_size", "contention_time" and
* "contended_locks" namespace tunables.
*/
unsigned int ns_ctime_age_limit;
/**
- * Lower limit to number of pages in lock to keep it in cache.
- */
- unsigned long ns_shrink_thumb;
-
- /**
* Next debug dump, jiffies.
*/
cfs_time_t ns_next_dump;
*
*/
-#define RES_HASH_BITS 10
+#define RES_HASH_BITS 12
#define RES_HASH_SIZE (1UL << RES_HASH_BITS)
#define RES_HASH_MASK (RES_HASH_SIZE - 1)
/*
* Protected by lr_lock. Various counters: readers, writers, etc.
*/
- __u32 l_flags;
+ __u64 l_flags;
__u32 l_readers;
__u32 l_writers;
/*
*/
cfs_waitq_t l_waitq;
- struct timeval l_enqueued_time;
+ /**
+ * Seconds. it will be updated if there is any activity related to
+ * the lock, e.g. enqueue the lock or send block AST.
+ */
+ cfs_time_t l_last_activity;
/**
* Jiffies. Should be converted to time if needed.
...)
__attribute__ ((format (printf, 4, 5)));
-#define LDLM_ERROR(lock, fmt, a...) do { \
+#define LDLM_DEBUG_LIMIT(mask, lock, fmt, a...) do { \
static cfs_debug_limit_state_t _ldlm_cdls; \
- ldlm_lock_debug(&_ldlm_cdls, D_ERROR, lock, \
+ ldlm_lock_debug(&_ldlm_cdls, mask, lock, \
__FILE__, __FUNCTION__, __LINE__, \
"### " fmt , ##a); \
} while (0)
+#define LDLM_ERROR(lock, fmt, a...) LDLM_DEBUG_LIMIT(D_ERROR, lock, fmt, ## a)
+#define LDLM_WARN(lock, fmt, a...) LDLM_DEBUG_LIMIT(D_WARNING, lock, fmt, ## a)
+
#define LDLM_DEBUG(lock, fmt, a...) do { \
ldlm_lock_debug(NULL, D_DLMTRACE, lock, \
__FILE__, __FUNCTION__, __LINE__, \
void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);
void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);
void ldlm_lock_allow_match(struct ldlm_lock *lock);
+void ldlm_lock_allow_match_locked(struct ldlm_lock *lock);
ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, int flags,
const struct ldlm_res_id *, ldlm_type_t type,
ldlm_policy_data_t *, ldlm_mode_t mode,