Whamcloud - gitweb
LU-1684 ldlm: move ldlm flags not sent through wire to upper 32bits
authorVitaly Fertman <vitaly_fertman@xyratex.com>
Mon, 22 Oct 2012 12:49:27 +0000 (16:49 +0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 6 Nov 2012 16:12:32 +0000 (11:12 -0500)
there is no empty bit for a LDLM_FL_* flag in lower 32bits, i.e. which needs
to be sent through wire. move locally used flags to upper 32bits to free some
bits.

Change-Id: Iddaff0a75b19d7311800d2ac6c3fef1012b9ffd2
Reviewed-by: Alexander Zarochentsev <Alexander_Zarochentsev@xyratex.com>
Reviewed-by: Andrew Perepechko <Andrew_Perepechko@xyratex.com>
Xyratex-Bug-ID: MRP-541
Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Reviewed-on: http://review.whamcloud.com/3494
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
38 files changed:
lustre/contrib/packet-lustre.c
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_dlm.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/include/obd_ost.h
lustre/ldlm/ldlm_extent.c
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_inodebits.c
lustre/ldlm/ldlm_internal.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_plain.c
lustre/ldlm/ldlm_request.c
lustre/ldlm/ldlm_resource.c
lustre/liblustre/llite_lib.h
lustre/liblustre/super.c
lustre/llite/file.c
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_internal.h
lustre/lmv/lmv_obd.c
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_locks.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_reint.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_handler.c
lustre/obdecho/echo.c
lustre/ofd/ofd_dlm.c
lustre/ofd/ofd_internal.h
lustre/ofd/ofd_obd.c
lustre/osc/osc_cl_internal.h
lustre/osc/osc_internal.h
lustre/osc/osc_lock.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/quota/qsd_request.c

index 5250364..6eeb495 100644 (file)
@@ -178,36 +178,19 @@ typedef enum {
 #define LDLM_FL_BLOCK_GRANTED                     0x000002
 #define LDLM_FL_BLOCK_CONV                        0x000004
 #define LDLM_FL_BLOCK_WAIT                        0x000008
-#define LDLM_FL_CBPENDING                         0x000010
 #define LDLM_FL_AST_SENT                          0x000020
-#define LDLM_FL_WAIT_NOREPROC                     0x000040
-#define LDLM_FL_CANCEL                            0x000080
 #define LDLM_FL_REPLAY                            0x000100
 #define LDLM_FL_INTENT_ONLY                       0x000200
-#define LDLM_FL_LOCAL_ONLY                        0x000400
-#define LDLM_FL_FAILED                            0x000800
 #define LDLM_FL_HAS_INTENT                        0x001000
-#define LDLM_FL_CANCELING                         0x002000
-#define LDLM_FL_LOCAL                             0x004000
-#define LDLM_FL_WARN                              0x008000
 #define LDLM_FL_DISCARD_DATA                      0x010000
 #define LDLM_FL_NO_TIMEOUT                        0x020000
 #define LDLM_FL_BLOCK_NOWAIT                      0x040000
 #define LDLM_FL_TEST_LOCK                         0x080000
-#define LDLM_FL_LVB_READY                         0x100000
-#define LDLM_FL_KMS_IGNORE                        0x200000
-#define LDLM_FL_NO_LRU                            0x400000
 #define LDLM_FL_CANCEL_ON_BLOCK                   0x800000
-#define LDLM_FL_CP_REQD                          0x1000000
-#define LDLM_FL_CLEANED                          0x2000000
-#define LDLM_FL_ATOMIC_CB                        0x4000000
-#define LDLM_FL_BL_AST                          0x10000000
-#define LDLM_FL_BL_DONE                         0x20000000
 #define LDLM_FL_DENY_ON_CONTENTION              0x40000000
 #define LDLM_AST_DISCARD_DATA                   0x80000000
 
 
-
 #define LDLM_ENQUEUE (101)
 #define LDLM_CONVERT (102)
 #define LDLM_CANCEL (103)
@@ -975,31 +958,15 @@ const value_string lustre_ldlm_flags_vals[] = {
   {0x000002 , "LDLM_FL_BLOCK_GRANTED"},
   {0x000004 , "LDLM_FL_BLOCK_CONV"},
   {0x000008 , "LDLM_FL_BLOCK_WAIT"},
-  {0x000010 , "LDLM_FL_CBPENDING"},
   {0x000020 , "LDLM_FL_AST_SENT"},
-  {0x000040 , "LDLM_FL_WAIT_NOREPROC"},
-  {0x000080 , "LDLM_FL_CANCEL"},
   {0x000100 , "LDLM_FL_REPLAY"},
   {0x000200 , "LDLM_FL_INTENT_ONLY"},
-  {0x000400 , "LDLM_FL_LOCAL_ONLY"},
-  {0x000800 , "LDLM_FL_FAILED"},
   {0x001000 , "LDLM_FL_HAS_INTENT"},
-  {0x002000 , "LDLM_FL_CANCELING"},
-  {0x004000 , "LDLM_FL_LOCAL"},
-  {0x008000 , "LDLM_FL_WARN"},
   {0x010000 , "LDLM_FL_DISCARD_DATA"},
   {0x020000 , "LDLM_FL_NO_TIMEOUT"},
   {0x040000 , "LDLM_FL_BLOCK_NOWAIT"},
   {0x080000 , "LDLM_FL_TEST_LOCK"},
-  {0x100000 , "LDLM_FL_LVB_READY"},
-  {0x200000 , "LDLM_FL_KMS_IGNORE"},
-  {0x400000 , "LDLM_FL_NO_LRU"},
   {0x800000 , "LDLM_FL_CANCEL_ON_BLOCK"},
-  {0x1000000 , "LDLM_FL_CP_REQD"},
-  {0x2000000 , "LDLM_FL_CLEANED"},
-  {0x4000000 , "LDLM_FL_ATOMIC_CB"},
-  {0x10000000 , "LDLM_FL_BL_AST"},
-  {0x20000000 , "LDLM_FL_BL_DONE"},
   {0x40000000 , "LDLM_FL_DENY_ON_CONTENTION"},
   {0x80000000 , "LDLM_AST_DISCARD_DATA"},
   { 0, NULL }
@@ -10027,31 +9994,15 @@ void proto_register_dcerpc_lustre(void)
     {&hf_lustre_ldlm_fl_block_granted, {"LDLM_FL_BLOCK_GRANTED", "lustre.ldlm_fl_block_granted", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_BLOCK_GRANTED, "", HFILL}},
     {&hf_lustre_ldlm_fl_block_conv, {"LDLM_FL_BLOCK_CONV", "lustre.ldlm_fl_block_conv", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_BLOCK_CONV, "", HFILL}},
     {&hf_lustre_ldlm_fl_block_wait, {"LDLM_FL_BLOCK_WAIT", "lustre.ldlm_fl_block_wait", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_BLOCK_WAIT, "", HFILL}},
-    {&hf_lustre_ldlm_fl_cbpending, {"LDLM_FL_CBPENDING", "lustre.ldlm_fl_cbpending", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_CBPENDING, "", HFILL}},
     {&hf_lustre_ldlm_fl_ast_sent, {"LDLM_FL_AST_SENT", "lustre.ldlm_fl_ast_sent", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_AST_SENT, "", HFILL}},
-    {&hf_lustre_ldlm_fl_wait_noreproc, {"LDLM_FL_WAIT_NOREPROC", "lustre.ldlm_fl_wait_noreproc", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_WAIT_NOREPROC, "", HFILL}},
-    {&hf_lustre_ldlm_fl_cancel, {"LDLM_FL_CANCEL", "lustre.ldlm_fl_cancel", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_CANCEL, "", HFILL}},
     {&hf_lustre_ldlm_fl_replay, {"LDLM_FL_REPLAY", "lustre.ldlm_fl_replay", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_REPLAY, "", HFILL}},
     {&hf_lustre_ldlm_fl_intent_only, {"LDLM_FL_INTENT_ONLY", "lustre.ldlm_fl_intent_only", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_INTENT_ONLY, "", HFILL}},
-    {&hf_lustre_ldlm_fl_local_only, {"LDLM_FL_LOCAL_ONLY", "lustre.ldlm_fl_local_only", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_LOCAL_ONLY, "", HFILL}},
-    {&hf_lustre_ldlm_fl_failed, {"LDLM_FL_FAILED", "lustre.ldlm_fl_failed", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_FAILED, "", HFILL}},
     {&hf_lustre_ldlm_fl_has_intent, {"LDLM_FL_HAS_INTENT", "lustre.ldlm_fl_has_intent", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_HAS_INTENT, "", HFILL}},
-    {&hf_lustre_ldlm_fl_canceling, {"LDLM_FL_CANCELING", "lustre.ldlm_fl_canceling", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_CANCELING, "", HFILL}},
-    {&hf_lustre_ldlm_fl_local, {"LDLM_FL_LOCAL", "lustre.ldlm_fl_local", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_LOCAL, "", HFILL}},
-    {&hf_lustre_ldlm_fl_warn, {"LDLM_FL_WARN", "lustre.ldlm_fl_warn", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_WARN, "", HFILL}},
     {&hf_lustre_ldlm_fl_discard_data, {"LDLM_FL_DISCARD_DATA", "lustre.ldlm_fl_discard_data", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_DISCARD_DATA, "", HFILL}},
     {&hf_lustre_ldlm_fl_no_timeout, {"LDLM_FL_NO_TIMEOUT", "lustre.ldlm_fl_no_timeout", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_NO_TIMEOUT, "", HFILL}},
     {&hf_lustre_ldlm_fl_block_nowait, {"LDLM_FL_BLOCK_NOWAIT", "lustre.ldlm_fl_block_nowait", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_BLOCK_NOWAIT, "", HFILL}},
     {&hf_lustre_ldlm_fl_test_lock, {"LDLM_FL_TEST_LOCK", "lustre.ldlm_fl_test_lock", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_TEST_LOCK, "", HFILL}},
-    {&hf_lustre_ldlm_fl_lvb_ready, {"LDLM_FL_LVB_READY", "lustre.ldlm_fl_lvb_ready", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_LVB_READY, "", HFILL}},
-    {&hf_lustre_ldlm_fl_kms_ignore, {"LDLM_FL_KMS_IGNORE", "lustre.ldlm_fl_kms_ignore", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_KMS_IGNORE, "", HFILL}},
-    {&hf_lustre_ldlm_fl_no_lru, {"LDLM_FL_NO_LRU", "lustre.ldlm_fl_no_lru", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_NO_LRU, "", HFILL}},
     {&hf_lustre_ldlm_fl_cancel_on_block, {"LDLM_FL_CANCEL_ON_BLOCK", "lustre.ldlm_fl_cancel_on_block", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_CANCEL_ON_BLOCK, "", HFILL}},
-    {&hf_lustre_ldlm_fl_cp_reqd, {"LDLM_FL_CP_REQD", "lustre.ldlm_fl_cp_reqd", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_CP_REQD, "", HFILL}},
-    {&hf_lustre_ldlm_fl_cleaned, {"LDLM_FL_CLEANED", "lustre.ldlm_fl_cleaned", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_CLEANED, "", HFILL}},
-    {&hf_lustre_ldlm_fl_atomic_cb, {"LDLM_FL_ATOMIC_CB", "lustre.ldlm_fl_atomic_cb", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_ATOMIC_CB, "", HFILL}},
-    {&hf_lustre_ldlm_fl_bl_ast, {"LDLM_FL_BL_AST", "lustre.ldlm_fl_bl_ast", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_BL_AST, "", HFILL}},
-    {&hf_lustre_ldlm_fl_bl_done, {"LDLM_FL_BL_DONE", "lustre.ldlm_fl_bl_done", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_BL_DONE, "", HFILL}},
     {&hf_lustre_ldlm_fl_deny_on_contention, {"LDLM_FL_DENY_ON_CONTENTION", "lustre.ldlm_fl_deny_on_contention", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_FL_DENY_ON_CONTENTION, "", HFILL}},
     {&hf_lustre_ldlm_ast_discard_data, {"LDLM_AST_DISCARD_DATA", "lustre.ldlm_ast_discard_data", FT_BOOLEAN, 32, TFS(&flags_set_truth), LDLM_AST_DISCARD_DATA, "", HFILL}},
 
index 4fdbe67..6b75347 100644 (file)
@@ -2564,6 +2564,9 @@ struct ldlm_reply {
 
 extern void lustre_swab_ldlm_reply (struct ldlm_reply *r);
 
+#define ldlm_flags_to_wire(flags)    ((__u32)(flags))
+#define ldlm_flags_from_wire(flags)  ((__u64)(flags))
+
 /*
  * Opcodes for mountconf (mgs and mgc)
  */
index 2420817..b845b4c 100644 (file)
@@ -91,6 +91,9 @@ typedef enum {
         LDLM_NAMESPACE_CLIENT = 1 << 1
 } ldlm_side_t;
 
+/**
+ * Declaration of flags sent through the wire.
+ **/
 #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.
@@ -100,25 +103,27 @@ typedef enum {
 #define LDLM_FL_BLOCK_CONV     0x000004
 #define LDLM_FL_BLOCK_WAIT     0x000008
 
-#define LDLM_FL_CBPENDING      0x000010 /* this lock is being destroyed */
+/* Used to be LDLM_FL_CBPENDING 0x000010 moved to non-wire flags */
+
 #define LDLM_FL_AST_SENT       0x000020 /* blocking or cancel packet was
                                          * queued for sending. */
-#define LDLM_FL_WAIT_NOREPROC  0x000040 /* not a real flag, not saved in lock */
-#define LDLM_FL_CANCEL         0x000080 /* cancellation callback already run */
+/* Used to be LDLM_FL_WAIT_NOREPROC 0x000040   moved to non-wire flags */
+/* Used to be LDLM_FL_CANCEL        0x000080   moved to non-wire flags */
 
 /* 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
 
-/* don't run the cancel callback under ldlm_cli_cancel_unused */
-#define LDLM_FL_FAILED         0x000800
+/* Used to be LDLM_FL_LOCAL_ONLY 0x000400  moved to non-wire flags */
+/* Used to be LDLM_FL_FAILED     0x000800  moved to non-wire flags */
 
 #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) */
+
+/* Used to be LDLM_FL_CANCELING  0x002000  moved to non-wire flags */
+/* Used to be LDLM_FL_LOCAL      0x004000  moved to non-wire flags */
+
 #define LDLM_FL_DISCARD_DATA   0x010000 /* discard (no writeback) on cancel */
 
 #define LDLM_FL_NO_TIMEOUT     0x020000 /* Blocked by group lock - wait
@@ -130,30 +135,9 @@ typedef enum {
                                          * callback. */
 #define LDLM_FL_TEST_LOCK      0x080000 // return blocking lock
 
-/* 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`t before the LVB has been updated.  As a dirty hack, we set
- * LDLM_FL_LVB_READY only after we've done the LVB poop.
- * this is only needed on lov/osc now, where lvb is actually used and callers
- * must set it in input flags.
- *
- * 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_LVB_READY      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
-
-/* Don't put lock into the LRU list, so that it is not canceled due to aging.
- * Used by MGC locks, they are cancelled only at unmount or by callback. */
-#define LDLM_FL_NO_LRU         0x400000
+/* Used to be LDLM_FL_LVB_READY  0x100000 moved to non-wire flags */
+/* Used to be LDLM_FL_KMS_IGNORE 0x200000 moved to non-wire flags */
+/* Used to be LDLM_FL_NO_LRU     0x400000 moved to non-wire flags */
 
 /* Immediatelly cancel such locks when they block some other locks. Send
  * cancel notification to original lock holder, but expect no reply. This is
@@ -164,28 +148,11 @@ typedef enum {
 /* Flags flags inherited from parent lock when doing intents. */
 #define LDLM_INHERIT_FLAGS     (LDLM_FL_CANCEL_ON_BLOCK)
 
-/* completion ast to be executed */
-#define LDLM_FL_CP_REQD        0x1000000
-
-/* cleanup_resource has already handled the lock */
-#define LDLM_FL_CLEANED        0x2000000
-
-/* 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      0x4000000
-
-/* It may happen that a client initiate 2 operations, e.g. unlink and mkdir,
- * such that server send blocking ast for conflict locks to this client for
- * the 1st operation, whereas the 2nd operation has canceled this lock and
- * is waiting for rpc_lock which is taken by the 1st operation.
- * LDLM_FL_BL_AST is to be set by ldlm_callback_handler() to the lock not allow
- * ELC code to cancel it.
- * LDLM_FL_BL_DONE is to be set by ldlm_cancel_callback() when lock cache is
- * droped to let ldlm_callback_handler() return EINVAL to the server. It is
- * used when ELC rpc is already prepared and is waiting for rpc_lock, too late
- * to send a separate CANCEL rpc. */
-#define LDLM_FL_BL_AST          0x10000000
-#define LDLM_FL_BL_DONE         0x20000000
+/* Used to be LDLM_FL_CP_REQD        0x1000000 moved to non-wire flags */
+/* Used to be LDLM_FL_CLEANED        0x2000000 moved to non-wire flags */
+/* Used to be LDLM_FL_ATOMIC_CB      0x4000000 moved to non-wire flags */
+/* Used to be LDLM_FL_BL_AST         0x10000000 moved to non-wire flags */
+/* Used to be LDLM_FL_BL_DONE        0x20000000 moved to non-wire flags */
 
 /* measure lock contention and return -EUSERS if locking contention is high */
 #define LDLM_FL_DENY_ON_CONTENTION 0x40000000
@@ -196,20 +163,76 @@ typedef enum {
 /* 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.
  * --------------------------------------------------------------------------
  */
 
+/**
+ * Declaration of flags not sent through 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
-
 /* 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
+/* this lock is being destroyed */
+#define LDLM_FL_CBPENDING      0x400000000ULL
+/* not a real flag, not saved in lock */
+#define LDLM_FL_WAIT_NOREPROC  0x800000000ULL
+/* cancellation callback already run */
+#define LDLM_FL_CANCEL         0x1000000000ULL
+#define LDLM_FL_LOCAL_ONLY     0x2000000000ULL
+/* don't run the cancel callback under ldlm_cli_cancel_unused */
+#define LDLM_FL_FAILED         0x4000000000ULL
+/* lock cancel has already been sent */
+#define LDLM_FL_CANCELING      0x8000000000ULL
+/* local lock (ie, no srv/cli split) */
+#define LDLM_FL_LOCAL          0x10000000000ULL
+/* 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`t before the LVB has been updated.  As a dirty hack, we set
+ * LDLM_FL_LVB_READY only after we've done the LVB poop.
+ * this is only needed on lov/osc now, where lvb is actually used and callers
+ * must set it in input flags.
+ *
+ * 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_LVB_READY      0x20000000000ULL
+/* 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     0x40000000000ULL
+/* completion ast to be executed */
+#define LDLM_FL_CP_REQD        0x80000000000ULL
+/* cleanup_resource has already handled the lock */
+#define LDLM_FL_CLEANED        0x100000000000ULL
+/* 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      0x200000000000ULL
+/* It may happen that a client initiate 2 operations, e.g. unlink and mkdir,
+ * such that server send blocking ast for conflict locks to this client for
+ * the 1st operation, whereas the 2nd operation has canceled this lock and
+ * is waiting for rpc_lock which is taken by the 1st operation.
+ * LDLM_FL_BL_AST is to be set by ldlm_callback_handler() to the lock not allow
+ * ELC code to cancel it.
+ * LDLM_FL_BL_DONE is to be set by ldlm_cancel_callback() when lock cache is
+ * droped to let ldlm_callback_handler() return EINVAL to the server. It is
+ * used when ELC rpc is already prepared and is waiting for rpc_lock, too late
+ * to send a separate CANCEL rpc. */
+#define LDLM_FL_BL_AST          0x400000000000ULL
+#define LDLM_FL_BL_DONE         0x800000000000ULL
+/* Don't put lock into the LRU list, so that it is not canceled due to aging.
+ * Used by MGC locks, they are cancelled only at unmount or by callback. */
+#define LDLM_FL_NO_LRU         0x1000000000000ULL
+
 
 /* The blocking callback is overloaded to perform two functions.  These flags
  * indicate which operation should be performed. */
@@ -369,8 +392,8 @@ struct ldlm_pool {
 };
 
 typedef int (*ldlm_res_policy)(struct ldlm_namespace *, struct ldlm_lock **,
-                               void *req_cookie, ldlm_mode_t mode, int flags,
-                               void *data);
+                              void *req_cookie, ldlm_mode_t mode, __u64 flags,
+                              void *data);
 
 typedef int (*ldlm_cancel_for_recovery)(struct ldlm_lock *lock);
 
@@ -567,8 +590,8 @@ struct ldlm_lock;
 typedef int (*ldlm_blocking_callback)(struct ldlm_lock *lock,
                                       struct ldlm_lock_desc *new, void *data,
                                       int flag);
-typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, int flags,
-                                        void *data);
+typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, __u64 flags,
+                                       void *data);
 typedef int (*ldlm_glimpse_callback)(struct ldlm_lock *lock, void *data);
 typedef unsigned long (*ldlm_weigh_callback)(struct ldlm_lock *lock);
 
@@ -998,7 +1021,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 #define LDLM_DEBUG_NOLOCK(format, a...)                 \
         CDEBUG(D_DLMTRACE, "### " format "\n" , ##a)
 
-typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, int *flags,
+typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, __u64 *flags,
                                       int first_enq, ldlm_error_t *err,
                                       cfs_list_t *work_list);
 
@@ -1022,7 +1045,7 @@ int ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *,
                            ldlm_iterator_t iter, void *data);
 
 /* ldlm_flock.c */
-int ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data);
+int ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data);
 
 /* ldlm_extent.c */
 __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms);
