From a89dfe097476af90fce3c9d878267bbff1c055c9 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 2 Oct 2015 13:19:05 -0600 Subject: [PATCH] LU-1095 obdclass: improve missing operation message Some tests in the past reported missing OBD operations, so improve the error message to include the device name to make it easier to debug where this is happening. Signed-off-by: Andreas Dilger Change-Id: Id49ab801158690510f9ac191c4e8f7a253bcab07 Reviewed-on: https://review.whamcloud.com/25586 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/include/obd_class.h | 117 ++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 60 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 2f85a99..38c2c49 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -433,77 +433,74 @@ do { \ static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp) { - /* Always add in ldlm_stats */ - tmp->nid_ldlm_stats = lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC - ,LPROCFS_STATS_FLAG_NOPERCPU); - if (tmp->nid_ldlm_stats == NULL) - return -ENOMEM; - - lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats); - - return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats", - tmp->nid_ldlm_stats); -} - -#define EXP_CHECK_MD_OP(exp, op) \ -do { \ - if ((exp) == NULL) { \ - CERROR("obd_" #op ": NULL export\n"); \ - RETURN(-ENODEV); \ - } \ - if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \ - CERROR("obd_" #op ": cleaned up obd\n"); \ - RETURN(-EOPNOTSUPP); \ - } \ - if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \ - CERROR("obd_" #op ": dev %s/%d no operation\n", \ - (exp)->exp_obd->obd_name, \ - (exp)->exp_obd->obd_minor); \ - RETURN(-EOPNOTSUPP); \ - } \ + /* Always add in ldlm_stats */ + tmp->nid_ldlm_stats = + lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC, + LPROCFS_STATS_FLAG_NOPERCPU); + if (tmp->nid_ldlm_stats == NULL) + return -ENOMEM; + + lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats); + + return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats", + tmp->nid_ldlm_stats); +} + +#define EXP_CHECK_MD_OP(exp, op) \ +do { \ + if ((exp) == NULL) { \ + CERROR("obd_" #op ": NULL export\n"); \ + RETURN(-ENODEV); \ + } \ + if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \ + CERROR("obd_" #op ": cleaned up obd\n"); \ + RETURN(-EOPNOTSUPP); \ + } \ + if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \ + CERROR("%s: obd_" #op ": dev %d no operation\n", \ + (exp)->exp_obd->obd_name, \ + (exp)->exp_obd->obd_minor); \ + RETURN(-EOPNOTSUPP); \ + } \ } while (0) -#define OBD_CHECK_DT_OP(obd, op, err) \ -do { \ - if (!OBT(obd) || !OBP((obd), op)) { \ - if (err) \ - CERROR("obd_" #op ": dev %d no operation\n", \ - obd->obd_minor); \ - RETURN(err); \ - } \ +#define OBD_CHECK_DT_OP(obd, op, err) \ +do { \ + if (!OBT(obd) || !OBP((obd), op)) { \ + if (err) \ + CERROR("%s: no obd_" #op " operation\n", \ + obd->obd_name); \ + RETURN(err); \ + } \ } while (0) -#define EXP_CHECK_DT_OP(exp, op) \ -do { \ - if ((exp) == NULL) { \ - CERROR("obd_" #op ": NULL export\n"); \ - RETURN(-ENODEV); \ - } \ - if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \ - CERROR("obd_" #op ": cleaned up obd\n"); \ - RETURN(-EOPNOTSUPP); \ - } \ - if (!OBT((exp)->exp_obd) || !OBP((exp)->exp_obd, op)) { \ - CERROR("obd_" #op ": dev %d no operation\n", \ - (exp)->exp_obd->obd_minor); \ - RETURN(-EOPNOTSUPP); \ - } \ +#define EXP_CHECK_DT_OP(exp, op) \ +do { \ + if ((exp) == NULL) { \ + CERROR("obd_" #op ": NULL export\n"); \ + RETURN(-ENODEV); \ + } \ + if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \ + CERROR("obd_" #op ": cleaned up obd\n"); \ + RETURN(-EOPNOTSUPP); \ + } \ + OBD_CHECK_DT_OP((exp)->exp_obd, op, -EOPNOTSUPP); \ } while (0) -#define CTXT_CHECK_OP(ctxt, op, err) \ -do { \ - if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \ - if (err) \ - CERROR("lop_" #op ": dev %d no operation\n", \ - ctxt->loc_obd->obd_minor); \ - RETURN(err); \ - } \ +#define CTXT_CHECK_OP(ctxt, op, err) \ +do { \ + if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \ + if (err) \ + CERROR("%s: no lop_" #op "operation\n", \ + ctxt->loc_obd->obd_name); \ + RETURN(err); \ + } \ } while (0) static inline int class_devno_max(void) { - return MAX_OBD_DEVICES; + return MAX_OBD_DEVICES; } static inline int obd_get_info(const struct lu_env *env, struct obd_export *exp, -- 1.8.3.1