From 3cfbd9515a8adb88a807045dfff7a4017f93e7f7 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 25 Apr 2024 22:02:14 -0600 Subject: [PATCH] EX-9588 lipe: lipe_scan3 compatibility for EXA5.2.8 Add a compatibility implementation of llapi_layout_compress_get() so lipe_scan3 can run on EXA5.2.8 that has an old liblustreapi.so without this function. Test-Parameters: trivial testlist=sanity-lipe-scan3,sanity-lipe-find3 Signed-off-by: Andreas Dilger Change-Id: I7de9164467ea889ee2d47c7fbb18bfd7acce7057 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54924 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Vitaliy Kuznetsov --- lipe/src/lipe_scan3/ls3_stats.c | 75 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/lipe/src/lipe_scan3/ls3_stats.c b/lipe/src/lipe_scan3/ls3_stats.c index f4c1d8b..d0b0458 100644 --- a/lipe/src/lipe_scan3/ls3_stats.c +++ b/lipe/src/lipe_scan3/ls3_stats.c @@ -2506,6 +2506,75 @@ static void ls3_stats_update_user_report_range(ls3_stats_users_reports report_ty pthread_mutex_unlock(&report_ptr->report_template_mutex); } +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 16, 53, 0) +/* compatibility so lipe_scan3 can run on EXA5 that is missing this function */ + +struct llapi_layout_comp { + uint64_t llc_pattern; + struct { /* For plain layout. */ + uint64_t llc_stripe_size; + uint64_t llc_stripe_count; + uint64_t llc_stripe_offset; + /** + * Add 1 so user always gets back a null terminated string. + */ + char llc_pool_name[LOV_MAXPOOLNAME + 1]; + /** + * Number of objects in llc_objects array if was initialized. + */ + uint32_t llc_objects_count; + uint8_t llc_compr_type; + uint8_t llc_compr_lvl; + uint8_t llc_compr_chunk_log_bits; + struct lov_user_ost_data_v1 *llc_objects; + }; +}; + +#ifndef LLAPI_LAYOUT_MAGIC +#define LLAPI_LAYOUT_MAGIC 0x11AD1107 /* LLAPILOT */ +#endif + +struct llapi_layout { + uint32_t llot_magic; /* LLAPI_LAYOUT_MAGIC */ + uint32_t llot_gen; + uint32_t llot_flags; + bool llot_is_composite; + uint16_t llot_mirror_count; + /* Cursor pointing to one of the components in llot_comp_list */ + struct llapi_layout_comp *llot_cur_comp; + struct lipe_list_head llot_comp_list; +}; + +static struct llapi_layout_comp * +__llapi_layout_cur_comp(const struct llapi_layout *layout) +{ + if (layout == NULL || layout->llot_magic != LLAPI_LAYOUT_MAGIC) { + errno = EINVAL; + return NULL; + } + if (layout->llot_cur_comp == NULL) + errno = EINVAL; + + return layout->llot_cur_comp; +} + +int llapi_layout_compress_get(struct llapi_layout *layout, + __u8 *type, __u8 *level) +{ + struct llapi_layout_comp *comp; + + comp = __llapi_layout_cur_comp(layout); + if (comp == NULL) + return -1; + + if (type) + *type = comp->llc_compr_type; + if (level) + *level = comp->llc_compr_lvl; + + return 0; +} +#endif int ls3_stats_update_info(struct ls3_object_attrs *loa_all) { @@ -2676,12 +2745,12 @@ int ls3_stats_update_info(struct ls3_object_attrs *loa_all) if (rc < 0 || compr_type == LL_COMPR_TYPE_NONE) return 0; /* skip compression statistics */ - /* TODO: Сompression statistics from MDT by type & lvl */ + /* TODO: Compression statistics from MDT by type & lvl */ } else { struct filter_fid ptr_filter_fid; struct ost_layout ptr_ost_layout; - struct ost_layout_compr layout_compr; + struct ost_layout_compr layout_compr; ptr_filter_fid = loa_all->loa_filter_fid; layout_compr = ptr_filter_fid.ff_layout_compr; @@ -2697,7 +2766,7 @@ int ls3_stats_update_info(struct ls3_object_attrs *loa_all) if (layout_compr.ol_compr_type == LL_COMPR_TYPE_NONE) return 0; /* skip compression statistics */ - /* TODO: Сompression statistics from OST by type & lvl + /* TODO: Compression statistics from OST by type & lvl * with using struct ost_layout_compr */ } -- 1.8.3.1