@@ -1038,7 +1061,7 @@ struct ldlm_callback_suite {
 #ifdef HAVE_SERVER_SUPPORT
 int ldlm_server_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
                              void *data, int flag);
-int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data);
+int ldlm_server_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data);
 int ldlm_server_glimpse_ast(struct ldlm_lock *lock, void *data);
 int ldlm_glimpse_locks(struct ldlm_resource *res, cfs_list_t *gl_work_list);
 int ldlm_handle_enqueue(struct ptlrpc_request *req, ldlm_completion_callback,
@@ -1069,7 +1092,7 @@ ldlm_processing_policy ldlm_get_processing_policy(struct ldlm_resource *res);
 void ldlm_register_intent(struct ldlm_namespace *ns, ldlm_res_policy arg);
 void ldlm_lock2handle(const struct ldlm_lock *lock,
                       struct lustre_handle *lockh);
-struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, int flags);
+struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, __u64 flags);
 void ldlm_cancel_callback(struct ldlm_lock *);
 int ldlm_lock_remove_from_lru(struct ldlm_lock *);
 int ldlm_lock_set_data(struct lustre_handle *, void *);
@@ -1083,7 +1106,7 @@ static inline struct ldlm_lock *ldlm_handle2lock(const struct lustre_handle *h)
         lu_ref_del(&lock->l_reference, "handle", cfs_current())
 
 static inline struct ldlm_lock *
