Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-9387

Remove function pointers from struct obd_ops

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • Lustre 2.11.0
    • 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

          Activity

            People

              wc-triage WC Triage
              sguminsx Steve Guminski (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: