Current rename changelog stores source fid in both CL_RENAME & CL_EXT
records, which is redundant, and the 'tfid' in CL_EXT is never been
used.
Actually, we'd store target fid in the CL_EXT record, then application
could detect the fid unlinked by rename in changelog.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I0c616f813657a2faefa60a707f4fc1d9dc971b39
Reviewed-on: http://review.whamcloud.com/1652
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mikhail Pershin <tappro@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
if (rc == 0)
rc = mdd_changelog_ns_store(env, mdd, CL_RENAME, 0, mdd_tobj,
mdd_spobj, lf, lsname, handle);
if (rc == 0)
rc = mdd_changelog_ns_store(env, mdd, CL_RENAME, 0, mdd_tobj,
mdd_spobj, lf, lsname, handle);
+ if (rc == 0) {
+ struct lu_fid zero_fid;
+ fid_zero(&zero_fid);
+ /* If the rename target exist, The CL_EXT record should save
+ * the target fid as tfid, otherwise, use zero fid. LU-543 */
rc = mdd_changelog_ns_store(env, mdd, CL_EXT, 0, mdd_tobj,
rc = mdd_changelog_ns_store(env, mdd, CL_EXT, 0, mdd_tobj,
- mdd_tpobj, lf, ltname, handle);
+ mdd_tpobj,
+ mdd_tobj ? NULL : &zero_fid,
+ ltname, handle);
+ }
mdd_trans_stop(env, mdd, rc, handle);
if (mdd_sobj)
mdd_trans_stop(env, mdd, rc, handle);
if (mdd_sobj)