-ldlm_handle2lock_long(const struct lustre_handle *h, int flags)
+ldlm_handle2lock_long(const struct lustre_handle *h, __u64 flags)
 {
         struct ldlm_lock *lock;
 
@@ -1164,7 +1187,7 @@ void ldlm_lock_fail_match_locked(struct ldlm_lock *lock);
 void ldlm_lock_fail_match(struct ldlm_lock *lock);
 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,
+ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
                             const struct ldlm_res_id *, ldlm_type_t type,
                             ldlm_policy_data_t *, ldlm_mode_t mode,
                             struct lustre_handle *, int unref);
@@ -1184,7 +1207,7 @@ struct ldlm_namespace *
 ldlm_namespace_new(struct obd_device *obd, char *name,
                    ldlm_side_t client, ldlm_appetite_t apt,
                    ldlm_ns_type_t ns_type);
-int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int flags);
+int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags);
 void ldlm_namespace_free(struct ldlm_namespace *ns,
                          struct obd_import *imp, int force);
 void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client);
@@ -1232,12 +1255,12 @@ int ldlm_blocking_ast_nocheck(struct ldlm_lock *lock);
 int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
                       void *data, int flag);
 int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp);
-int ldlm_completion_ast_async(struct ldlm_lock *lock, int flags, void *data);
-int ldlm_completion_ast(struct ldlm_lock *lock, int flags, void *data);
+int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data);
+int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data);
 int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
                      struct ldlm_enqueue_info *einfo,
                      const struct ldlm_res_id *res_id,
-                     ldlm_policy_data_t const *policy, int *flags,
+                    ldlm_policy_data_t const *policy, __u64 *flags,
                      void *lvb, __u32 lvb_len, struct lustre_handle *lockh,
                      int async);
 int ldlm_prep_enqueue_req(struct obd_export *exp,
@@ -1250,12 +1273,12 @@ int ldlm_prep_elc_req(struct obd_export *exp,
                       cfs_list_t *cancels, int count);
 int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                           ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode,
-                          int *flags, void *lvb, __u32 lvb_len,
+                         __u64 *flags, void *lvb, __u32 lvb_len,
                           struct lustre_handle *lockh, int rc);
 int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
                            const struct ldlm_res_id *res_id,
                            ldlm_type_t type, ldlm_policy_data_t *policy,
-                           ldlm_mode_t mode, int *flags,
+                          ldlm_mode_t mode, __u64 *flags,
                            ldlm_blocking_callback blocking,
                            ldlm_completion_callback completion,
                            ldlm_glimpse_callback glimpse,
