staging: lustre: uapi: Move functions out of lustre_idl.h
authorBen Evans <bevans@cray.com>
Sun, 20 Aug 2017 02:25:55 +0000 (22:25 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Aug 2017 01:36:46 +0000 (18:36 -0700)
Migrate functions set/get_mrc_cr_flags, ldlm_res_eq
ldlm_extent_overlap, ldlm_extent_contain,
ldlm_request_bufsize, and all the PTLRPC dump_*
functions out of lustre_idl.h which is a UAPI header
to the places in the kernel code they are actually used.
Delete unused lmv_mds_md_stripe_count and
agent_req_in_final_state.

Signed-off-by: Ben Evans <bevans@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401
Reviewed-on: http://review.whamcloud.com/21484
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
drivers/staging/lustre/lustre/include/lustre_dlm.h
drivers/staging/lustre/lustre/include/lustre_swab.h
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
drivers/staging/lustre/lustre/ldlm/ldlm_request.c
drivers/staging/lustre/lustre/mdc/mdc_lib.c

index 1db1ab8b93a2cf478614b2e6d44494eeddd9f571..1e8ecdf02ba18fcabe940cbf1742377313df73de 100644 (file)
@@ -2130,17 +2130,6 @@ struct mdt_rec_create {
        __u32      cr_padding_4;   /* rr_padding_4 */
 };
 
-static inline void set_mrc_cr_flags(struct mdt_rec_create *mrc, __u64 flags)
-{
-       mrc->cr_flags_l = (__u32)(flags & 0xFFFFFFFFUll);
-       mrc->cr_flags_h = (__u32)(flags >> 32);
-}
-
-static inline __u64 get_mrc_cr_flags(struct mdt_rec_create *mrc)
-{
-       return ((__u64)(mrc->cr_flags_l) | ((__u64)mrc->cr_flags_h << 32));
-}
-
 /* instance of mdt_reint_rec */
 struct mdt_rec_link {
        __u32      lk_opcode;
@@ -2403,25 +2392,6 @@ static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm)
        }
 }
 
-static inline int lmv_mds_md_stripe_count_set(union lmv_mds_md *lmm,
-                                             unsigned int stripe_count)
-{
-       int rc = 0;
-
-       switch (le32_to_cpu(lmm->lmv_magic)) {
-       case LMV_MAGIC_V1:
-               lmm->lmv_md_v1.lmv_stripe_count = cpu_to_le32(stripe_count);
-               break;
-       case LMV_USER_MAGIC:
-               lmm->lmv_user_md.lum_stripe_count = cpu_to_le32(stripe_count);
-               break;
-       default:
-               rc = -EINVAL;
-               break;
-       }
-       return rc;
-}
-
 enum fld_rpc_opc {
        FLD_QUERY       = 900,
        FLD_READ        = 901,
@@ -2502,12 +2472,6 @@ struct ldlm_res_id {
 #define PLDLMRES(res)  (res)->lr_name.name[0], (res)->lr_name.name[1], \
                        (res)->lr_name.name[2], (res)->lr_name.name[3]
 
-static inline bool ldlm_res_eq(const struct ldlm_res_id *res0,
-                              const struct ldlm_res_id *res1)
-{
-       return !memcmp(res0, res1, sizeof(*res0));
-}
-
 /* lock types */
 enum ldlm_mode {
        LCK_MINMODE = 0,
@@ -2540,19 +2504,6 @@ struct ldlm_extent {
        __u64 gid;
 };
 
-static inline int ldlm_extent_overlap(const struct ldlm_extent *ex1,
-                                     const struct ldlm_extent *ex2)
-{
-       return (ex1->start <= ex2->end) && (ex2->start <= ex1->end);
-}
-
-/* check if @ex1 contains @ex2 */
-static inline int ldlm_extent_contain(const struct ldlm_extent *ex1,
-                                     const struct ldlm_extent *ex2)
-{
-       return (ex1->start <= ex2->start) && (ex1->end >= ex2->end);
-}
-
 struct ldlm_inodebits {
        __u64 bits;
 };
@@ -2627,18 +2578,6 @@ struct ldlm_request {
        struct lustre_handle lock_handle[LDLM_LOCKREQ_HANDLES];
 };
 
-/* If LDLM_ENQUEUE, 1 slot is already occupied, 1 is available.
- * Otherwise, 2 are available.
- */
-#define ldlm_request_bufsize(count, type)                              \
-({                                                                   \
-       int _avail = LDLM_LOCKREQ_HANDLES;                            \
-       _avail -= (type == LDLM_ENQUEUE ? LDLM_ENQUEUE_CANCEL_OFF : 0); \
-       sizeof(struct ldlm_request) +                              \
-       (count > _avail ? count - _avail : 0) *                  \
-       sizeof(struct lustre_handle);                              \
-})
-
 struct ldlm_reply {
        __u32 lock_flags;
        __u32 lock_padding;     /* also fix lustre_swab_ldlm_reply */
@@ -2942,12 +2881,6 @@ static inline const char *agent_req_status2name(const enum agent_req_status ars)
        }
 }
 
-static inline bool agent_req_in_final_state(enum agent_req_status ars)
-{
-       return ((ars == ARS_SUCCEED) || (ars == ARS_FAILED) ||
-               (ars == ARS_CANCELED));
-}
-
 struct llog_agent_req_rec {
        struct llog_rec_hdr     arr_hdr;        /**< record header */
        __u32                   arr_status;     /**< status of the request */
@@ -3142,12 +3075,6 @@ struct ll_fiemap_info_key {
        struct fiemap   lfik_fiemap;
 };
 
-/* Functions for dumping PTLRPC fields */
-void dump_rniobuf(struct niobuf_remote *rnb);
-void dump_ioo(struct obd_ioobj *nb);
-void dump_ost_body(struct ost_body *ob);
-void dump_rcs(__u32 *rc);
-
 /* security opcodes */
 enum sec_cmd {
        SEC_CTX_INIT        = 801,
index 1e86fb53388a92e814a9886ac5a8395754d6d22c..eb2de13fb6bc333090d4e6ec12f53b8bcb72faba 100644 (file)
@@ -1336,5 +1336,18 @@ void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock);
 void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock);
 /** @} */
 
+static inline int ldlm_extent_overlap(const struct ldlm_extent *ex1,
+                                     const struct ldlm_extent *ex2)
+{
+       return ex1->start <= ex2->end && ex2->start <= ex1->end;
+}
+
+/* check if @ex1 contains @ex2 */
+static inline int ldlm_extent_contain(const struct ldlm_extent *ex1,
+                                     const struct ldlm_extent *ex2)
+{
+       return ex1->start <= ex2->start && ex1->end >= ex2->end;
+}
+
 #endif
 /** @} LDLM */
index 26d01c2d66336f6e09f62c9864da7a1ad18a0f64..5c1bdc037ff0b3a47dd97acc8d7bebe07c1944b3 100644 (file)
@@ -99,4 +99,10 @@ void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl);
 void lustre_swab_close_data(struct close_data *data);
 void lustre_swab_lmv_user_md(struct lmv_user_md *lum);
 
+/* Functions for dumping PTLRPC fields */
+void dump_rniobuf(struct niobuf_remote *rnb);
+void dump_ioo(struct obd_ioobj *nb);
+void dump_ost_body(struct ost_body *ob);
+void dump_rcs(__u32 *rc);
+
 #endif
index 2bf5c8491be9886b6d58995228af6add09957876..36808dbe8790297d4ee48d52942c9ed88fe54616 100644 (file)
@@ -333,3 +333,9 @@ void ldlm_flock_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy,
                                     union ldlm_policy_data *lpolicy);
 void ldlm_flock_policy_local_to_wire(const union ldlm_policy_data *lpolicy,
                                     union ldlm_wire_policy_data *wpolicy);
