Whamcloud - gitweb
b=19505 changelogs - distinguish between SETATTR and [acm]time changes
authorNathan Rutman <nathan.rutman@sun.com>
Wed, 13 Jan 2010 22:21:18 +0000 (14:21 -0800)
committerRobert Read <robert.read@oracle.com>
Wed, 7 Apr 2010 17:23:25 +0000 (10:23 -0700)
i=breitz
i=LEIBOVICI Thomas <thomas.leibovici@cea.fr>

lustre/include/lustre/lustre_user.h
lustre/mdd/mdd_device.c
lustre/mdd/mdd_object.c

index 8da187d..d3fdb28 100644 (file)
@@ -477,6 +477,7 @@ enum changelog_rec_type {
         CL_SETATTR  = 14,
         CL_XATTR    = 15,
         CL_HSM      = 16, /* HSM specific events, see flags */
         CL_SETATTR  = 14,
         CL_XATTR    = 15,
         CL_HSM      = 16, /* HSM specific events, see flags */
+        CL_TIME     = 17, /* mtime, atime, ctime change only */
         CL_LAST
 };
 
         CL_LAST
 };
 
@@ -484,7 +485,7 @@ static inline const char *changelog_type2str(int type) {
         static const char *changelog_str[] = {
                 "MARK",  "CREAT", "MKDIR", "HLINK", "SLINK", "MKNOD", "UNLNK",
                 "RMDIR", "RNMFM", "RNMTO", "OPEN",  "CLOSE", "IOCTL", "TRUNC",
         static const char *changelog_str[] = {
                 "MARK",  "CREAT", "MKDIR", "HLINK", "SLINK", "MKNOD", "UNLNK",
                 "RMDIR", "RNMFM", "RNMTO", "OPEN",  "CLOSE", "IOCTL", "TRUNC",
-                "SATTR", "XATTR", "HSM"   };
+                "SATTR", "XATTR", "HSM",   "TIME"  };
         if (type >= 0 && type < CL_LAST)
                 return changelog_str[type];
         return NULL;
         if (type >= 0 && type < CL_LAST)
                 return changelog_str[type];
         return NULL;
index 9262fa9..b178527 100644 (file)
@@ -415,7 +415,7 @@ int mdd_changelog_write_header(struct mdd_device *mdd, int markerflags)
         rc = mdd_changelog_llog_write(mdd, rec, NULL);
 
         /* assume on or off event; reset repeat-access time */
         rc = mdd_changelog_llog_write(mdd, rec, NULL);
 
         /* assume on or off event; reset repeat-access time */
-        mdd->mdd_cl.mc_starttime = rec->cr.cr_time;
+        mdd->mdd_cl.mc_starttime = cfs_time_current_64();
 
         OBD_FREE(rec, reclen);
         RETURN(rc);
 
         OBD_FREE(rec, reclen);
         RETURN(rc);
index aa9a5cd..e93d2a0 100644 (file)
@@ -1250,7 +1250,7 @@ static int mdd_changelog_data_store(const struct lu_env     *env,
         LASSERT(handle != NULL);
         LASSERT(mdd_obj != NULL);
 
         LASSERT(handle != NULL);
         LASSERT(mdd_obj != NULL);
 
-        if ((type == CL_SETATTR) &&
+        if ((type == CL_TIME) &&
             cfs_time_before_64(mdd->mdd_cl.mc_starttime, mdd_obj->mod_cltime)) {
                 /* Don't need multiple updates in this log */
                 /* Don't check under lock - no big deal if we get an extra
             cfs_time_before_64(mdd->mdd_cl.mc_starttime, mdd_obj->mod_cltime)) {
                 /* Don't need multiple updates in this log */
                 /* Don't check under lock - no big deal if we get an extra
@@ -1481,9 +1481,12 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
 
         }
 cleanup:
 
         }
 cleanup:
-        if ((rc == 0) && (ma->ma_attr.la_valid & (LA_MTIME | LA_CTIME)))
-                rc = mdd_changelog_data_store(env, mdd, CL_SETATTR, mdd_obj,
-                                              handle);
+        if (rc == 0)
+                rc = mdd_changelog_data_store(env, mdd,
+                                              (ma->ma_attr.la_valid &
+                                               ~(LA_MTIME|LA_CTIME|LA_ATIME)) ?
+                                              CL_SETATTR : CL_TIME,
+                                              mdd_obj, handle);
         mdd_trans_stop(env, mdd, rc, handle);
         if (rc == 0 && (lmm != NULL && lmm_size > 0 )) {
                 /*set obd attr, if needed*/
         mdd_trans_stop(env, mdd, rc, handle);
         if (rc == 0 && (lmm != NULL && lmm_size > 0 )) {
                 /*set obd attr, if needed*/