+#define LDLM_FL_LOCK_CHANGED 0x000001 /* extent, mode, or resource changed */
+
+/* If the server returns one of these flags, then the lock was put on that list.
+ * If the client sends one of these flags (during recovery ONLY!), it wants the
+ * lock added to the specified list, no questions asked. -p */
+#define LDLM_FL_BLOCK_GRANTED 0x000002
+#define LDLM_FL_BLOCK_CONV 0x000004
+#define LDLM_FL_BLOCK_WAIT 0x000008
+
+#define LDLM_FL_CBPENDING 0x000010 /* this lock is being destroyed */
+#define LDLM_FL_AST_SENT 0x000020 /* blocking or cancel packet was sent */
+#define LDLM_FL_WAIT_NOREPROC 0x000040 /* not a real flag, not saved in lock */
+#define LDLM_FL_CANCEL 0x000080 /* cancellation callback already run */
+
+/* Lock is being replayed. This could probably be implied by the fact that one
+ * of BLOCK_{GRANTED,CONV,WAIT} is set, but that is pretty dangerous. */
+#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 */
+
+/* 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 */
+#define LDLM_FL_DISCARD_DATA 0x010000 /* discard (no writeback) on cancel */
+#define LDLM_FL_CONFIG_CHANGE 0x020000 /* see ldlm_cli_cancel_unused */
+
+#define LDLM_FL_NO_TIMEOUT 0x040000 /* Blocked by group lock - wait
+ * indefinitely */
+
+/* file & record locking */
+#define LDLM_FL_BLOCK_NOWAIT 0x080000 /* server told not to wait if blocked */
+#define LDLM_FL_TEST_LOCK 0x100000 /* return blocking lock */
+#define LDLM_FL_GET_BLOCKING 0x200000 /* return updated blocking proc info */
+#define LDLM_FL_DEADLOCK_CHK 0x400000 /* check for deadlock */
+#define LDLM_FL_DEADLOCK_DEL 0x800000 /* lock no longer blocked */
+
+/* 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)
+
+/* XXX FIXME: This is being added to b_size as a low-risk fix to the fact that
+ * the LVB filling happens _after_ the lock has been granted, so another thread
+ * can match before the LVB has been updated. As a dirty hack, we set
+ * LDLM_FL_CAN_MATCH only after we've done the LVB poop.
+ *
+ * The proper fix is to do the granting inside of the completion AST, which can
+ * be replaced with a LVB-aware wrapping function for OSC locks. That change is
+ * pretty high-risk, though, and would need a lot more testing. */
+#define LDLM_FL_CAN_MATCH 0x100000
+
+/* A lock contributes to the kms calculation until it has finished the part
+ * of it's cancelation that performs write back on its dirty pages. It
+ * can remain on the granted list during this whole time. Threads racing
+ * to update the kms after performing their writeback need to know to
+ * exclude each others locks from the calculation as they walk the granted
+ * list. */
+#define LDLM_FL_KMS_IGNORE 0x200000
+
+/* completion ast to be executed */
+#define LDLM_FL_CP_REQD 0x400000
+
+/* cleanup_resource has already handled the lock */
+#define LDLM_FL_CLEANED 0x800000
+
+/* optimization hint: LDLM can run blocking callback from current context
+ * w/o involving separate thread. in order to decrease cs rate */
+#define LDLM_FL_ATOMIC_CB 0x1000000
+
+/* while this flag is set, the lock can't change resource */
+#define LDLM_FL_LOCK_PROTECT 0x4000000
+#define LDLM_FL_LOCK_PROTECT_BIT 26
+
+/* The blocking callback is overloaded to perform two functions. These flags
+ * indicate which operation should be performed. */