Whamcloud - gitweb
LU-11803 obd: replace class_uuid with linux kernel version.
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_scrub.c
index 0e83f0c..8d405ba 100644 (file)
@@ -163,13 +163,13 @@ static int
 osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
                     struct inode *inode, const struct lu_fid *fid)
 {
-       struct filter_fid_old   *ff      = &info->oti_ff;
-       struct dentry           *dentry  = &info->oti_obj_dentry;
-       struct lu_fid           *tfid    = &info->oti_fid;
-       handle_t                *jh;
-       int                      size    = 0;
-       int                      rc;
-       bool                     reset   = false;
+       struct filter_fid_18_23 *ff = &info->oti_ff_old;
+       struct dentry *dentry = &info->oti_obj_dentry;
+       struct lu_fid *tfid = &info->oti_fid;
+       bool fid_18_23 = false;
+       handle_t *jh;
+       int size = 0;
+       int rc;
        ENTRY;
 
        if (dev->od_scrub.os_scrub.os_file.sf_param & SP_DRYRUN)
@@ -212,14 +212,14 @@ osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
                if (rc)
                        GOTO(stop, rc);
 
-               reset = true;
-       } else if (rc != -ENODATA && rc != sizeof(struct filter_fid)) {
+               fid_18_23 = true;
+       } else if (rc != -ENODATA && rc < (int)sizeof(struct filter_fid_24_29)) {
                GOTO(stop, rc = -EINVAL);
        }
 
        /* 3) make new LMA and add it */
        rc = osd_ea_fid_set(info, inode, tfid, LMAC_FID_ON_OST, 0);
-       if (reset) {
+       if (fid_18_23) {
                if (rc)
                        /* If failed, we should try to add the old back. */
                        size = sizeof(*ff);
@@ -627,8 +627,8 @@ static int osd_scrub_check_local_fldb(struct osd_thread_info *info,
         *      quite possible for FID-on-MDT. */
        if (dev->od_is_ost)
                return SCRUB_NEXT_OSTOBJ_OLD;
-       else
-               return 0;
+
+       return 0;
 }
 
 static int osd_scrub_get_fid(struct osd_thread_info *info,
@@ -636,8 +636,8 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
                             struct lu_fid *fid, bool scrub)
 {
        struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
-       int rc;
        bool has_lma = false;
+       int rc;
 
        rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
                         &info->oti_ost_attrs);
@@ -674,7 +674,7 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
                rc = osd_get_idif(info, inode, &info->oti_obj_dentry, fid);
                if (rc == 0) {
                        if (scrub)
-                               /* It is old 2.x (x <= 3) or 1.8 OST-object. */
+                               /* It is 2.3 or older OST-object. */
                                rc = SCRUB_NEXT_OSTOBJ_OLD;
                        return rc;
                }
@@ -685,7 +685,7 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
                                 * to generate its FID, ignore it directly. */
                                rc = SCRUB_NEXT_CONTINUE;
                        else
-                               /* It is 2.4 OST-object. */
+                               /* It is 2.4 or newer OST-object. */
                                rc = SCRUB_NEXT_OSTOBJ_OLD;
                        return rc;
                }
@@ -733,6 +733,13 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev,
                     is_remote_parent_ino(dev, pos)))
                RETURN(SCRUB_NEXT_CONTINUE);
 
+        /* Skip project quota inode since it is greater than s_first_ino. */
+#ifdef HAVE_PROJECT_QUOTA
+       if (ldiskfs_has_feature_project(sb) &&
+           pos == le32_to_cpu(LDISKFS_SB(sb)->s_es->s_prj_quota_inum))
+               RETURN(SCRUB_NEXT_CONTINUE);
+#endif
+
        osd_id_gen(lid, pos, OSD_OII_NOGEN);
        inode = osd_iget(info, dev, lid);
        if (IS_ERR(inode)) {
@@ -1419,8 +1426,8 @@ static const struct osd_lf_map osd_lf_maps[] = {
 
        /* PENDING */
        {
-               .olm_name       = "PENDING",
-               .olm_namelen    = sizeof("PENDING") - 1,
+               .olm_name       = MDT_ORPHAN_DIR,
+               .olm_namelen    = sizeof(MDT_ORPHAN_DIR) - 1,
        },
 
        /* ROOT */
@@ -2007,7 +2014,7 @@ osd_ios_scan_one(struct osd_thread_info *info, struct osd_device *dev,
 
 /**
  * It scans the /lost+found, and for the OST-object (with filter_fid
- * or filter_fid_old), move them back to its proper /O/<seq>/d<x>.
+ * or filter_fid_18_23), move them back to its proper /O/<seq>/d<x>.
  */
 #ifdef HAVE_FILLDIR_USE_CTX
 static int osd_ios_lf_fill(struct dir_context *buf,
@@ -2284,7 +2291,11 @@ osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev,
                buf.oifb_items = 0;
 #ifdef HAVE_DIR_CONTEXT
                buf.ctx.pos = filp->f_pos;
+#ifdef HAVE_ITERATE_SHARED
+               rc = fops->iterate_shared(filp, &buf.ctx);
+#else
                rc = fops->iterate(filp, &buf.ctx);
+#endif
                filp->f_pos = buf.ctx.pos;
 #else
                rc = fops->readdir(filp, &buf, filldir);
@@ -2638,7 +2649,7 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev)
                 * an old device, it can be found and cleared later.
                 *
                 * For the system with "SIF_NO_HANDLE_OLD_FID", we do not
-                * need to check "filter_fid_old" and to convert it to
+                * need to check "filter_fid_18_23" and to convert it to
                 * "filter_fid" for each object, and all the IGIF should
                 * have their FID mapping in OI files already. */
                if (dev->od_maybe_new && rc == -ENOENT)
@@ -2658,8 +2669,10 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev)
                                       "failed to allocate RAM for report\n",
                                       osd_dev2name(dev));
                        } else {
-                               class_uuid_unparse(sf->sf_uuid, old_uuid);
-                               class_uuid_unparse(es->s_uuid, new_uuid);
+                               snprintf(old_uuid->uuid, UUID_SIZE, "%pU",
+                                        sf->sf_uuid);
+                               snprintf(new_uuid->uuid, UUID_SIZE, "%pU",
+                                        es->s_uuid);
                                CDEBUG(D_LFSCK, "%s: UUID has been changed "
                                       "from %s to %s\n", osd_dev2name(dev),
                                       old_uuid->uuid, new_uuid->uuid);