Details
-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
Lustre 2.18.0
-
3
-
9223372036854775807
Description
There are many places in the LOV code where CERROR() messages are printed without any leading OBD device name, when it is actually possible to get the device/filesystem name from a dt_device or lu_device or lu_object in the function.
In general, there are lots of callers that are using the lengthy "dt_dev->dd_lu_dev.ld_obd->obd_name" and similar to extract the device name, when they could be using a more compact form like lu_dev_name(&dt_dev->dd_lu_dev). This can be seen in about 100 places in the code (via "git grep 'ld_obd.*obd_name'").
Many of these callers could use another helper function to extract the device name directly from a dt_device could be used ("git grep 'dd_lu_dev.*obd_name'
shows about 40 uses, though they all overlap with the ld_obd.*obd_name cases):
static inline const char *dt_dev_name(const struct dt_device *dt) { return lu_dev_name(&dt->dd_lu_dev); }
Similary, extracting the device name from an lu_object would also be useful (13 callers appear in "git grep 'obj.*obd_name'", but I expect there are more CERROR() messages where these could be used:
static inline const char *luobj_dev_name(const struct lu_object *obj) { return lu_dev_name(obj->lo_dev); }
It also makes sense to add a corresponding helper function in lustre/lov/lov_cl_internal.h to simplify callers in lustre/lov/lov_io.c:
static inline const char *lovobj_dev_name(const struct lov_object *lovobj) { return lu_dev_name(lov2lu(lovobj)->lo_dev); }
This should also add a regexp to contrib/scripts/spelling.txt to catch these cases:
dd_lu_dev.*obd_name||dt_dev_name() ld_obd.*obd_name||lu_dev_name() obj.*obd_name||luobj_dev_name()