index c5fc083..4725f1a 100644 (file)
@@ -150,7 +150,7 @@ struct obd_info {
            - while stats, the flags used for control delay/resend.
            - while setattr, the flags used for distinguish punch operation
          */
-        int                     oi_flags;
+       __u64                   oi_flags;
         /* Lock handle specific for every OSC lock. */
         struct lustre_handle   *oi_lockh;
         /* lsm data specific for every OSC. */
@@ -1578,7 +1578,7 @@ struct md_ops {
         int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *,
                          struct lookup_intent *, struct md_op_data *,
                          struct lustre_handle *, void *, int,
-                         struct ptlrpc_request **, int);
+                        struct ptlrpc_request **, __u64);
         int (*m_getattr)(struct obd_export *, struct md_op_data *,
                          struct ptlrpc_request **);
         int (*m_getattr_name)(struct obd_export *, struct md_op_data *,
@@ -1586,7 +1586,7 @@ struct md_ops {
         int (*m_intent_lock)(struct obd_export *, struct md_op_data *,
                              void *, int, struct lookup_intent *, int,
                              struct ptlrpc_request **,
-                             ldlm_blocking_callback, int);
+                            ldlm_blocking_callback, __u64);
         int (*m_link)(struct obd_export *, struct md_op_data *,
                       struct ptlrpc_request **);
         int (*m_rename)(struct obd_export *, struct md_op_data *,
@@ -1631,7 +1631,7 @@ struct md_ops {
                                         struct obd_client_handle *);
         int (*m_set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *);
 
-        ldlm_mode_t (*m_lock_match)(struct obd_export *, int,
+       ldlm_mode_t (*m_lock_match)(struct obd_export *, __u64,
                                     const struct lu_fid *, ldlm_type_t,
                                     ldlm_policy_data_t *, ldlm_mode_t,
                                     struct lustre_handle *);
index c22caa8..2bcbd90 100644 (file)
@@ -1960,18 +1960,18 @@ static inline int md_getattr_name(struct obd_export *exp,
 }
 
 static inline int md_intent_lock(struct obd_export *exp,
-                                 struct md_op_data *op_data, void *lmm,
-                                 int lmmsize, struct lookup_intent *it,
-                                 int flags, struct ptlrpc_request **reqp,
-                                 ldlm_blocking_callback cb_blocking,
-                                 int extra_lock_flags)
+                                struct md_op_data *op_data, void *lmm,
+                                int lmmsize, struct lookup_intent *it,
+                                int lookup_flags, struct ptlrpc_request **reqp,
+                                ldlm_blocking_callback cb_blocking,
+                                __u64 extra_lock_flags)
 {
         int rc;
         ENTRY;
         EXP_CHECK_MD_OP(exp, intent_lock);
         EXP_MD_COUNTER_INCREMENT(exp, intent_lock);
         rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, lmm, lmmsize,
-                                            it, flags, reqp, cb_blocking,
+                                            it, lookup_flags, reqp, cb_blocking,
                                             extra_lock_flags);
         RETURN(rc);
 }
@@ -2158,7 +2158,7 @@ static inline int md_cancel_unused(struct obd_export *exp,
         RETURN(rc);
 }
 
-static inline ldlm_mode_t md_lock_match(struct obd_export *exp, int flags,
+static inline ldlm_mode_t md_lock_match(struct obd_export *exp, __u64 flags,
                                         const struct lu_fid *fid,
                                         ldlm_type_t type,
                                         ldlm_policy_data_t *policy,
index 761d780..faea730 100644 (file)
@@ -78,7 +78,7 @@ struct osc_fsync_args {
 
 struct osc_enqueue_args {
         struct obd_export        *oa_exp;
-        int                      *oa_flags;
+       __u64                    *oa_flags;
         obd_enqueue_update_f      oa_upcall;
         void                     *oa_cookie;
         struct ost_lvb           *oa_lvb;
index 2ddf2f7..af72b2f 100644 (file)
@@ -252,7 +252,7 @@ ldlm_extent_internal_policy_waiting(struct ldlm_lock *req,
 /* In order to determine the largest possible extent we can grant, we need
  * to scan all of the queues. */
 static void ldlm_extent_policy(struct ldlm_resource *res,
-                               struct ldlm_lock *lock, int *flags)
+                              struct ldlm_lock *lock, __u64 *flags)
 {
         struct ldlm_extent new_ex = { .start = 0, .end = OBD_OBJECT_EOF };
 
@@ -353,8 +353,8 @@ static enum interval_iter ldlm_extent_compat_cb(struct interval_node *n,
  */
 static int
 ldlm_extent_compat_queue(cfs_list_t *queue, struct ldlm_lock *req,
-                         int *flags, ldlm_error_t *err,
-                         cfs_list_t *work_list, int *contended_locks)
+                        __u64 *flags, ldlm_error_t *err,
+                        cfs_list_t *work_list, int *contended_locks)
 {
         cfs_list_t *tmp;
         struct ldlm_lock *lock;
@@ -641,8 +641,9 @@ static void discard_bl_list(cfs_list_t *bl_list)
   * If first_enq is 1 (ie, called from ldlm_lock_enqueue):
   *   - blocking ASTs have not been sent
   *   - must call this function with the ns lock held once */
-int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
-                             ldlm_error_t *err, cfs_list_t *work_list)
+int ldlm_process_extent_lock(struct ldlm_lock *lock, __u64 *flags,
+                            int first_enq, ldlm_error_t *err,
+                            cfs_list_t *work_list)
 {
         struct ldlm_resource *res = lock->l_resource;
         CFS_LIST_HEAD(rpc_list);
index 3d312f0..f69c80c 100644 (file)
@@ -129,14 +129,14 @@ static inline void ldlm_flock_blocking_unlink(struct ldlm_lock *req)
 }
 
 static inline void
-ldlm_flock_destroy(struct ldlm_lock *lock, ldlm_mode_t mode, int flags)
+ldlm_flock_destroy(struct ldlm_lock *lock, ldlm_mode_t mode, __u64 flags)
 {
         ENTRY;
 
-        LDLM_DEBUG(lock, "ldlm_flock_destroy(mode: %d, flags: 0x%x)",
-                   mode, flags);
+       LDLM_DEBUG(lock, "ldlm_flock_destroy(mode: %d, flags: 0x%llx)",
+                  mode, flags);
 
-        /* Safe to not lock here, since it should be empty anyway */
+       /* Safe to not lock here, since it should be empty anyway */
        LASSERT(cfs_hlist_unhashed(&lock->l_exp_flock_hash));
 
         cfs_list_del_init(&lock->l_res_link);
@@ -198,8 +198,8 @@ ldlm_flock_deadlock(struct ldlm_lock *req, struct ldlm_lock *bl_lock)
 }
 
 int
-ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
-                        ldlm_error_t *err, cfs_list_t *work_list)
+ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq,
+                       ldlm_error_t *err, cfs_list_t *work_list)
 {
         struct ldlm_resource *res = req->l_resource;
         struct ldlm_namespace *ns = ldlm_res_to_ns(res);
@@ -217,8 +217,9 @@ ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
        int rc;
         ENTRY;
 
-        CDEBUG(D_DLMTRACE, "flags %#x owner "LPU64" pid %u mode %u start "LPU64
-               " end "LPU64"\n", *flags, new->l_policy_data.l_flock.owner,
+       CDEBUG(D_DLMTRACE, "flags %#llx owner "LPU64" pid %u mode %u start "
+              LPU64" end "LPU64"\n", *flags,
+              new->l_policy_data.l_flock.owner,
                new->l_policy_data.l_flock.pid, mode,
                req->l_policy_data.l_flock.start,
                req->l_policy_data.l_flock.end);
@@ -560,7 +561,7 @@ ldlm_flock_interrupted_wait(void *data)
  * \retval <0   : failure
  */
 int
-ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data)
+ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
 {
         cfs_flock_t                    *getlk = lock->l_ast_data;
         struct obd_device              *obd;
@@ -571,7 +572,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data)
         int                             rc = 0;
         ENTRY;
 
-        CDEBUG(D_DLMTRACE, "flags: 0x%x data: %p getlk: %p\n",
+       CDEBUG(D_DLMTRACE, "flags: 0x%llx data: %p getlk: %p\n",
                flags, data, getlk);
 
         /* Import invalidation. We need to actually release the lock
@@ -680,7 +681,7 @@ granted:
                 cfs_flock_set_end(getlk,
                                   (loff_t)lock->l_policy_data.l_flock.end);
         } else {
-                int noreproc = LDLM_FL_WAIT_NOREPROC;
+               __u64 noreproc = LDLM_FL_WAIT_NOREPROC;
 
                 /* We need to reprocess the lock to do merges or splits
                  * with existing locks owned by this process. */
index 1cc1d05..17d9b71 100644 (file)
@@ -141,7 +141,7 @@ ldlm_inodebits_compat_queue(cfs_list_t *queue, struct ldlm_lock *req,
   * If first_enq is 1 (ie, called from ldlm_lock_enqueue):
   *   - blocking ASTs have not been sent
   *   - must call this function with the ns lock held once */
-int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
+int ldlm_process_inodebits_lock(struct ldlm_lock *lock, __u64 *flags,
                                 int first_enq, ldlm_error_t *err,
                                 cfs_list_t *work_list)
 {
index c6265f7..b2ca20d 100644 (file)
@@ -116,7 +116,7 @@ ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *,
                  const struct ldlm_callback_suite *cbs,
                  void *data, __u32 lvb_len);
 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **,
-                               void *cookie, int *flags);
+                              void *cookie, __u64 *flags);
 void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode);
 void ldlm_lock_addref_internal_nolock(struct ldlm_lock *, __u32 mode);
 void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode);
@@ -150,26 +150,29 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
 
 #ifdef HAVE_SERVER_SUPPORT
 /* ldlm_plain.c */
-int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
-                            ldlm_error_t *err, cfs_list_t *work_list);
+int ldlm_process_plain_lock(struct ldlm_lock *lock, __u64 *flags,
+                           int first_enq, ldlm_error_t *err,
+                           cfs_list_t *work_list);
 
 /* ldlm_inodebits.c */
-int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
+int ldlm_process_inodebits_lock(struct ldlm_lock *lock, __u64 *flags,
                                 int first_enq, ldlm_error_t *err,
                                 cfs_list_t *work_list);
 #endif
 
 /* ldlm_extent.c */
 #ifdef HAVE_SERVER_SUPPORT
-int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
-                             ldlm_error_t *err, cfs_list_t *work_list);
+int ldlm_process_extent_lock(struct ldlm_lock *lock, __u64 *flags,
+                            int first_enq, ldlm_error_t *err,
+                            cfs_list_t *work_list);
 #endif
 void ldlm_extent_add_lock(struct ldlm_resource *res, struct ldlm_lock *lock);
 void ldlm_extent_unlink_lock(struct ldlm_lock *lock);
 
 /* ldlm_flock.c */
-int ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
-                            ldlm_error_t *err, cfs_list_t *work_list);
+int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,
+                           int first_enq, ldlm_error_t *err,
+                           cfs_list_t *work_list);
 int ldlm_init_flock_export(struct obd_export *exp);
 void ldlm_destroy_flock_export(struct obd_export *exp);
 
index 165fe68..607c631 100644 (file)
@@ -544,7 +544,7 @@ EXPORT_SYMBOL(ldlm_lock2handle);
  */
 
 struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle,
-                                     int flags)
+                                    __u64 flags)
 {
         struct ldlm_lock *lock;
         ENTRY;
@@ -1039,7 +1039,7 @@ static struct ldlm_lock *search_queue(cfs_list_t *queue,
                                       ldlm_mode_t *mode,
                                       ldlm_policy_data_t *policy,
                                       struct ldlm_lock *old_lock,
-                                      int flags, int unref)
+                                     __u64 flags, int unref)
 {
         struct ldlm_lock *lock;
         cfs_list_t       *tmp;
@@ -1166,7 +1166,7 @@ EXPORT_SYMBOL(ldlm_lock_allow_match);
  * caller code unchanged), the context failure will be discovered by caller
  * sometime later.
  */
-ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, int flags,
+ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
                             const struct ldlm_res_id *res_id, ldlm_type_t type,
                             ldlm_policy_data_t *policy, ldlm_mode_t mode,
                             struct lustre_handle *lockh, int unref)
@@ -1383,7 +1383,7 @@ out:
 
 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns,
                                struct ldlm_lock **lockp,
