Commit 22c147fd authored by Ben Evans's avatar Ben Evans Committed by Greg Kroah-Hartman

staging: lustre: uapi: Move functions out of lustre_idl.h

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: default avatarBen Evans <bevans@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401
Reviewed-on: http://review.whamcloud.com/21484Reviewed-by: default avatarFrank Zago <fzago@cray.com>
Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f942efe7
...@@ -2130,17 +2130,6 @@ struct mdt_rec_create { ...@@ -2130,17 +2130,6 @@ struct mdt_rec_create {
__u32 cr_padding_4; /* rr_padding_4 */ __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 */ /* instance of mdt_reint_rec */
struct mdt_rec_link { struct mdt_rec_link {
__u32 lk_opcode; __u32 lk_opcode;
...@@ -2403,25 +2392,6 @@ static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm) ...@@ -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 { enum fld_rpc_opc {
FLD_QUERY = 900, FLD_QUERY = 900,
FLD_READ = 901, FLD_READ = 901,
...@@ -2502,12 +2472,6 @@ struct ldlm_res_id { ...@@ -2502,12 +2472,6 @@ struct ldlm_res_id {
#define PLDLMRES(res) (res)->lr_name.name[0], (res)->lr_name.name[1], \ #define PLDLMRES(res) (res)->lr_name.name[0], (res)->lr_name.name[1], \
(res)->lr_name.name[2], (res)->lr_name.name[3] (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 */ /* lock types */
enum ldlm_mode { enum ldlm_mode {
LCK_MINMODE = 0, LCK_MINMODE = 0,
...@@ -2540,19 +2504,6 @@ struct ldlm_extent { ...@@ -2540,19 +2504,6 @@ struct ldlm_extent {
__u64 gid; __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 { struct ldlm_inodebits {
__u64 bits; __u64 bits;
}; };
...@@ -2627,18 +2578,6 @@ struct ldlm_request { ...@@ -2627,18 +2578,6 @@ struct ldlm_request {
struct lustre_handle lock_handle[LDLM_LOCKREQ_HANDLES]; 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 { struct ldlm_reply {
__u32 lock_flags; __u32 lock_flags;
__u32 lock_padding; /* also fix lustre_swab_ldlm_reply */ __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) ...@@ -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_agent_req_rec {
struct llog_rec_hdr arr_hdr; /**< record header */ struct llog_rec_hdr arr_hdr; /**< record header */
__u32 arr_status; /**< status of the request */ __u32 arr_status; /**< status of the request */
...@@ -3142,12 +3075,6 @@ struct ll_fiemap_info_key { ...@@ -3142,12 +3075,6 @@ struct ll_fiemap_info_key {
struct fiemap lfik_fiemap; 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 */ /* security opcodes */
enum sec_cmd { enum sec_cmd {
SEC_CTX_INIT = 801, SEC_CTX_INIT = 801,
......
...@@ -1336,5 +1336,18 @@ void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock); ...@@ -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); 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 #endif
/** @} LDLM */ /** @} LDLM */
...@@ -99,4 +99,10 @@ void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl); ...@@ -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_close_data(struct close_data *data);
void lustre_swab_lmv_user_md(struct lmv_user_md *lum); 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 #endif
...@@ -333,3 +333,9 @@ void ldlm_flock_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy, ...@@ -333,3 +333,9 @@ void ldlm_flock_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy,
union ldlm_policy_data *lpolicy); union ldlm_policy_data *lpolicy);
void ldlm_flock_policy_local_to_wire(const union ldlm_policy_data *lpolicy, void ldlm_flock_policy_local_to_wire(const union ldlm_policy_data *lpolicy,
union ldlm_wire_policy_data *wpolicy); 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;
}
...@@ -83,6 +83,33 @@ struct ldlm_async_args { ...@@ -83,6 +83,33 @@ struct ldlm_async_args {
struct lustre_handle lock_handle; 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) static int ldlm_expired_completion_wait(void *data)
{ {
struct lock_wait_data *lwd = data; struct lock_wait_data *lwd = data;
......
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
#include "../include/lustre/lustre_idl.h" #include "../include/lustre/lustre_idl.h"
#include "mdc_internal.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) static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
{ {
b->mbo_suppgid = suppgid; b->mbo_suppgid = suppgid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment