Whamcloud - gitweb
LU-9679 modules: convert MIN/MAX to kernel style
[fs/lustre-release.git] / lustre / ofd / ofd_objects.c
index e98e72b..d7ca9f3 100644 (file)
@@ -280,7 +280,7 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
                RETURN(rc = -ENOSPC);
        }
 
-       OBD_ALLOC(batch, nr_saved * sizeof(struct ofd_object *));
+       OBD_ALLOC(batch, nr_saved * sizeof(*batch));
        if (batch == NULL)
                RETURN(-ENOMEM);
 
@@ -462,7 +462,7 @@ out:
                        continue;
                ofd_object_put(env, fo);
        }
-       OBD_FREE(batch, nr_saved * sizeof(struct ofd_object *));
+       OBD_FREE(batch, nr_saved * sizeof(*batch));
 
        CDEBUG((objects == 0 && rc == 0) ? D_ERROR : D_OTHER,
               "created %d/%d objects: %d\n", objects, nr_saved, rc);
@@ -621,8 +621,9 @@ int ofd_object_ff_update(const struct lu_env *env, struct ofd_object *fo,
                        ff->ff_layout_version = oa->o_layout_version;
                        ff->ff_range = 0;
                } else if (oa->o_layout_version > ff->ff_layout_version) {
-                       ff->ff_range = MAX(ff->ff_range,
-                                 oa->o_layout_version - ff->ff_layout_version);
+                       ff->ff_range = max_t(__u32, ff->ff_range,
+                                            oa->o_layout_version -
+                                            ff->ff_layout_version);
                }
        }
 
@@ -664,10 +665,6 @@ int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
        if (!ofd_object_exists(fo))
                GOTO(out, rc = -ENOENT);
 
-       if (la->la_valid & (LA_ATIME | LA_MTIME | LA_CTIME))
-               tgt_fmd_update(info->fti_exp, &fo->ofo_header.loh_fid,
-                              info->fti_xid);
-
        /* VBR: version recovery check */
        rc = ofd_version_get_check(info, fo);
        if (rc)
@@ -700,6 +697,11 @@ int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
        if (!ofd_object_exists(fo))
                GOTO(unlock, rc = -ENOENT);
 
+       /* serialize vs ofd_commitrw_write() */
+       if (la->la_valid & (LA_ATIME | LA_MTIME | LA_CTIME))
+               tgt_fmd_update(info->fti_exp, &fo->ofo_header.loh_fid,
+                              info->fti_xid);
+
        rc = dt_attr_set(env, ofd_object_child(fo), la, th);
        if (rc)
                GOTO(unlock, rc);