-                               void *cookie, int *flags)
+                              void *cookie, __u64 *flags)
 {
         struct ldlm_lock *lock = *lockp;
         struct ldlm_resource *res = lock->l_resource;
@@ -1511,7 +1511,7 @@ int ldlm_reprocess_queue(struct ldlm_resource *res, cfs_list_t *queue,
 {
         cfs_list_t *tmp, *pos;
         ldlm_processing_policy policy;
-        int flags;
+       __u64 flags;
         int rc = LDLM_ITER_CONTINUE;
         ldlm_error_t err;
         ENTRY;
@@ -2035,7 +2035,7 @@ struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
                 } else {
                         /* This should never happen, because of the way the
                          * server handles conversions. */
-                        LDLM_ERROR(lock, "Erroneous flags %d on local lock\n",
+                       LDLM_ERROR(lock, "Erroneous flags %x on local lock\n",
                                    *flags);
                         LBUG();
 
@@ -2049,7 +2049,7 @@ struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
         } else {
                 int rc;
                 ldlm_error_t err;
-                int pflags = 0;
+               __u64 pflags = 0;
                 ldlm_processing_policy policy;
                 policy = ldlm_processing_policy_table[res->lr_type];
                 rc = policy(lock, &pflags, 0, &err, &rpc_list);
index 27178d1..fabb223 100644 (file)
@@ -863,7 +863,7 @@ int ldlm_server_blocking_ast(struct ldlm_lock *lock,
         body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ);
         body->lock_handle[0] = lock->l_remote_handle;
         body->lock_desc = *desc;
-        body->lock_flags |= (lock->l_flags & LDLM_AST_FLAGS);
+       body->lock_flags |= ldlm_flags_to_wire(lock->l_flags & LDLM_AST_FLAGS);
 
         LDLM_DEBUG(lock, "server preparing blocking AST");
 
@@ -893,7 +893,7 @@ int ldlm_server_blocking_ast(struct ldlm_lock *lock,
 }
 EXPORT_SYMBOL(ldlm_server_blocking_ast);
 
-int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data)
+int ldlm_server_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
 {
         struct ldlm_cb_set_arg *arg = data;
         struct ldlm_request    *body;
@@ -938,7 +938,7 @@ int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data)
         body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ);
 
         body->lock_handle[0] = lock->l_remote_handle;
-        body->lock_flags = flags;
+       body->lock_flags = ldlm_flags_to_wire(flags);
         ldlm_lock2desc(lock, &body->lock_desc);
        if (lvb_len > 0) {
                void *lvb = req_capsule_client_get(&req->rq_pill, &RMF_DLM_LVB);
@@ -976,9 +976,10 @@ int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data)
         /* We only send real blocking ASTs after the lock is granted */
         lock_res_and_lock(lock);
         if (lock->l_flags & LDLM_FL_AST_SENT) {
-                body->lock_flags |= LDLM_FL_AST_SENT;
+               body->lock_flags |= ldlm_flags_to_wire(LDLM_FL_AST_SENT);
                 /* copy ast flags like LDLM_FL_DISCARD_DATA */
-                body->lock_flags |= (lock->l_flags & LDLM_AST_FLAGS);
+               body->lock_flags |= ldlm_flags_to_wire(lock->l_flags &
+                                                      LDLM_AST_FLAGS);
 
                 /* We might get here prior to ldlm_handle_enqueue setting
                  * LDLM_FL_CANCEL_ON_BLOCK flag. Then we will put this lock
@@ -1147,7 +1148,7 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
                          const struct ldlm_callback_suite *cbs)
 {
         struct ldlm_reply *dlm_rep;
-        __u32 flags;
+       __u64 flags;
         ldlm_error_t err = ELDLM_OK;
         struct ldlm_lock *lock = NULL;
         void *cookie = NULL;
@@ -1157,7 +1158,7 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
         LDLM_DEBUG_NOLOCK("server-side enqueue handler START");
 
         ldlm_request_cancel(req, dlm_req, LDLM_ENQUEUE_CANCEL_OFF);
-        flags = dlm_req->lock_flags;
+       flags = ldlm_flags_from_wire(dlm_req->lock_flags);
 
         LASSERT(req->rq_export);
 
@@ -1288,12 +1289,12 @@ existing_lock:
         if (dlm_req->lock_desc.l_resource.lr_type == LDLM_EXTENT)
                 lock->l_req_extent = lock->l_policy_data.l_extent;
 
-        err = ldlm_lock_enqueue(ns, &lock, cookie, (int *)&flags);
+       err = ldlm_lock_enqueue(ns, &lock, cookie, &flags);
         if (err)
                 GOTO(out, err);
 
         dlm_rep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
-        dlm_rep->lock_flags = flags;
+       dlm_rep->lock_flags = ldlm_flags_to_wire(flags);
 
         ldlm_lock2desc(lock, &dlm_rep->lock_desc);
         ldlm_lock2handle(lock, &dlm_rep->lock_handle);
@@ -1305,7 +1306,8 @@ existing_lock:
         /* Now take into account flags to be inherited from original lock
            request both in reply to client and in our own lock flags. */
         dlm_rep->lock_flags |= dlm_req->lock_flags & LDLM_INHERIT_FLAGS;
-        lock->l_flags |= dlm_req->lock_flags & LDLM_INHERIT_FLAGS;
+       lock->l_flags |= ldlm_flags_from_wire(dlm_req->lock_flags &
+                                             LDLM_INHERIT_FLAGS);
 
         /* Don't move a pending lock onto the export if it has already been
          * disconnected due to eviction (bug 5683) or server umount (bug 24324).
@@ -1315,7 +1317,7 @@ existing_lock:
                 LDLM_ERROR(lock, "lock on destroyed export %p", req->rq_export);
                 rc = -ENOTCONN;
         } else if (lock->l_flags & LDLM_FL_AST_SENT) {
-                dlm_rep->lock_flags |= LDLM_FL_AST_SENT;
+               dlm_rep->lock_flags |= ldlm_flags_to_wire(LDLM_FL_AST_SENT);
                 if (lock->l_granted_mode == lock->l_req_mode) {
                         /*
                          * Only cancel lock if it was granted, because it would
@@ -2099,7 +2101,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 
         /* Copy hints/flags (e.g. LDLM_FL_DISCARD_DATA) from AST. */
         lock_res_and_lock(lock);
-        lock->l_flags |= (dlm_req->lock_flags & LDLM_AST_FLAGS);
+       lock->l_flags |= ldlm_flags_from_wire(dlm_req->lock_flags &
+                                             LDLM_AST_FLAGS);
         if (lustre_msg_get_opc(req->rq_reqmsg) == LDLM_BL_CALLBACK) {
                 /* If somebody cancels lock and cache is already dropped,
                  * or lock is failed before cp_ast received on client,
index 8cbb2e8..5664052 100644 (file)
@@ -109,8 +109,9 @@ ldlm_plain_compat_queue(cfs_list_t *queue, struct ldlm_lock *req,
  * If first_enq is 1 (ie, called from ldlm_lock_enqueue):
  *   - blocking ASTs have not been sent
  *   - must call this function with the resource lock held */
-int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
-                            ldlm_error_t *err, cfs_list_t *work_list)
+int ldlm_process_plain_lock(struct ldlm_lock *lock, __u64 *flags,
+                           int first_enq, ldlm_error_t *err,
+                           cfs_list_t *work_list)
 {
         struct ldlm_resource *res = lock->l_resource;
         CFS_LIST_HEAD(rpc_list);
index dd561dc..86023cd 100644 (file)
@@ -156,7 +156,7 @@ static int ldlm_completion_tail(struct ldlm_lock *lock)
  * until lock is granted. Suitable for locks enqueued through ptlrpcd, of
  * other threads that cannot block for long.
  */
-int ldlm_completion_ast_async(struct ldlm_lock *lock, int flags, void *data)
+int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data)
 {
         ENTRY;
 
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(ldlm_completion_ast_async);
  * or penultimate cases happen in some other thread.
  *
  */
-int ldlm_completion_ast(struct ldlm_lock *lock, int flags, void *data)
+int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
 {
         /* XXX ALLOCATE - 160 bytes */
         struct lock_wait_data lwd;
@@ -381,7 +381,7 @@ EXPORT_SYMBOL(ldlm_glimpse_ast);
 int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
                            const struct ldlm_res_id *res_id,
                            ldlm_type_t type, ldlm_policy_data_t *policy,
-                           ldlm_mode_t mode, int *flags,
+                          ldlm_mode_t mode, __u64 *flags,
                            ldlm_blocking_callback blocking,
                            ldlm_completion_callback completion,
                            ldlm_glimpse_callback glimpse,
@@ -486,7 +486,7 @@ static void failed_lock_cleanup(struct ldlm_namespace *ns,
 
 int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                           ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode,
-                          int *flags, void *lvb, __u32 lvb_len,
+                         __u64 *flags, void *lvb, __u32 lvb_len,
                           struct lustre_handle *lockh,int rc)
 {
         struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
@@ -551,14 +551,16 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                 lock->l_remote_handle = reply->lock_handle;
         }
 
-        *flags = reply->lock_flags;
-        lock->l_flags |= reply->lock_flags & LDLM_INHERIT_FLAGS;
+       *flags = ldlm_flags_from_wire(reply->lock_flags);
+       lock->l_flags |= ldlm_flags_from_wire(reply->lock_flags &
+                                             LDLM_INHERIT_FLAGS);
         /* move NO_TIMEOUT flag to the lock to force ldlm_lock_match()
          * to wait with no timeout as well */
-        lock->l_flags |= reply->lock_flags & LDLM_FL_NO_TIMEOUT;
+       lock->l_flags |= ldlm_flags_from_wire(reply->lock_flags &
+                                             LDLM_FL_NO_TIMEOUT);
         unlock_res_and_lock(lock);
 
-        CDEBUG(D_INFO, "local: %p, remote cookie: "LPX64", flags: 0x%x\n",
+       CDEBUG(D_INFO, "local: %p, remote cookie: "LPX64", flags: 0x%llx\n",
                lock, reply->lock_handle.cookie, *flags);
 
         /* If enqueue returned a blocked lock but the completion handler has
@@ -784,7 +786,7 @@ EXPORT_SYMBOL(ldlm_prep_enqueue_req);
 int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
                      struct ldlm_enqueue_info *einfo,
                      const struct ldlm_res_id *res_id,
-                     ldlm_policy_data_t const *policy, int *flags,
+                    ldlm_policy_data_t const *policy, __u64 *flags,
                      void *lvb, __u32 lvb_len, struct lustre_handle *lockh,
                      int async)
 {
@@ -874,7 +876,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
         /* Dump lock data into the request buffer */
         body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ);
         ldlm_lock2desc(lock, &body->lock_desc);
-        body->lock_flags = *flags;
+       body->lock_flags = ldlm_flags_to_wire(*flags);
         body->lock_handle[0] = *lockh;
 
         /* Continue as normal. */
@@ -988,7 +990,7 @@ int ldlm_cli_convert(struct lustre_handle *lockh, int new_mode, __u32 *flags)
         body->lock_handle[0] = lock->l_remote_handle;
 
         body->lock_desc.l_req_mode = new_mode;
-        body->lock_flags = *flags;
+       body->lock_flags = ldlm_flags_to_wire(*flags);
 
 
         ptlrpc_request_set_replen(req);
@@ -1030,20 +1032,20 @@ EXPORT_SYMBOL(ldlm_cli_convert);
  * LDLM_FL_LOCAL_ONLY if tere is no need in a CANCEL rpc to the server;
  * LDLM_FL_CANCELING otherwise;
  * LDLM_FL_BL_AST if there is a need in a separate CANCEL rpc. */
-static int ldlm_cli_cancel_local(struct ldlm_lock *lock)
+static __u64 ldlm_cli_cancel_local(struct ldlm_lock *lock)
 {
-        int rc = LDLM_FL_LOCAL_ONLY;
+       __u64 rc = LDLM_FL_LOCAL_ONLY;
         ENTRY;
 
         if (lock->l_conn_export) {
-                int local_only;
+                bool local_only;
 
                 LDLM_DEBUG(lock, "client-side cancel");
                 /* Set this flag to prevent others from getting new references*/
                 lock_res_and_lock(lock);
                 lock->l_flags |= LDLM_FL_CBPENDING;
-                local_only = (lock->l_flags &
-                              (LDLM_FL_LOCAL_ONLY|LDLM_FL_CANCEL_ON_BLOCK));
+               local_only = !!(lock->l_flags &
+                               (LDLM_FL_LOCAL_ONLY|LDLM_FL_CANCEL_ON_BLOCK));
                 ldlm_cancel_callback(lock);
                 rc = (lock->l_flags & LDLM_FL_BL_AST) ?
                         LDLM_FL_BL_AST : LDLM_FL_CANCELING;
@@ -1255,7 +1257,8 @@ EXPORT_SYMBOL(ldlm_cli_update_pool);
 int ldlm_cli_cancel(struct lustre_handle *lockh)
 {
         struct obd_export *exp;
-        int avail, flags, count = 1, rc = 0;
+       int avail, flags, count = 1;
+       __u64 rc = 0;
         struct ldlm_namespace *ns;
         struct ldlm_lock *lock;
         CFS_LIST_HEAD(cancels);
@@ -1269,9 +1272,9 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
         }
 
         rc = ldlm_cli_cancel_local(lock);
-        if (rc < 0 || rc == LDLM_FL_LOCAL_ONLY) {
+       if (rc == LDLM_FL_LOCAL_ONLY) {
                 LDLM_LOCK_RELEASE(lock);
-                RETURN(rc < 0 ? rc : 0);
+               RETURN(0);
         }
         /* Even if the lock is marked as LDLM_FL_BL_AST, this is a LDLM_CANCEL
          * rpc which goes to canceld portal, so we can cancel other lru locks
@@ -1304,7 +1307,8 @@ int ldlm_cli_cancel_list_local(cfs_list_t *cancels, int count,
 {
         CFS_LIST_HEAD(head);
         struct ldlm_lock *lock, *next;
-        int left = 0, bl_ast = 0, rc;
+       int left = 0, bl_ast = 0;
+       __u64 rc;
 
         left = count;
         cfs_list_for_each_entry_safe(lock, next, cancels, l_bl_ast) {
@@ -2141,7 +2145,7 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock)
 
         body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ);
         ldlm_lock2desc(lock, &body->lock_desc);
-        body->lock_flags = flags;
+       body->lock_flags = ldlm_flags_to_wire(flags);
 
         ldlm_lock2handle(lock, &body->lock_handle[0]);
         if (lock->l_lvb_len != 0) {
index ec8bc22..91b1327 100644 (file)
@@ -666,11 +666,11 @@ extern struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
  * This is currently only used for recovery, and we make certain assumptions
  * as a result--notably, that we shouldn't cancel locks with refs. -phil */
 static void cleanup_resource(struct ldlm_resource *res, cfs_list_t *q,
-                             int flags)
+                            __u64 flags)
 {
-        cfs_list_t *tmp;
-        int rc = 0, client = ns_is_client(ldlm_res_to_ns(res));
-        int local_only = (flags & LDLM_FL_LOCAL_ONLY);
+       cfs_list_t *tmp;
+       int rc = 0, client = ns_is_client(ldlm_res_to_ns(res));
+       bool local_only = !!(flags & LDLM_FL_LOCAL_ONLY);
 
         do {
                 struct ldlm_lock *lock = NULL;
@@ -741,7 +741,7 @@ static int ldlm_resource_clean(cfs_hash_t *hs, cfs_hash_bd_t *bd,
                                cfs_hlist_node_t *hnode, void *arg)
 {
         struct ldlm_resource *res = cfs_hash_object(hs, hnode);
-        int    flags = (int)(unsigned long)arg;
+       __u64 flags = *(__u64 *)arg;
 
         cleanup_resource(res, &res->lr_granted, flags);
         cleanup_resource(res, &res->lr_converting, flags);
@@ -769,15 +769,14 @@ static int ldlm_resource_complain(cfs_hash_t *hs, cfs_hash_bd_t *bd,
         return 0;
 }
 
-int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int flags)
+int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags)
 {
         if (ns == NULL) {
                 CDEBUG(D_INFO, "NULL ns, skipping cleanup\n");
                 return ELDLM_OK;
         }
 
-        cfs_hash_for_each_nolock(ns->ns_rs_hash, ldlm_resource_clean,
-                                 (void *)(unsigned long)flags);
+       cfs_hash_for_each_nolock(ns->ns_rs_hash, ldlm_resource_clean, &flags);
         cfs_hash_for_each_nolock(ns->ns_rs_hash, ldlm_resource_complain, NULL);
         return ELDLM_OK;
 }
index 8eadab8..ec70c4e 100644 (file)
@@ -217,8 +217,6 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1,struct inode *i2);
 typedef int (*intent_finish_cb)(struct ptlrpc_request *,
                                 struct inode *parent, struct pnode *pnode,
                                 struct lookup_intent *, int offset, obd_id ino);
-int llu_intent_lock(struct inode *parent, struct pnode *pnode,
-                    struct lookup_intent *, int flags, intent_finish_cb);
 
 static inline __u64 ll_file_maxbytes(struct inode *inode)
 {
index b89c5e9..81808cb 100644 (file)
@@ -120,7 +120,7 @@ static ldlm_mode_t llu_take_md_lock(struct inode *inode, __u64 bits,
         ldlm_policy_data_t policy = { .l_inodebits = {bits}};
         struct lu_fid *fid;
         ldlm_mode_t rc;
-        int flags;
+       __u64 flags;
         ENTRY;
 
         fid = &llu_i2info(inode)->lli_fid;
@@ -368,7 +368,7 @@ static int llu_have_md_lock(struct inode *inode, __u64 lockpart)
         struct lustre_handle lockh;
         ldlm_policy_data_t policy = { .l_inodebits = { lockpart } };
         struct lu_fid *fid;
-        int flags;
+       __u64 flags;
         ENTRY;
 
         LASSERT(inode);
@@ -1275,7 +1275,7 @@ static int llu_file_flock(struct inode *ino,
 
         struct lustre_handle lockh = {0};
         ldlm_policy_data_t flock;
-        int flags = 0;
+       __u64 flags = 0;
         int rc;
 
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%llu file_lock=%p\n",
@@ -1331,7 +1331,7 @@ static int llu_file_flock(struct inode *ino,
                 LBUG();
         }
 
-        CDEBUG(D_DLMTRACE, "inode=%llu, pid=%u, cmd=%d, flags=%#x, mode=%u, "
+       CDEBUG(D_DLMTRACE, "inode=%llu, pid=%u, cmd=%d, flags=%#llx, mode=%u, "
                "start="LPX64", end="LPX64"\n", (unsigned long long)st->st_ino,
                flock.l_flock.pid, cmd, flags, einfo.ei_mode, flock.l_flock.start,
                flock.l_flock.end);
index b73dfed..b6d6f90 100644 (file)
@@ -2273,7 +2273,7 @@ int ll_have_md_lock(struct inode *inode, __u64 *bits,  ldlm_mode_t l_req_mode)
         ldlm_mode_t mode = (l_req_mode == LCK_MINMODE) ?
                                 (LCK_CR|LCK_CW|LCK_PR|LCK_PW) : l_req_mode;
         struct lu_fid *fid;
-        int flags;
+       __u64 flags;
         int i;
         ENTRY;
 
@@ -2313,7 +2313,7 @@ ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
         ldlm_policy_data_t policy = { .l_inodebits = {bits}};
         struct lu_fid *fid;
         ldlm_mode_t rc;
-        int flags;
+       __u64 flags;
         ENTRY;
 
         fid = &ll_i2info(inode)->lli_fid;
index d3caecb..8cac14e 100644 (file)
@@ -62,7 +62,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm,
                       int lmmsize, struct lookup_intent *it,
                       int flags, struct ptlrpc_request **reqp,
                       ldlm_blocking_callback cb_blocking,
-                      int extra_lock_flags)
+                     __u64 extra_lock_flags)
 {
         struct obd_device      *obd = exp->exp_obd;
         struct lmv_obd         *lmv = &obd->u.lmv;
@@ -158,7 +158,7 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags)
+                   __u64 extra_lock_flags)
 {
         struct obd_device     *obd = exp->exp_obd;
         struct lu_fid          rpid = op_data->op_fid1;
@@ -343,7 +343,7 @@ int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data,
                       void *lmm, int lmmsize, struct lookup_intent *it,
                       int flags, struct ptlrpc_request **reqp,
                       ldlm_blocking_callback cb_blocking,
-                      int extra_lock_flags)
+                     __u64 extra_lock_flags)
 {
         struct obd_device      *obd = exp->exp_obd;
         struct lu_fid           rpid = op_data->op_fid1;
@@ -507,7 +507,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags)
+                   __u64 extra_lock_flags)
 {
         struct obd_device *obd = exp->exp_obd;
         int                rc;
@@ -540,7 +540,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
 int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
                           const struct lu_fid *mid, struct lookup_intent *oit,
                           int master_valid, ldlm_blocking_callback cb_blocking,
-                          int extra_lock_flags)
+                         __u64 extra_lock_flags)
 {
         struct obd_device      *obd = exp->exp_obd;
         struct lmv_obd         *lmv = &obd->u.lmv;
index e391d0b..d984220 100644 (file)
@@ -157,19 +157,19 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags);
+                   __u64 extra_lock_flags);
 
 int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data,
                       void *lmm, int lmmsize, struct lookup_intent *it,
                       int flags, struct ptlrpc_request **reqp,
                       ldlm_blocking_callback cb_blocking,
-                      int extra_lock_flags);
+                     __u64 extra_lock_flags);
 
 int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags);
+                   __u64 extra_lock_flags);
 
 int lmv_allocate_slaves(struct obd_device *obd, struct lu_fid *pid,
                         struct md_op_data *op, struct lu_fid *fid);
