From d3542819362758d7a4d21e489f53d750aedece4c Mon Sep 17 00:00:00 2001 From: Nathan Rutman Date: Wed, 13 Jan 2010 14:21:18 -0800 Subject: [PATCH 1/1] b=19505 changelogs - distinguish between SETATTR and [acm]time changes i=breitz i=LEIBOVICI Thomas --- lustre/include/lustre/lustre_user.h | 3 ++- lustre/mdd/mdd_device.c | 2 +- lustre/mdd/mdd_object.c | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 8da187d..d3fdb28 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -477,6 +477,7 @@ enum changelog_rec_type { CL_SETATTR = 14, CL_XATTR = 15, CL_HSM = 16, /* HSM specific events, see flags */ + CL_TIME = 17, /* mtime, atime, ctime change only */ 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", - "SATTR", "XATTR", "HSM" }; + "SATTR", "XATTR", "HSM", "TIME" }; if (type >= 0 && type < CL_LAST) return changelog_str[type]; return NULL; diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 9262fa9..b178527 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -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 */ - mdd->mdd_cl.mc_starttime = rec->cr.cr_time; + mdd->mdd_cl.mc_starttime = cfs_time_current_64(); OBD_FREE(rec, reclen); RETURN(rc); diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index aa9a5cd..e93d2a0 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -1250,7 +1250,7 @@ static int mdd_changelog_data_store(const struct lu_env *env, 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 @@ -1481,9 +1481,12 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj, } 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*/ -- 1.8.3.1