Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
Lustre 2.10.0
-
None
-
9223372036854775807
Description
The obd_ops struct contains a list of function pointers that are used to choose a handler function specialized to the obd type. The use of function pointers makes the code more difficult to read and debug. Instead, the correct handler function should be directly called.
struct obd_ops { struct module *owner; int (*iocontrol)(unsigned int cmd, struct obd_export *exp, int len, void *karg, void __user *uarg); int (*get_info)(const struct lu_env *env, struct obd_export *, __u32 keylen, void *key, __u32 *vallen, void *val, struct lov_stripe_md *lsm); ... }
Example: The function obd_iocontrol calls the function pointer obd_ops->iocontrol via the OBP macro.
static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void __user *uarg) { int rc; EXP_CHECK_DT_OP(exp, iocontrol); EXP_COUNTER_INCREMENT(exp, iocontrol); rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg); return rc; }
The iocontrol function pointer and obd_iocontrol() should be removed, and all calls to obd_iocontrol() should be replaced with calls to the appropriate handler function.
Attachments
Issue Links
- is related to
-
LU-9855 Clean up obdclass preprocessor code
-
- Resolved
-