Whamcloud - gitweb
LU-10761 osd-ldiskfs: not create REMOTE_PARENT_DIR on OST 08/31508/3
authorFan Yong <fan.yong@intel.com>
Fri, 16 Mar 2018 06:28:01 +0000 (14:28 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 9 Apr 2018 19:45:16 +0000 (19:45 +0000)
The REMOTE_PARENT_DIR is used to link remote object which parent
resides on remote MDT to the global namespace. It is only useful
for MDT. So it is unnecessary to create such directory on OST.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I240de3f69cde04740cb7f71ebaf9048407a900dc
Reviewed-on: https://review.whamcloud.com/31508
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_compat.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_scrub.c

index 9bb215b..7712187 100644 (file)
@@ -369,6 +369,9 @@ int osd_lookup_in_remote_parent(struct osd_thread_info *oti,
        int                         rc;
        ENTRY;
 
        int                         rc;
        ENTRY;
 
+       if (unlikely(osd->od_is_ost))
+               RETURN(-ENOENT);
+
        parent = omm->omm_remote_parent;
        sprintf(name, DFID_NOBRACE, PFID(fid));
        dentry = osd_child_dentry_by_inode(oti->oti_env, parent->d_inode,
        parent = omm->omm_remote_parent;
        sprintf(name, DFID_NOBRACE, PFID(fid));
        dentry = osd_child_dentry_by_inode(oti->oti_env, parent->d_inode,
@@ -535,7 +538,6 @@ static void osd_index_backup_dir_fini(struct osd_device *dev)
 int osd_obj_map_init(const struct lu_env *env, struct osd_device *dev)
 {
        int rc;
 int osd_obj_map_init(const struct lu_env *env, struct osd_device *dev)
 {
        int rc;
-       bool ost_init = false;
        bool mdt_init = false;
        ENTRY;
 
        bool mdt_init = false;
        ENTRY;
 
@@ -543,16 +545,19 @@ int osd_obj_map_init(const struct lu_env *env, struct osd_device *dev)
        if (rc)
                RETURN(rc);
 
        if (rc)
                RETURN(rc);
 
-       ost_init = true;
-       rc = osd_mdt_init(env, dev);
-       if (!rc) {
+       if (!dev->od_is_ost) {
+               rc = osd_mdt_init(env, dev);
+               if (rc) {
+                       osd_ost_fini(dev);
+                       RETURN(rc);
+               }
+
                mdt_init = true;
                mdt_init = true;
-               rc = osd_index_backup_dir_init(env, dev);
        }
 
        }
 
+       rc = osd_index_backup_dir_init(env, dev);
        if (rc) {
        if (rc) {
-               if (ost_init)
-                       osd_ost_fini(dev);
+               osd_ost_fini(dev);
                if (mdt_init)
                        osd_mdt_fini(dev);
        }
                if (mdt_init)
                        osd_mdt_fini(dev);
        }
index 13d8b51..00ec3e5 100644 (file)
@@ -1132,7 +1132,7 @@ trigger:
         * only happened for the RPC from other MDT during the
         * OI scrub, or for the client side RPC with FID only,
         * such as FID to path, or from old connected client. */
         * only happened for the RPC from other MDT during the
         * OI scrub, or for the client side RPC with FID only,
         * such as FID to path, or from old connected client. */
-       if (!remote && !fid_is_on_ost(info, dev, fid, OI_CHECK_FLD)) {
+       if (!remote) {
                rc1 = osd_lookup_in_remote_parent(info, dev, fid, id);
                if (!rc1) {
                        remote = true;
                rc1 = osd_lookup_in_remote_parent(info, dev, fid, id);
                if (!rc1) {
                        remote = true;
@@ -5542,7 +5542,7 @@ static int osd_ea_lookup_rec(const struct lu_env *env, struct osd_object *obj,
                /* done with de, release bh */
                brelse(bh);
                if (rc != 0) {
                /* done with de, release bh */
                brelse(bh);
                if (rc != 0) {
-                       if (unlikely(ino == osd_remote_parent_ino(dev))) {
+                       if (unlikely(is_remote_parent_ino(dev, ino))) {
                                const char *name = (const char *)key;
 
                                /* If the parent is on remote MDT, and there
                                const char *name = (const char *)key;
 
                                /* If the parent is on remote MDT, and there
@@ -6771,10 +6771,10 @@ static inline int osd_it_ea_rec(const struct lu_env *env,
        int                     rc    = 0;
        ENTRY;
 
        int                     rc    = 0;
        ENTRY;
 
-       LASSERT(obj->oo_inode != dev->od_mdt_map->omm_remote_parent->d_inode);
+       LASSERT(!is_remote_parent_ino(dev, obj->oo_inode->i_ino));
 
        if (attr & LUDA_VERIFY) {
 
        if (attr & LUDA_VERIFY) {
-               if (unlikely(ino == osd_remote_parent_ino(dev))) {
+               if (unlikely(is_remote_parent_ino(dev, ino))) {
                        attr |= LUDA_IGNORE;
                        /* If the parent is on remote MDT, and there
                         * is no FID-in-dirent, then we have to get
                        attr |= LUDA_IGNORE;
                        /* If the parent is on remote MDT, and there
                         * is no FID-in-dirent, then we have to get
@@ -6802,7 +6802,7 @@ static inline int osd_it_ea_rec(const struct lu_env *env,
                        /* If the parent is on remote MDT, and there
                         * is no FID-in-dirent, then we have to get
                         * the parent FID from the linkEA.  */
                        /* If the parent is on remote MDT, and there
                         * is no FID-in-dirent, then we have to get
                         * the parent FID from the linkEA.  */
-                       if (ino == osd_remote_parent_ino(dev) && is_dotdot) {
+                       if (is_remote_parent_ino(dev, ino) && is_dotdot) {
                                rc = osd_get_pfid_from_linkea(env, obj, fid);
                        } else {
                                if (is_dotdot == false &&
                                rc = osd_get_pfid_from_linkea(env, obj, fid);
                        } else {
                                if (is_dotdot == false &&
index 5a1aa86..b326ac6 100644 (file)
@@ -1273,9 +1273,14 @@ static inline int fid_is_internal(const struct lu_fid *fid)
        return (!fid_is_namespace_visible(fid) && !fid_is_idif(fid));
 }
 
        return (!fid_is_namespace_visible(fid) && !fid_is_idif(fid));
 }
 
-static inline unsigned long osd_remote_parent_ino(struct osd_device *dev)
+static inline bool is_remote_parent_ino(struct osd_device *o, unsigned long ino)
 {
 {
-       return dev->od_mdt_map->omm_remote_parent->d_inode->i_ino;
+       if (o->od_is_ost)
+               return false;
+
+       LASSERT(o->od_mdt_map != NULL);
+
+       return ino == o->od_mdt_map->omm_remote_parent->d_inode->i_ino;
 }
 
 /**
 }
 
 /**
index acc8618..118f5b7 100644 (file)
@@ -730,7 +730,7 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev,
        /* Not handle the backend root object and agent parent object.
         * They are neither visible to namespace nor have OI mappings. */
        if (unlikely(pos == osd_sb(dev)->s_root->d_inode->i_ino ||
        /* Not handle the backend root object and agent parent object.
         * They are neither visible to namespace nor have OI mappings. */
        if (unlikely(pos == osd_sb(dev)->s_root->d_inode->i_ino ||
-                    pos == osd_remote_parent_ino(dev)))
+                    is_remote_parent_ino(dev, pos)))
                RETURN(SCRUB_NEXT_CONTINUE);
 
        osd_id_gen(lid, pos, OSD_OII_NOGEN);
                RETURN(SCRUB_NEXT_CONTINUE);
 
        osd_id_gen(lid, pos, OSD_OII_NOGEN);