@@ -177,7 +177,7 @@ int lmv_allocate_slaves(struct obd_device *obd, struct lu_fid *pid,
 int lmv_revalidate_slaves(struct obd_export *, struct ptlrpc_request **,
                           const struct lu_fid *, struct lookup_intent *, int,
                          ldlm_blocking_callback cb_blocking,
-                          int extra_lock_flags);
+                         __u64 extra_lock_flags);
 
 int lmv_handle_split(struct obd_export *, const struct lu_fid *);
 int lmv_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
index 21f530a..155d0d6 100644 (file)
@@ -1732,7 +1732,7 @@ static int
 lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
             struct lookup_intent *it, struct md_op_data *op_data,
             struct lustre_handle *lockh, void *lmm, int lmmsize,
-            struct ptlrpc_request **req, int extra_lock_flags)
+           struct ptlrpc_request **req, __u64 extra_lock_flags)
 {
         struct obd_device        *obd = exp->exp_obd;
         struct lmv_obd           *lmv = &obd->u.lmv;
@@ -2884,7 +2884,7 @@ int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
         RETURN(rc);
 }
 
-ldlm_mode_t lmv_lock_match(struct obd_export *exp, int flags,
+ldlm_mode_t lmv_lock_match(struct obd_export *exp, __u64 flags,
                            const struct lu_fid *fid, ldlm_type_t type,
                            ldlm_policy_data_t *policy, ldlm_mode_t mode,
                            struct lustre_handle *lockh)
index b114fc5..807a843 100644 (file)
@@ -92,11 +92,12 @@ int mdc_intent_lock(struct obd_export *exp,
                     void *lmm, int lmmsize,
                     struct lookup_intent *, int,
                     struct ptlrpc_request **reqp,
-                    ldlm_blocking_callback cb_blocking, int extra_lock_flags);
+                   ldlm_blocking_callback cb_blocking,
+                   __u64 extra_lock_flags);
 int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
                 struct lookup_intent *it, struct md_op_data *op_data,
                 struct lustre_handle *lockh, void *lmm, int lmmsize,
