From: James Simmons Date: Sat, 8 May 2021 16:15:33 +0000 (-0400) Subject: LU-14291 lustre: limit header scope for server only handling X-Git-Tag: 2.14.52~62 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=5ecd5a5ecfb880236b5fbc23621102239de5f5d6;p=fs%2Flustre-release.git LU-14291 lustre: limit header scope for server only handling The lustre headers have server only function declarations and inline functions. Only include them if HAVE_SERVER_SUPPORT is set. This gets us closer to building OpenSFS modules against a Linux kernel with a native Lustre client. Move a few things from UAPI headers that are used only by kernel space to kernel only headers where they belong. For mdc_changlog.c a debug message access a field that is available the server which is never the case. Since its nonsense we can remove the report of this field Change-Id: I6e2d3bebc121aef97fe69344d496e230f62b28ad Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/43096 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Neil Brown Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/llog_swab.h b/lustre/include/llog_swab.h index 6fe62bc..cf48167 100644 --- a/lustre/include/llog_swab.h +++ b/lustre/include/llog_swab.h @@ -60,7 +60,9 @@ void lustre_swab_llogd_conn_body(struct llogd_conn_body *d); void lustre_swab_llog_rec(struct llog_rec_hdr *rec); void lustre_swab_llog_id(struct llog_logid *lid); void lustre_swab_lu_seq_range(struct lu_seq_range *range); +#ifdef HAVE_SERVER_SUPPORT void lustre_swab_update_ops(struct update_ops *uops, unsigned int op_count); +#endif void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg); void lustre_swab_cfg_marker(struct cfg_marker *marker, int swab, int size); diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index d0ab7e1..2b04a14 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -318,6 +318,7 @@ static inline int opcode_offset(__u32 opc) { OPC_RANGE(LDLM) + OPC_RANGE(MDS) + OPC_RANGE(OST)); +#ifdef HAVE_SERVER_SUPPORT } else if (opc < OUT_UPDATE_LAST_OPC) { /* update opcode */ return (opc - OUT_UPDATE_FIRST_OPC + @@ -345,25 +346,31 @@ static inline int opcode_offset(__u32 opc) { OPC_RANGE(LDLM) + OPC_RANGE(MDS) + OPC_RANGE(OST)); +#endif /* HAVE_SERVER_SUPPORT */ } else { /* Unknown Opcode */ return -1; } } +#define LUSTRE_MAX_OPCODES_CLIENT (OPC_RANGE(OST) + \ + OPC_RANGE(MDS) + \ + OPC_RANGE(LDLM) + \ + OPC_RANGE(MGS) + \ + OPC_RANGE(OBD) + \ + OPC_RANGE(LLOG) + \ + OPC_RANGE(SEC) + \ + OPC_RANGE(SEQ) + \ + OPC_RANGE(SEC) + \ + OPC_RANGE(FLD)) -#define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \ - OPC_RANGE(MDS) + \ - OPC_RANGE(LDLM) + \ - OPC_RANGE(MGS) + \ - OPC_RANGE(OBD) + \ - OPC_RANGE(LLOG) + \ - OPC_RANGE(SEC) + \ - OPC_RANGE(SEQ) + \ - OPC_RANGE(SEC) + \ - OPC_RANGE(FLD) + \ +#ifdef HAVE_SERVER_SUPPORT +#define LUSTRE_MAX_OPCODES (LUSTRE_MAX_OPCODES_CLIENT + \ OPC_RANGE(OUT_UPDATE) + \ OPC_RANGE(LFSCK)) +#else +#define LUSTRE_MAX_OPCODES LUSTRE_MAX_OPCODES_CLIENT +#endif #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \ OPC_RANGE(EXTRA)) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 884d79e..6969b71 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1588,6 +1588,12 @@ struct lu_tgt_qos { }; /* target descriptor */ +#define LOV_QOS_DEF_THRESHOLD_RR_PCT 17 +#define LMV_QOS_DEF_THRESHOLD_RR_PCT 5 + +#define LOV_QOS_DEF_PRIO_FREE 90 +#define LMV_QOS_DEF_PRIO_FREE 90 + struct lu_tgt_desc { union { struct dt_device *ltd_tgt; diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index fccb5ff..e82b847 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -306,6 +306,13 @@ static inline int fid_is_name_llog(const struct lu_fid *fid) return fid_seq(fid) == FID_SEQ_LLOG_NAME; } +static inline int fid_seq_in_fldb(u64 seq) +{ + return fid_seq_is_igif(seq) || fid_seq_is_norm(seq) || + fid_seq_is_root(seq) || fid_seq_is_dot(seq); +} + +#ifdef HAVE_SERVER_SUPPORT static inline int fid_is_namespace_visible(const struct lu_fid *fid) { const __u64 seq = fid_seq(fid); @@ -317,12 +324,6 @@ static inline int fid_is_namespace_visible(const struct lu_fid *fid) fid_is_root(fid) || fid_seq_is_dot(seq); } -static inline int fid_seq_in_fldb(__u64 seq) -{ - return fid_seq_is_igif(seq) || fid_seq_is_norm(seq) || - fid_seq_is_root(seq) || fid_seq_is_dot(seq); -} - static inline void ost_layout_cpu_to_le(struct ost_layout *dst, const struct ost_layout *src) { @@ -374,6 +375,7 @@ static inline void filter_fid_le_to_cpu(struct filter_fid *dst, /* XXX: Add more if filter_fid is enlarged in the future. */ } +#endif /* HAVE_SERVER_SUPPORT */ static inline void lu_last_id_fid(struct lu_fid *fid, __u64 seq, __u32 ost_idx) { diff --git a/lustre/include/lustre_lmv.h b/lustre/include/lustre_lmv.h index 811da36..6f302b3 100644 --- a/lustre/include/lustre_lmv.h +++ b/lustre/include/lustre_lmv.h @@ -116,16 +116,20 @@ lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2) static inline void lsm_md_dump(int mask, const struct lmv_stripe_md *lsm) { + bool valid_hash = lmv_dir_bad_hash(lsm); int i; /* If lsm_md_magic == LMV_MAGIC_FOREIGN pool_name may not be a null * terminated string so only print LOV_MAXPOOLNAME bytes. */ CDEBUG(mask, - "magic %#x stripe count %d master mdt %d hash type %#x max inherit %hhu version %d migrate offset %d migrate hash %#x pool %.*s\n", + "magic %#x stripe count %d master mdt %d hash type %s:%#x max inherit %hhu version %d migrate offset %d migrate hash %#x pool %.*s\n", lsm->lsm_md_magic, lsm->lsm_md_stripe_count, - lsm->lsm_md_master_mdt_index, lsm->lsm_md_hash_type, - lsm->lsm_md_max_inherit, lsm->lsm_md_layout_version, + lsm->lsm_md_master_mdt_index, + valid_hash ? "invalid hash" : + mdt_hash_name[lsm->lsm_md_hash_type & (LMV_HASH_TYPE_MAX - 1)], + lsm->lsm_md_hash_type, lsm->lsm_md_max_inherit, + lsm->lsm_md_layout_version, lsm->lsm_md_migrate_offset, lsm->lsm_md_migrate_hash, LOV_MAXPOOLNAME, lsm->lsm_md_pool_name); @@ -403,6 +407,17 @@ static inline bool lmv_user_magic_supported(__u32 lum_magic) lum_magic == LMV_MAGIC_FOREIGN; } +#define LMV_DEBUG(mask, lmv, msg) \ + CDEBUG(mask, \ + "%s LMV: magic=%#x count=%u index=%u hash=%s:%#x version=%u migrate offset=%u migrate hash=%s:%u.\n",\ + msg, (lmv)->lmv_magic, (lmv)->lmv_stripe_count, \ + (lmv)->lmv_master_mdt_index, \ + mdt_hash_name[(lmv)->lmv_hash_type & (LMV_HASH_TYPE_MAX - 1)],\ + (lmv)->lmv_hash_type, (lmv)->lmv_layout_version, \ + (lmv)->lmv_migrate_offset, \ + mdt_hash_name[(lmv)->lmv_migrate_hash & (LMV_HASH_TYPE_MAX - 1)],\ + (lmv)->lmv_migrate_hash) + /* master LMV is sane */ static inline bool lmv_is_sane(const struct lmv_mds_md_v1 *lmv) { diff --git a/lustre/include/lustre_swab.h b/lustre/include/lustre_swab.h index 7db43f6..2e9d9f5 100644 --- a/lustre/include/lustre_swab.h +++ b/lustre/include/lustre_swab.h @@ -50,9 +50,20 @@ #include +#ifdef HAVE_SERVER_SUPPORT void lustre_swab_orphan_ent(struct lu_orphan_ent *ent); void lustre_swab_orphan_ent_v2(struct lu_orphan_ent_v2 *ent); void lustre_swab_orphan_ent_v3(struct lu_orphan_ent_v3 *ent); +void lustre_swab_gl_lquota_desc(struct ldlm_gl_lquota_desc *desc); +void lustre_swab_gl_barrier_desc(struct ldlm_gl_barrier_desc *desc); +void lustre_swab_object_update(struct object_update *ou); +int lustre_swab_object_update_request(struct object_update_request *our, + __u32 len); +void lustre_swab_out_update_header(struct out_update_header *ouh); +void lustre_swab_out_update_buffer(struct out_update_buffer *oub); +void lustre_swab_object_update_result(struct object_update_result *our); +int lustre_swab_object_update_reply(struct object_update_reply *our, __u32 len); +#endif /* HAVE_SERVER_SUPPORT */ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); void lustre_swab_connect(struct obd_connect_data *ocd); void lustre_swab_hsm_user_state(struct hsm_user_state *hus); @@ -76,8 +87,6 @@ void lustre_swab_lmv_mds_md(union lmv_mds_md *lmm); void lustre_swab_lov_desc(struct lov_desc *ld); void lustre_swab_ldlm_res_id(struct ldlm_res_id *id); void lustre_swab_ldlm_policy_data(union ldlm_wire_policy_data *d); -void lustre_swab_gl_lquota_desc(struct ldlm_gl_lquota_desc *); -void lustre_swab_gl_barrier_desc(struct ldlm_gl_barrier_desc *); void lustre_swab_ldlm_intent(struct ldlm_intent *i); void lustre_swab_ldlm_resource_desc(struct ldlm_resource_desc *r); void lustre_swab_ldlm_lock_desc(struct ldlm_lock_desc *l); @@ -111,13 +120,6 @@ void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk); void lustre_swab_hsm_user_state(struct hsm_user_state *hus); void lustre_swab_hsm_user_item(struct hsm_user_item *hui); void lustre_swab_hsm_request(struct hsm_request *hr); -void lustre_swab_object_update(struct object_update *ou); -int lustre_swab_object_update_request(struct object_update_request *our, - __u32 len); -void lustre_swab_out_update_header(struct out_update_header *ouh); -void lustre_swab_out_update_buffer(struct out_update_buffer *oub); -void lustre_swab_object_update_result(struct object_update_result *our); -int lustre_swab_object_update_reply(struct object_update_reply *our, __u32 len); void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl); void lustre_swab_close_data(struct close_data *data); void lustre_swab_close_data_resync_done(struct close_data_resync_done *resync); diff --git a/lustre/include/obd.h b/lustre/include/obd.h index ed93ccf..49ab370 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -45,6 +45,7 @@ #ifdef HAVE_SERVER_SUPPORT # include # include +# include #endif #include #include @@ -53,7 +54,6 @@ #include #include #include -#include #define MAX_OBD_DEVICES 8192 diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 9dde5f7..4b15d6a 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -973,6 +973,7 @@ do { \ #define KEY_IS(str) \ (keylen >= (sizeof(str)-1) && memcmp(key, str, (sizeof(str)-1)) == 0) +#ifdef HAVE_SERVER_SUPPORT /* LUSTRE_LMA_FL_MASKS defines which flags will be stored in LMA */ static inline int lma_to_lustre_flags(__u32 lma_flags) @@ -986,6 +987,7 @@ static inline int lustre_to_lma_flags(__u32 la_flags) return (((la_flags & LUSTRE_ORPHAN_FL) ? LMAI_ORPHAN : 0) | ((la_flags & LUSTRE_ENCRYPT_FL) ? LMAI_ENCRYPT : 0)); } +#endif /* HAVE_SERVER_SUPPORT */ /* Convert wire LUSTRE_*_FL to corresponding client local VFS S_* values * for the client inode i_flags. The LUSTRE_*_FL are the Lustre wire diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index ff7765f..b0f22cb 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -2214,14 +2214,6 @@ struct lmv_mds_md_v1 { struct lu_fid lmv_stripe_fids[0]; /* FIDs for each stripe */ }; -#define LMV_DEBUG(mask, lmv, msg) \ - CDEBUG(mask, \ - "%s LMV: magic=%#x count=%u index=%u hash=%#x version=%u migrate offset=%u migrate hash=%u.\n", \ - msg, (lmv)->lmv_magic, (lmv)->lmv_stripe_count, \ - (lmv)->lmv_master_mdt_index, (lmv)->lmv_hash_type, \ - (lmv)->lmv_layout_version, (lmv)->lmv_migrate_offset, \ - (lmv)->lmv_migrate_hash) - /* stripe count before directory split */ #define lmv_split_offset lmv_migrate_offset /* stripe count after directory merge */ diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 308a526..9297f0d 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -718,12 +718,6 @@ struct fsxattr { #define LOV_OFFSET_DEFAULT ((__u16)-1) #define LMV_OFFSET_DEFAULT ((__u32)-1) -#define LOV_QOS_DEF_THRESHOLD_RR_PCT 17 -#define LMV_QOS_DEF_THRESHOLD_RR_PCT 5 - -#define LOV_QOS_DEF_PRIO_FREE 90 -#define LMV_QOS_DEF_PRIO_FREE 90 - static inline bool lov_pattern_supported(__u32 pattern) { return (pattern & ~LOV_PATTERN_F_RELEASED) == LOV_PATTERN_RAID0 || diff --git a/lustre/mdc/mdc_changelog.c b/lustre/mdc/mdc_changelog.c index 8a3f723..459f4f0 100644 --- a/lustre/mdc/mdc_changelog.c +++ b/lustre/mdc/mdc_changelog.c @@ -222,10 +222,9 @@ static int chlg_read_cat_process_cb(const struct lu_env *env, if (rec->cr_hdr.lrh_type != CHANGELOG_REC) { rc = -EINVAL; - CERROR("%s: not a changelog rec %x/%d in llog "DFID" rc = %d\n", + CERROR("%s: not a changelog rec %x/%d in llog : rc = %d\n", crs->crs_obd->obd_name, rec->cr_hdr.lrh_type, - rec->cr.cr_type, - PFID(lu_object_fid(&llh->lgh_obj->do_lu)), rc); + rec->cr.cr_type, rc); RETURN(rc); } diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 2e3c008..50d5660 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -132,9 +132,11 @@ static struct ll_rpc_opcode { { SEC_CTX_FINI, "sec_ctx_fini" }, { FLD_QUERY, "fld_query" }, { FLD_READ, "fld_read" }, +#ifdef HAVE_SERVER_SUPPORT { OUT_UPDATE, "out_update" }, { LFSCK_NOTIFY, "lfsck_notify" }, { LFSCK_QUERY, "lfsck_query" }, +#endif }; static struct ll_eopcode {