Whamcloud - gitweb
LU-14520 ldlm: replace mdl_mode_t with ldlm_mode 61/56761/7
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 22 Oct 2024 23:36:53 +0000 (17:36 -0600)
committerOleg Drokin <green@whamcloud.com>
Sun, 2 Feb 2025 06:26:25 +0000 (06:26 +0000)
The mdl_mode_t doesn't really provide any value, since it is just a
copy of enum ldlm_mode, so it is more clear to just use ldlm_mode
directly.  Remove mdl_mode_t and conversions to/from ldlm_mode.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I0153fc67f582e51d8a2001054fa58bfae9f2255a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56761
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/md_object.h
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h

index 3e9a2f9..086476e 100644 (file)
@@ -56,18 +56,6 @@ enum ma_valid {
 };
 
 typedef enum {
-       MDL_MINMODE     = 0,
-       MDL_EX          = 1,
-       MDL_PW          = 2,
-       MDL_PR          = 4,
-       MDL_CW          = 8,
-       MDL_CR          = 16,
-       MDL_NL          = 32,
-       MDL_GROUP       = 64,
-       MDL_MAXMODE
-} mdl_mode_t;
-
-typedef enum {
        MDT_NUL_LOCK = 0,
        MDT_REG_LOCK = BIT(0),
        MDT_PDO_LOCK = BIT(1),
@@ -309,9 +297,8 @@ struct md_dir_operations {
                          const struct lu_name *lname, struct lu_fid *fid,
                          struct md_op_spec *spec);
 
-       mdl_mode_t (*mdo_lock_mode)(const struct lu_env *env,
-                                   struct md_object *obj,
-                                   mdl_mode_t mode);
+       enum ldlm_mode (*mdo_lock_mode)(const struct lu_env *env,
+                         struct md_object *obj, enum ldlm_mode mode);
 
        int (*mdo_create)(const struct lu_env *env, struct md_object *pobj,
                          const struct lu_name *lname, struct md_object *child,
@@ -320,9 +307,8 @@ struct md_dir_operations {
 
        /** This method is used for creating data object for this meta object*/
        int (*mdo_create_data)(const struct lu_env *env, struct md_object *p,
-                              struct md_object *o,
-                              const struct md_op_spec *spec,
-                              struct md_attr *ma);
+                         struct md_object *o, const struct md_op_spec *spec,
+                         struct md_attr *ma);
 
        int (*mdo_rename)(const struct lu_env *env, struct md_object *spobj,
                          struct md_object *tpobj, const struct lu_fid *lf,
@@ -579,11 +565,12 @@ static inline int mdo_lookup(const struct lu_env *env, struct md_object *p,
        return p->mo_dir_ops->mdo_lookup(env, p, lname, f, spec);
 }
 
-static inline mdl_mode_t mdo_lock_mode(const struct lu_env *env,
-                                      struct md_object *mo, mdl_mode_t lm)
+static inline enum ldlm_mode mdo_lock_mode(const struct lu_env *env,
+                                          struct md_object *mo,
+                                          enum ldlm_mode lm)
 {
        if (mo->mo_dir_ops->mdo_lock_mode == NULL)
-               return MDL_MINMODE;
+               return LCK_MODE_MIN;
        return mo->mo_dir_ops->mdo_lock_mode(env, mo, lm);
 }
 
index 0ae495c..765f413 100644 (file)
@@ -83,28 +83,6 @@ MODULE_PARM_DESC(max_mod_rpcs_per_client,
        "maximum number of modify RPCs in flight allowed per client (Deprecated)");
 #endif
 
-mdl_mode_t mdt_mdl_lock_modes[] = {
-       [LCK_MODE_MIN]  = MDL_MINMODE,
-       [LCK_EX]        = MDL_EX,
-       [LCK_PW]        = MDL_PW,
-       [LCK_PR]        = MDL_PR,
-       [LCK_CW]        = MDL_CW,
-       [LCK_CR]        = MDL_CR,
-       [LCK_NL]        = MDL_NL,
-       [LCK_GROUP]     = MDL_GROUP
-};
-
-enum ldlm_mode mdt_dlm_lock_modes[] = {
-       [MDL_MINMODE]   = LCK_MODE_MIN,
-       [MDL_EX]        = LCK_EX,
-       [MDL_PW]        = LCK_PW,
-       [MDL_PR]        = LCK_PR,
-       [MDL_CW]        = LCK_CW,
-       [MDL_CR]        = LCK_CR,
-       [MDL_NL]        = LCK_NL,
-       [MDL_GROUP]     = LCK_GROUP
-};
-
 static struct mdt_device *mdt_dev(struct lu_device *d);
 
 static const struct lu_object_operations mdt_obj_ops;
@@ -221,7 +199,7 @@ void mdt_lock_pdo_init(struct mdt_lock_handle *lh, enum ldlm_mode lock_mode,
 static void mdt_lock_pdo_mode(struct mdt_thread_info *info, struct mdt_object *o,
                              struct mdt_lock_handle *lh)
 {
-       mdl_mode_t mode;
+       enum ldlm_mode mode;
 
        ENTRY;
 
@@ -254,18 +232,18 @@ static void mdt_lock_pdo_mode(struct mdt_thread_info *info, struct mdt_object *o
         * Ask underlaying level its opinion about preferable PDO lock mode
         * having access type passed as regular lock mode:
         *
-        * - MDL_MINMODE means that lower layer does not want to specify lock
+        * - LCK_MODE_MIN means that lower layer does not want to specify lock
         * mode;
         *
-        * - MDL_NL means that no PDO lock should be taken. This is used in some
+        * - LCK_NL means that no PDO lock should be taken. This is used in some
         * cases. Say, for non-splittable directories no need to use PDO locks
         * at all.
         */
        mode = mdo_lock_mode(info->mti_env, mdt_object_child(o),
-                            mdt_dlm_mode2mdl_mode(lh->mlh_reg_mode));
+                            lh->mlh_reg_mode);
 
-       if (mode != MDL_MINMODE) {
-               lh->mlh_pdo_mode = mdt_mdl_mode2dlm_mode(mode);
+       if (mode != LCK_MODE_MIN) {
+               lh->mlh_pdo_mode = mode;
        } else {
                /*
                 * Lower layer does not want to specify locking mode. We do it
index 59444c3..9fc7bbf 100644 (file)
@@ -1275,23 +1275,6 @@ static inline bool mdt_slc_is_enabled(struct mdt_device *mdt)
        return mdt->mdt_lut.lut_sync_lock_cancel == SYNC_LOCK_CANCEL_BLOCKING;
 }
 
-extern mdl_mode_t mdt_mdl_lock_modes[];
-extern enum ldlm_mode mdt_dlm_lock_modes[];
-
-/* LCK_MODE_MIN which is zero returns false for is_power_of_2 */
-
-static inline mdl_mode_t mdt_dlm_mode2mdl_mode(enum ldlm_mode mode)
-{
-       LASSERT(mode == LCK_MODE_MIN || is_power_of_2(mode));
-       return mdt_mdl_lock_modes[mode];
-}
-
-static inline enum ldlm_mode mdt_mdl_mode2dlm_mode(mdl_mode_t mode)
-{
-       LASSERT(mode == MDL_MINMODE || is_power_of_2(mode));
-       return mdt_dlm_lock_modes[mode];
-}
-
 /* mdt_som.c */
 int mdt_set_som(struct mdt_thread_info *info, struct mdt_object *obj,
                enum lustre_som_flags flag, __u64 size, __u64 blocks);