#define DEBUG_SUBSYSTEM S_MDS
#include <linux/module.h>
+#ifdef HAVE_EXT4_LDISKFS
+#include <ldiskfs/ldiskfs_jbd2.h>
+#else
#include <linux/jbd.h>
+#endif
#include <obd.h>
#include <obd_class.h>
#include <lustre_ver.h>
#include <obd_support.h>
#include <lprocfs_status.h>
-
+#ifdef HAVE_EXT4_LDISKFS
+#include <ldiskfs/ldiskfs.h>
+#else
#include <linux/ldiskfs_fs.h>
+#endif
#include <lustre_mds.h>
#include <lustre/lustre_idl.h>
#include <lustre_fid.h>
RETURN(-ENOMEM);
rec = (struct llog_changelog_rec *)buf->lb_buf;
- rec->cr_flags = CLF_VERSION;
- rec->cr_type = (__u32)type;
+ rec->cr.cr_flags = CLF_VERSION;
+ rec->cr.cr_type = (__u32)type;
tfid = tf ? tf : mdo2fid(target);
- rec->cr_tfid = *tfid;
- rec->cr_pfid = *tpfid;
- rec->cr_namelen = tname->ln_namelen;
- memcpy(rec->cr_name, tname->ln_name, rec->cr_namelen);
+ rec->cr.cr_tfid = *tfid;
+ rec->cr.cr_pfid = *tpfid;
+ rec->cr.cr_namelen = tname->ln_namelen;
+ memcpy(rec->cr.cr_name, tname->ln_name, rec->cr.cr_namelen);
if (likely(target))
target->mod_cltime = cfs_time_current_64();
GOTO(cleanup, rc);
/* "mv dir1 dir2" needs "dir1/.." link update */
- if (is_dir && mdd_sobj) {
+ if (is_dir && mdd_sobj && !lu_fid_eq(spobj_fid, tpobj_fid)) {
rc = __mdd_index_delete_only(env, mdd_sobj, dotdot, handle,
mdd_object_capa(env, mdd_sobj));
if (rc)
rc = __mdd_index_insert_only(env, mdd_sobj, tpobj_fid, dotdot,
handle, mdd_object_capa(env, mdd_sobj));
- if (rc) {
+ if (rc)
GOTO(fixup_spobj, rc);
- }
}
/* Remove target name from target directory
lee = (struct link_ea_entry *)(leh + 1); /* link #0 */
/* Find the old record */
- for(count = 0; count <= leh->leh_reccount; count++) {
+ for(count = 0; count < leh->leh_reccount; count++) {
mdd_lee_unpack(lee, &reclen, tmpname, tmpfid);
if (tmpname->ln_namelen == oldlname->ln_namelen &&
lu_fid_eq(tmpfid, oldpfid) &&
break;
lee = (struct link_ea_entry *)((char *)lee + reclen);
}
- if (count > leh->leh_reccount) {
+ if ((count + 1) > leh->leh_reccount) {
CDEBUG(D_INODE, "Old link_ea name '%.*s' not found\n",
oldlname->ln_namelen, oldlname->ln_name);
GOTO(out, rc = -ENOENT);