-                struct ptlrpc_request **req, int extra_lock_flags);
+               struct ptlrpc_request **req, __u64 extra_lock_flags);
 
 int mdc_resource_get_unused(struct obd_export *exp, struct lu_fid *fid,
                             cfs_list_t *cancels, ldlm_mode_t mode,
@@ -162,7 +163,7 @@ int mdc_intent_getattr_async(struct obd_export *exp,
                              struct md_enqueue_info *minfo,
                              struct ldlm_enqueue_info *einfo);
 
-ldlm_mode_t mdc_lock_match(struct obd_export *exp, int flags,
+ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags,
                            const struct lu_fid *fid, ldlm_type_t type,
                            ldlm_policy_data_t *policy, ldlm_mode_t mode,
                            struct lustre_handle *lockh);
index 4f03811..46d2bf5 100644 (file)
@@ -152,7 +152,7 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
         RETURN(0);
 }
 
-ldlm_mode_t mdc_lock_match(struct obd_export *exp, int flags,
+ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags,
                            const struct lu_fid *fid, ldlm_type_t type,
                            ldlm_policy_data_t *policy, ldlm_mode_t mode,
                            struct lustre_handle *lockh)
@@ -475,7 +475,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
          * actually get a lock, just perform the intent. */
         if (req->rq_transno || req->rq_replay) {
                 lockreq = req_capsule_client_get(pill, &RMF_DLM_REQ);
-                lockreq->lock_flags |= LDLM_FL_INTENT_ONLY;
+               lockreq->lock_flags |= ldlm_flags_to_wire(LDLM_FL_INTENT_ONLY);
         }
 
         if (rc == ELDLM_LOCK_ABORTED) {
@@ -667,11 +667,11 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
                 struct lookup_intent *it, struct md_op_data *op_data,
                 struct lustre_handle *lockh, void *lmm, int lmmsize,
-                struct ptlrpc_request **reqp, int extra_lock_flags)
+               struct ptlrpc_request **reqp, __u64 extra_lock_flags)
 {
         struct obd_device     *obddev = class_exp2obd(exp);
         struct ptlrpc_request *req = NULL;
-        int                    flags, saved_flags = extra_lock_flags;
+       __u64                  flags, saved_flags = extra_lock_flags;
         int                    rc;
         struct ldlm_res_id res_id;
         static const ldlm_policy_data_t lookup_policy =
@@ -996,7 +996,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int lookup_flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags)
+                   __u64 extra_lock_flags)
 {
         struct lustre_handle lockh;
         int rc = 0;
@@ -1072,7 +1072,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
         struct lookup_intent     *it;
         struct lustre_handle     *lockh;
         struct obd_device        *obddev;
-        int                       flags = LDLM_FL_HAS_INTENT;
+       __u64                     flags = LDLM_FL_HAS_INTENT;
         ENTRY;
 
         it    = &minfo->mi_it;
@@ -1123,7 +1123,7 @@ int mdc_intent_getattr_async(struct obd_export *exp,
                                                          MDS_INODELOCK_UPDATE }
                                  };
         int                      rc = 0;
