struct llog_thread_info *lgi = llog_info(env);
bool need_cookie;
bool update_attr;
+ unsigned long timestamp;
int rc;
ENTRY;
* size/block needs to be written anyway; 2) update for catalog
* since this doesn't happen very often
*/
- update_attr = (idx == LLOG_NEXT_IDX ||
- (loghandle->lgh_hdr &&
- loghandle->lgh_hdr->llh_flags & LLOG_F_IS_CAT));
+ timestamp = ktime_get_real_seconds();
+
+ update_attr = (timestamp != loghandle->lgh_timestamp) &&
+ (idx == LLOG_NEXT_IDX ||
+ (loghandle->lgh_hdr &&
+ loghandle->lgh_hdr->llh_flags & LLOG_F_IS_CAT));
if (update_attr)
dt_declare_attr_set(env, loghandle->lgh_obj, NULL, th);
rc = llog_write_rec(env, loghandle, rec, NULL, idx, th);
}
if (rc == 0 && update_attr) {
+ loghandle->lgh_timestamp = timestamp;
lgi->lgi_attr.la_valid = LA_MTIME;
- lgi->lgi_attr.la_mtime = ktime_get_real_seconds();
+ lgi->lgi_attr.la_mtime = timestamp;
dt_attr_set(env, loghandle->lgh_obj, &lgi->lgi_attr, th);
}
if (rc == -ENOSPC && llog_is_full(loghandle))
rc = -ENOBUFS;
} else {
- /* no overhead since inode size needs to be written anyway */
- lgi->lgi_attr.la_valid = LA_MTIME;
- lgi->lgi_attr.la_mtime = ktime_get_real_seconds();
- dt_attr_set(env, loghandle->lgh_obj, &lgi->lgi_attr, th);
+ unsigned long timestamp = ktime_get_real_seconds();
+ if (timestamp != loghandle->lgh_timestamp) {
+ loghandle->lgh_timestamp = timestamp;
+ lgi->lgi_attr.la_valid = LA_MTIME;
+ lgi->lgi_attr.la_mtime = timestamp;
+ dt_attr_set(env, loghandle->lgh_obj, &lgi->lgi_attr, th);
+ }
}
up_write(&loghandle->lgh_lock);