Whamcloud - gitweb
LU-2430 mdd: add lfs mv to migrate inode.
[fs/lustre-release.git] / lustre / ofd / ofd_objects.c
index cd8c26a..3917969 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <dt_object.h>
 #include <lustre/lustre_idl.h>
+#include <lustre_lfsck.h>
 
 #include "ofd_internal.h"
 
@@ -231,7 +232,7 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
 
        th->th_sync |= sync;
 
-       rc = dt_declare_record_write(env, oseq->os_lastid_obj, sizeof(tmp),
+       rc = dt_declare_record_write(env, oseq->os_lastid_obj, &info->fti_buf,
                                     info->fti_off, th);
        if (rc)
                GOTO(trans_stop, rc);
@@ -270,7 +271,7 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
 
         /* When the LFSCK scanning the whole device to verify the LAST_ID file
          * consistency, it will load the last_id into RAM firstly, and compare
-         * the last_id with echo OST-object's ID. If the later one is larger,
+         * the last_id with each OST-object's ID. If the later one is larger,
          * then it will regard the LAST_ID file crashed. But during the LFSCK
          * scanning, the OFD may continue to create new OST-objects. Those new
          * created OST-objects will have larger IDs than the LFSCK known ones.
@@ -295,7 +296,16 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
                fo = batch[i];
                LASSERT(fo);
 
-               if (likely(!ofd_object_exists(fo))) {
+               /* Only the new created objects need to be recorded. */
+               if (ofd->ofd_osd->dd_record_fid_accessed) {
+                       lfsck_pack_rfa(&ofd_info(env)->fti_lr,
+                                      lu_object_fid(&fo->ofo_obj.do_lu));
+                       lfsck_in_notify(env, ofd->ofd_osd,
+                                       &ofd_info(env)->fti_lr);
+               }
+
+               if (likely(!ofd_object_exists(fo) &&
+                          !OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DANGLING))) {
                        next = ofd_object_child(fo);
                        LASSERT(next != NULL);