+
+static inline bool ldlm_res_eq(const struct ldlm_res_id *res0,
+                              const struct ldlm_res_id *res1)
+{
+       return memcmp(res0, res1, sizeof(*res0)) == 0;
+}
index 4028e11249a2a7906ee0e5ddaa63ce002e2cbcfc..2e3db5e871f47f2c4e3b5f374cf019cefa507e04 100644 (file)
@@ -83,6 +83,33 @@ struct ldlm_async_args {
        struct lustre_handle lock_handle;
 };
 
+/**
+ * ldlm_request_bufsize
+ *
+ * @count:     number of ldlm handles
+ * @type:      ldlm opcode
+ *
+ * If opcode=LDLM_ENQUEUE, 1 slot is already occupied,
+ * LDLM_LOCKREQ_HANDLE -1 slots are available.
+ * Otherwise, LDLM_LOCKREQ_HANDLE slots are available.
+ *
+ * Return:     size of the request buffer
+ */
+static int ldlm_request_bufsize(int count, int type)
+{
+       int avail = LDLM_LOCKREQ_HANDLES;
+
+       if (type == LDLM_ENQUEUE)
+               avail -= LDLM_ENQUEUE_CANCEL_OFF;
+
+       if (count > avail)
+               avail = (count - avail) * sizeof(struct lustre_handle);
+       else
+               avail = 0;
+
+       return sizeof(struct ldlm_request) + avail;
+}
+
 static int ldlm_expired_completion_wait(void *data)
 {
        struct lock_wait_data *lwd = data;
index b1853ff7f8b9286adcaeb6a9b09cbce1e5ad86b5..aabdcec48c0faabe9cc8de06544f40fdfb39549c 100644 (file)
 #include "../include/lustre/lustre_idl.h"
 #include "mdc_internal.h"
 
+static void set_mrc_cr_flags(struct mdt_rec_create *mrc, u64 flags)
+{
+       mrc->cr_flags_l = (u32)(flags & 0xFFFFFFFFUll);
+       mrc->cr_flags_h = (u32)(flags >> 32);
+}
+
 static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
 {
        b->mbo_suppgid = suppgid;