-        int                      flags = LDLM_FL_HAS_INTENT;
+       __u64                    flags = LDLM_FL_HAS_INTENT;
         ENTRY;
 
         CDEBUG(D_DLMTRACE,"name: %.*s in inode "DFID", intent: %s flags %#o\n",
index 4a84abe..5ba7efe 100644 (file)
@@ -3303,11 +3303,11 @@ enum mdt_it_code {
 static int mdt_intent_getattr(enum mdt_it_code opcode,
                               struct mdt_thread_info *info,
                               struct ldlm_lock **,
-                              int);
+                             __u64);
 static int mdt_intent_reint(enum mdt_it_code opcode,
                             struct mdt_thread_info *info,
                             struct ldlm_lock **,
-                            int);
+                           __u64);
 
 static struct mdt_it_flavor {
         const struct req_format *it_fmt;
@@ -3315,7 +3315,7 @@ static struct mdt_it_flavor {
         int                    (*it_act)(enum mdt_it_code ,
                                          struct mdt_thread_info *,
                                          struct ldlm_lock **,
-                                         int);
+                                        __u64);
         long                     it_reint;
 } mdt_it_flavor[] = {
         [MDT_IT_OPEN]     = {
@@ -3379,7 +3379,7 @@ int mdt_intent_lock_replace(struct mdt_thread_info *info,
                             struct ldlm_lock **lockp,
                             struct ldlm_lock *new_lock,
                             struct mdt_lock_handle *lh,
-                            int flags)
+                           __u64 flags)
 {
         struct ptlrpc_request  *req = mdt_info_req(info);
         struct ldlm_lock       *lock = *lockp;
@@ -3520,7 +3520,7 @@ static void mdt_intent_fixup_resent(struct mdt_thread_info *info,
 static int mdt_intent_getattr(enum mdt_it_code opcode,
                               struct mdt_thread_info *info,
                               struct ldlm_lock **lockp,
-                              int flags)
+                             __u64 flags)
 {
         struct mdt_lock_handle *lhc = &info->mti_lh[MDT_LH_RMT];
         struct ldlm_lock       *new_lock = NULL;
@@ -3601,7 +3601,7 @@ out_shrink:
 static int mdt_intent_reint(enum mdt_it_code opcode,
                             struct mdt_thread_info *info,
                             struct ldlm_lock **lockp,
-                            int flags)
+                           __u64 flags)
 {
         struct mdt_lock_handle *lhc = &info->mti_lh[MDT_LH_RMT];
         struct ldlm_reply      *rep = NULL;
@@ -3733,7 +3733,7 @@ static int mdt_intent_code(long itcode)
 }
 
 static int mdt_intent_opc(long itopc, struct mdt_thread_info *info,
-                          struct ldlm_lock **lockp, int flags)
+                         struct ldlm_lock **lockp, __u64 flags)
 {
         struct req_capsule   *pill;
         struct mdt_it_flavor *flv;
@@ -3782,7 +3782,7 @@ static int mdt_intent_opc(long itopc, struct mdt_thread_info *info,
 
 static int mdt_intent_policy(struct ldlm_namespace *ns,
                              struct ldlm_lock **lockp, void *req_cookie,
-                             ldlm_mode_t mode, int flags, void *data)
+                            ldlm_mode_t mode, __u64 flags, void *data)
 {
         struct mdt_thread_info *info;
         struct ptlrpc_request  *req  =  req_cookie;
index 98f3deb..fd1cc0a 100644 (file)
@@ -724,7 +724,7 @@ static inline int mdt_fid_lock(struct ldlm_namespace *ns,
                                ldlm_mode_t mode,
                                ldlm_policy_data_t *policy,
                                const struct ldlm_res_id *res_id,
-                               int flags, const __u64 *client_cookie)
+                              __u64 flags, const __u64 *client_cookie)
 {
         int rc;
 
index d0c072b..c36ea7a 100644 (file)
@@ -839,6 +839,7 @@ static int mdt_rename_lock(struct mdt_thread_info *info,
         struct ldlm_namespace *ns     = info->mti_mdt->mdt_namespace;
         ldlm_policy_data_t    *policy = &info->mti_policy;
         struct ldlm_res_id    *res_id = &info->mti_res_id;
+       __u64                  flags = 0;
         struct md_site        *ms;
         int rc;
         ENTRY;
@@ -850,7 +851,7 @@ static int mdt_rename_lock(struct mdt_thread_info *info,
         policy->l_inodebits.bits = MDS_INODELOCK_UPDATE;
 
         if (ms->ms_control_exp == NULL) {
-                int flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
+               flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
 
                 /*
                  * Current node is controller, that is mdt0, where we should
@@ -864,8 +865,6 @@ static int mdt_rename_lock(struct mdt_thread_info *info,
         } else {
                 struct ldlm_enqueue_info einfo = { LDLM_IBITS, LCK_EX,
                      ldlm_blocking_ast, ldlm_completion_ast, NULL, NULL, NULL };
-                int flags = 0;
-
                 /*
                  * This is the case mdt0 is remote node, issue DLM lock like
                  * other clients.
index 53f0b59..80d1ac7 100644 (file)
@@ -905,9 +905,9 @@ static int mgc_set_mgs_param(struct obd_export *exp,
 /* Take a config lock so we can get cancel notifications */
 static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
                        __u32 type, ldlm_policy_data_t *policy, __u32 mode,
-                       int *flags, void *bl_cb, void *cp_cb, void *gl_cb,
-                       void *data, __u32 lvb_len, void *lvb_swabber,
-                       struct lustre_handle *lockh)
+                      __u64 *flags, void *bl_cb, void *cp_cb, void *gl_cb,
+                      void *data, __u32 lvb_len, void *lvb_swabber,
+                      struct lustre_handle *lockh)
 {
         struct config_llog_data *cld = (struct config_llog_data *)data;
         struct ldlm_enqueue_info einfo = { type, mode, mgc_blocking_ast,
@@ -1816,7 +1816,8 @@ out_pop:
 int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld)
 {
         struct lustre_handle lockh = { 0 };
-        int rc = 0, rcl, flags = LDLM_FL_NO_LRU;
+       __u64 flags = LDLM_FL_NO_LRU;
+       int rc = 0, rcl;
         ENTRY;
 
         LASSERT(cld);
index 5bb016f..6e424d4 100644 (file)
@@ -131,7 +131,7 @@ static int mgs_disconnect(struct obd_export *exp)
 
 static int mgs_handle(struct ptlrpc_request *req);
 
-static int mgs_completion_ast_config(struct ldlm_lock *lock, int flags,
+static int mgs_completion_ast_config(struct ldlm_lock *lock, __u64 flags,
                                      void *cbdata)
 {
         ENTRY;
@@ -151,7 +151,7 @@ static int mgs_completion_ast_config(struct ldlm_lock *lock, int flags,
         RETURN(ldlm_completion_ast(lock, flags, cbdata));
 }
 
-static int mgs_completion_ast_ir(struct ldlm_lock *lock, int flags,
+static int mgs_completion_ast_ir(struct ldlm_lock *lock, __u64 flags,
                                  void *cbdata)
 {
         ENTRY;
@@ -185,7 +185,7 @@ void mgs_revoke_lock(struct mgs_device *mgs, struct fs_db *fsdb, int type)
         ldlm_completion_callback cp = NULL;
         struct lustre_handle     lockh = { 0 };
         struct ldlm_res_id       res_id;
-        int flags = LDLM_FL_ATOMIC_CB;
+       __u64 flags = LDLM_FL_ATOMIC_CB;
         int rc;
         ENTRY;
 
index 2320dc9..5370248 100644 (file)
@@ -555,7 +555,7 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
         struct lprocfs_static_vars lvars;
         int                        rc;
-        int                        lock_flags = 0;
+       __u64                      lock_flags = 0;
         struct ldlm_res_id         res_id = {.name = {1}};
         char                       ns_name[48];
         ENTRY;
index 1f67141..c0bbd15 100644 (file)
@@ -88,7 +88,7 @@ static enum interval_iter ofd_intent_cb(struct interval_node *n, void *args)
 }
 
 int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp,
-                     void *req_cookie, ldlm_mode_t mode, int flags,
+                     void *req_cookie, ldlm_mode_t mode, __u64 flags,
                      void *data)
 {
        struct ptlrpc_request           *req = req_cookie;
@@ -98,8 +98,8 @@ int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp,
        struct ost_lvb                  *res_lvb, *reply_lvb;
        struct ldlm_reply               *rep;
        ldlm_error_t                     err;
-       int                              idx, rc;
-       int                              tmpflags = 0, only_liblustre = 1;
+       int                              idx, rc, only_liblustre = 1;
+       __u64                            tmpflags = 0;
        struct ldlm_interval_tree       *tree;
        struct ofd_intent_args           arg;
        __u32                            repsize[3] = {
index cc5fe41..827834f 100644 (file)
@@ -464,7 +464,7 @@ extern struct ldlm_valblock_ops ofd_lvbo;
 
 /* ofd_dlm.c */
 int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp,
-                     void *req_cookie, ldlm_mode_t mode, int flags,
+                     void *req_cookie, ldlm_mode_t mode, __u64 flags,
                      void *data);
 
 static inline struct ofd_thread_info * ofd_info(const struct lu_env *env)
index e024671..29592a9 100644 (file)
@@ -943,7 +943,7 @@ static int ofd_destroy_by_fid(const struct lu_env *env,
 {
        struct ofd_thread_info  *info = ofd_info(env);
        struct lustre_handle     lockh;
-       int                      flags = LDLM_AST_DISCARD_DATA, rc = 0;
+       __u64                    flags = LDLM_AST_DISCARD_DATA, rc = 0;
        ldlm_policy_data_t       policy = {
                                        .l_extent = { 0, OBD_OBJECT_EOF }
                                 };
index ac26f4f..d10d26f 100644 (file)
@@ -255,7 +255,7 @@ struct osc_lock {
         /** lock value block */
         struct ost_lvb           ols_lvb;
         /** DLM flags with which osc_lock::ols_lock was enqueued */
-        int                      ols_flags;
+       __u64                    ols_flags;
         /** osc_lock::ols_lock handle */
         struct lustre_handle     ols_handle;
         struct ldlm_enqueue_info ols_einfo;
index 99c30cc..f9bcae1 100644 (file)
@@ -116,7 +116,7 @@ void osc_update_next_shrink(struct client_obd *cli);
 extern struct ptlrpc_request_set *PTLRPCD_SET;
 
 int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
-                     int *flags, ldlm_policy_data_t *policy,
+                    __u64 *flags, ldlm_policy_data_t *policy,
                      struct ost_lvb *lvb, int kms_valid,
                      obd_enqueue_update_f upcall,
                      void *cookie, struct ldlm_enqueue_info *einfo,
index ffcfdf7..f517631 100644 (file)
@@ -274,9 +274,9 @@ static void osc_lock_build_policy(const struct lu_env *env,
         policy->l_extent.gid = d->cld_gid;
 }
 
-static int osc_enq2ldlm_flags(__u32 enqflags)
+static __u64 osc_enq2ldlm_flags(__u32 enqflags)
 {
-        int result = 0;
+        __u64 result = 0;
 
         LASSERT((enqflags & ~CEF_MASK) == 0);
 
@@ -791,7 +791,7 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock,
 }
 
 static int osc_ldlm_completion_ast(struct ldlm_lock *dlmlock,
-                                   int flags, void *data)
+                                  __u64 flags, void *data)
 {
         struct cl_env_nest nest;
         struct lu_env     *env;
@@ -1547,7 +1547,7 @@ static int osc_lock_print(const struct lu_env *env, void *cookie,
         /*
          * XXX print ldlm lock and einfo properly.
          */
-        (*p)(env, cookie, "%p %08x "LPX64" %d %p ",
+       (*p)(env, cookie, "%p %#16llx "LPX64" %d %p ",
              lock->ols_lock, lock->ols_flags, lock->ols_handle.cookie,
              lock->ols_state, lock->ols_owner);
         osc_lvb_print(env, cookie, p, &lock->ols_lvb);
index 55439f5..d037f66 100644 (file)
@@ -2285,7 +2285,7 @@ static int osc_find_cbdata(struct obd_export *exp, struct lov_stripe_md *lsm,
 
 static int osc_enqueue_fini(struct ptlrpc_request *req, struct ost_lvb *lvb,
                             obd_enqueue_update_f upcall, void *cookie,
-                            int *flags, int agl, int rc)
+                           __u64 *flags, int agl, int rc)
 {
         int intent = *flags & LDLM_FL_HAS_INTENT;
         ENTRY;
@@ -2324,7 +2324,7 @@ static int osc_enqueue_interpret(const struct lu_env *env,
         __u32 mode;
         struct ost_lvb *lvb;
         __u32 lvb_len;
-        int *flags = aa->oa_flags;
+       __u64 *flags = aa->oa_flags;
 
         /* Make a local copy of a lock handle and a mode, because aa->oa_*
          * might be freed anytime after lock upcall has been called. */
@@ -2432,7 +2432,7 @@ struct ptlrpc_request_set *PTLRPCD_SET = (void *)1;
  * is excluded from the cluster -- such scenarious make the life difficult, so
  * release locks just after they are obtained. */
 int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
-                     int *flags, ldlm_policy_data_t *policy,
+                    __u64 *flags, ldlm_policy_data_t *policy,
                      struct ost_lvb *lvb, int kms_valid,
                      obd_enqueue_update_f upcall, void *cookie,
                      struct ldlm_enqueue_info *einfo,
index 4be096a..904beb0 100644 (file)
@@ -211,7 +211,7 @@ static int ost_destroy(struct obd_export *exp, struct ptlrpc_request *req,
  */
 static int ost_lock_get(struct obd_export *exp, struct obdo *oa,
                         __u64 start, __u64 count, struct lustre_handle *lh,
-                        int mode, int flags)
+                       int mode, __u64 flags)
 {
         struct ldlm_res_id res_id;
         ldlm_policy_data_t policy;
@@ -369,8 +369,9 @@ static int ost_punch(struct obd_export *exp, struct ptlrpc_request *req,
                      struct obd_trans_info *oti)
 {
         struct ost_body *body, *repbody;
-        int rc, flags = 0;
+       __u64 flags = 0;
         struct lustre_handle lh = {0,};
+       int rc;
         ENTRY;
 
         /* check that we do support OBD_CONNECT_TRUNCLOCK. */
@@ -615,7 +616,7 @@ static int ost_brw_lock_get(int mode, struct obd_export *exp,
                             struct obd_ioobj *obj, struct niobuf_remote *nb,
                             struct lustre_handle *lh)
 {
-        int flags                 = 0;
+       __u64 flags               = 0;
         int nrbufs                = obj->ioo_bufcnt;
         struct ldlm_res_id res_id;
         ldlm_policy_data_t policy;
index e316814..c5e61e4 100644 (file)
@@ -163,7 +163,7 @@ static int qsd_intent_interpret(const struct lu_env *env,
        struct quota_body        *rep_qbody = NULL, *req_qbody;
        struct ldlm_intent       *lit;
        struct qsd_async_args    *aa = (struct qsd_async_args *)arg;
-       int                       flags = LDLM_FL_HAS_INTENT;
+       __u64                     flags = LDLM_FL_HAS_INTENT;
        ENTRY;
 
        LASSERT(aa->aa_exp);
@@ -215,7 +215,8 @@ int qsd_intent_lock(const struct lu_env *env, struct obd_export *exp,
        struct qsd_async_args   *aa = NULL;
        struct ldlm_intent      *lit;
        struct quota_body       *req_qbody;
-       int                      rc, flags = LDLM_FL_HAS_INTENT;
+       __u64                    flags = LDLM_FL_HAS_INTENT;
+       int                      rc;
        ENTRY;
 
        LASSERT(exp != NULL);