CL_MTIME = 17, /* Precedence: setattr > mtime > ctime > atime */
CL_CTIME = 18,
CL_ATIME = 19,
+ CL_LAYOUT = 20,
CL_LAST
};
static const char *changelog_str[] = {
"MARK", "CREAT", "MKDIR", "HLINK", "SLINK", "MKNOD", "UNLNK",
"RMDIR", "RENME", "RNMTO", "OPEN", "CLOSE", "IOCTL", "TRUNC",
- "SATTR", "XATTR", "HSM", "MTIME", "CTIME", "ATIME" };
+ "SATTR", "XATTR", "HSM", "MTIME", "CTIME", "ATIME", "LAYOUT"
+ };
+
if (type >= 0 && type < CL_LAST)
return changelog_str[type];
return NULL;
if (rc)
GOTO(stop, rc);
+ rc = mdd_declare_changelog_store(env, mdd, NULL, handle);
+ if (rc)
+ GOTO(stop, rc);
+
rc = mdd_trans_start(env, mdd, handle);
if (rc)
GOTO(stop, rc);
rc = dt_xattr_set(env, mdd_object_child(son), buf, XATTR_NAME_LOV,
0, handle, mdd_object_capa(env, son));
+
+ if (rc)
+ GOTO(stop, rc);
+
+ rc = mdd_changelog_data_store(env, mdd, CL_LAYOUT, 0, son, handle);
+
stop:
mdd_trans_stop(env, mdd, rc, handle);
out_free:
struct thandle *handle);
int mdd_changelog_store(const struct lu_env *env, struct mdd_device *mdd,
struct llog_changelog_rec *rec, struct thandle *th);
+int mdd_changelog_data_store(const struct lu_env *env, struct mdd_device *mdd,
+ enum changelog_rec_type type, int flags,
+ struct mdd_object *mdd_obj,
+ struct thandle *handle);
int mdd_changelog_ns_store(const struct lu_env *env, struct mdd_device *mdd,
enum changelog_rec_type type, unsigned flags,
struct mdd_object *target, struct mdd_object *parent,
* \param mdd_obj - mdd_object of change
* \param handle - transacion handle
*/
-static int mdd_changelog_data_store(const struct lu_env *env,
- struct mdd_device *mdd,
- enum changelog_rec_type type,
- int flags, struct mdd_object *mdd_obj,
- struct thandle *handle)
+int mdd_changelog_data_store(const struct lu_env *env, struct mdd_device *mdd,
+ enum changelog_rec_type type, int flags,
+ struct mdd_object *mdd_obj, struct thandle *handle)
{
const struct lu_fid *tfid;
struct llog_changelog_rec *rec;
if (rc)
return rc;
- /* Only record user xattr changes */
- if ((strncmp("user.", name, 5) == 0)) {
+ /* Only record user and layout xattr changes */
+ if (strncmp(XATTR_USER_PREFIX, name,
+ sizeof(XATTR_USER_PREFIX) - 1) == 0 ||
+ strncmp(XATTR_NAME_LOV, name,
+ sizeof(XATTR_NAME_LOV) - 1) == 0) {
rc = mdd_declare_changelog_store(env, mdd, NULL, handle);
if (rc)
return rc;
}
/* If HSM data is modified, this could add a changelog */
- if (strncmp(XATTR_NAME_HSM, name, sizeof(XATTR_NAME_HSM) - 1) == 0)
+ if (strncmp(XATTR_NAME_HSM, name, sizeof(XATTR_NAME_HSM) - 1) == 0) {
rc = mdd_declare_changelog_store(env, mdd, NULL, handle);
+ if (rc)
+ return rc;
+ }
rc = mdd_declare_changelog_store(env, mdd, NULL, handle);
return rc;
if (rc)
GOTO(stop, rc);
- /* Only record system & user xattr changes */
- if (strncmp(XATTR_USER_PREFIX, name,
+ if (strncmp(XATTR_NAME_LOV, name, sizeof(XATTR_NAME_LOV) - 1) == 0)
+ rc = mdd_changelog_data_store(env, mdd, CL_LAYOUT, 0, mdd_obj,
+ handle);
+ else if (strncmp(XATTR_USER_PREFIX, name,
sizeof(XATTR_USER_PREFIX) - 1) == 0 ||
strncmp(POSIX_ACL_XATTR_ACCESS, name,
sizeof(POSIX_ACL_XATTR_ACCESS) - 1) == 0 ||
}
GOTO(stop, rc);
}
+
+ /* Issue one changelog record per file */
+ rc = mdd_changelog_data_store(env, mdd, CL_LAYOUT, 0, fst_o, handle);
+ if (rc)
+ GOTO(stop, rc);
+
+ rc = mdd_changelog_data_store(env, mdd, CL_LAYOUT, 0, snd_o, handle);
+ if (rc)
+ GOTO(stop, rc);
EXIT;
stop: