Whamcloud - gitweb
LU-9679 modules: convert MIN/MAX to kernel style
[fs/lustre-release.git] / lustre / mdd / mdd_object.c
index 6df8870..bfc4ae6 100644 (file)
@@ -1218,8 +1218,9 @@ int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
 
        /* no need to setattr anymore */
        if (la_copy->la_valid == 0) {
-               CDEBUG(D_INODE, "%s: no valid attribute on "DFID", previous"
-                      "valid is %#llx\n", mdd2obd_dev(mdd)->obd_name,
+               CDEBUG(D_INODE,
+                      "%s: no valid attribute on "DFID", previous valid is %#llx\n",
+                      mdd2obd_dev(mdd)->obd_name,
                       PFID(mdo2fid(mdd_obj)), la->la_valid);
 
                RETURN(0);
@@ -1362,7 +1363,7 @@ static inline bool has_prefix(const char *str, const char *prefix)
  *
  * \param[in]  xattr_name  Full extended attribute name.
  *
- * \return The type of changelog to use, or -1 if no changelog is to be emitted.
+ * \return type of changelog to use, or CL_NONE if no changelog is to be emitted
  */
 static enum changelog_rec_type
 mdd_xattr_changelog_type(const struct lu_env *env, struct mdd_device *mdd,
@@ -1370,8 +1371,8 @@ mdd_xattr_changelog_type(const struct lu_env *env, struct mdd_device *mdd,
 {
        /* Layout changes systematically recorded */
        if (strcmp(XATTR_NAME_LOV, xattr_name) == 0 ||
-           strncmp(XATTR_LUSTRE_LOV, xattr_name,
-                   strlen(XATTR_LUSTRE_LOV)) == 0)
+           strcmp(XATTR_LUSTRE_LOV, xattr_name) == 0 ||
+           allowed_lustre_lov(xattr_name))
                return CL_LAYOUT;
 
        /* HSM information changes systematically recorded */
@@ -1442,7 +1443,8 @@ static int mdd_hsm_update_locked(const struct lu_env *env,
 
        /* Read HSM attrs from disk */
        current_buf = lu_buf_check_and_alloc(&info->mti_xattr_buf,
-                       MIN(mdd_obj2mdd_dev(mdd_obj)->mdd_dt_conf.ddp_max_ea_size,
+                       min_t(unsigned int,
+                             mdd_obj2mdd_dev(mdd_obj)->mdd_dt_conf.ddp_max_ea_size,
                            XATTR_SIZE_MAX));
        rc = mdo_xattr_get(env, mdd_obj, current_buf, XATTR_NAME_HSM);
        rc = lustre_buf2hsm(current_buf->lb_buf, rc, current_mh);
@@ -2323,7 +2325,7 @@ static int mdd_swap_layouts(const struct lu_env *env, struct md_object *obj1,
 
        ENTRY;
 
-       CLASSERT(ARRAY_SIZE(info->mti_buf) >= 4);
+       BUILD_BUG_ON(ARRAY_SIZE(info->mti_buf) < 4);
        memset(info->mti_buf, 0, sizeof(info->mti_buf));
 
        /* we have to sort the 2 obj, so locking will always