diff options
| -rw-r--r-- | libglusterfs/src/common-utils.c | 23 | ||||
| -rw-r--r-- | libglusterfs/src/glusterfs/common-utils.h | 3 | ||||
| -rw-r--r-- | libglusterfs/src/libglusterfs.sym | 1 | ||||
| -rw-r--r-- | libglusterfs/src/syncop-utils.c | 2 | ||||
| -rw-r--r-- | xlators/features/index/src/index.c | 12 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix-inode-fd-ops.c | 29 | 
6 files changed, 37 insertions, 33 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 0798661806d..e16bb330a44 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -5341,3 +5341,26 @@ find_xlator_option_in_cmd_args_t(const char *option_name, cmd_args_t *args)      }      return NULL;  } + +int +gf_d_type_from_ia_type(ia_type_t type) +{ +    switch (type) { +        case IA_IFDIR: +            return DT_DIR; +        case IA_IFCHR: +            return DT_CHR; +        case IA_IFBLK: +            return DT_BLK; +        case IA_IFIFO: +            return DT_FIFO; +        case IA_IFLNK: +            return DT_LNK; +        case IA_IFREG: +            return DT_REG; +        case IA_IFSOCK: +            return DT_SOCK; +        default: +            return DT_UNKNOWN; +    } +} diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h index 9061861ce3b..89b38e02448 100644 --- a/libglusterfs/src/glusterfs/common-utils.h +++ b/libglusterfs/src/glusterfs/common-utils.h @@ -1067,4 +1067,7 @@ gf_replace_new_iatt_in_dict(struct _dict *);  xlator_cmdline_option_t *  find_xlator_option_in_cmd_args_t(const char *option_name, cmd_args_t *args); +int +gf_d_type_from_ia_type(ia_type_t type); +  #endif /* _COMMON_UTILS_H */ diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index beeab5468f9..f0a92796187 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -1150,3 +1150,4 @@ gf_changelog_init  gf_changelog_register_generic  gf_gfid_generate_from_xxh64  find_xlator_option_in_cmd_args_t +gf_d_type_from_ia_type diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c index 13e7165658e..be03527496e 100644 --- a/libglusterfs/src/syncop-utils.c +++ b/libglusterfs/src/syncop-utils.c @@ -403,7 +403,7 @@ syncop_mt_dir_scan(call_frame_t *frame, xlator_t *subvol, loc_t *loc, int pid,                  continue;              } -            if (entry->d_type == IA_IFDIR) { +            if (entry->d_stat.ia_type == IA_IFDIR) {                  ret = fn(subvol, entry, loc, data);                  gf_dirent_entry_free(entry);                  if (ret) diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index d9768b32d7f..2f2a6d04fb3 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -1685,21 +1685,25 @@ index_get_gfid_type(void *opaque)          loc_wipe(&loc); -        entry->d_type = IA_INVAL; +        entry->d_type = gf_d_type_from_ia_type(IA_INVAL); +        entry->d_stat.ia_type = IA_INVAL;          if (gf_uuid_parse(entry->d_name, loc.gfid))              continue;          loc.inode = inode_find(args->parent->table, loc.gfid);          if (loc.inode) { -            entry->d_type = loc.inode->ia_type; +            entry->d_stat.ia_type = loc.inode->ia_type; +            entry->d_type = gf_d_type_from_ia_type(loc.inode->ia_type);              continue;          }          loc.inode = inode_new(args->parent->table);          if (!loc.inode)              continue;          ret = syncop_lookup(FIRST_CHILD(this), &loc, &iatt, 0, 0, 0); -        if (ret == 0) -            entry->d_type = iatt.ia_type; +        if (ret == 0) { +            entry->d_type = gf_d_type_from_ia_type(iatt.ia_type); +            entry->d_stat = iatt; +        }      }      loc_wipe(&loc); diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index 0aabff2615b..7dbbd3d6d61 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -5306,31 +5306,6 @@ posix_entry_xattr_fill(xlator_t *this, inode_t *inode, fd_t *fd,      return posix_xattr_fill(this, entry_path, &tmp_loc, NULL, -1, dict, stbuf);  } -#ifdef _DIRENT_HAVE_D_TYPE -static int -posix_d_type_from_ia_type(ia_type_t type) -{ -    switch (type) { -        case IA_IFDIR: -            return DT_DIR; -        case IA_IFCHR: -            return DT_CHR; -        case IA_IFBLK: -            return DT_BLK; -        case IA_IFIFO: -            return DT_FIFO; -        case IA_IFLNK: -            return DT_LNK; -        case IA_IFREG: -            return DT_REG; -        case IA_IFSOCK: -            return DT_SOCK; -        default: -            return DT_UNKNOWN; -    } -} -#endif -  int  posix_readdirp_fill(xlator_t *this, fd_t *fd, gf_dirent_t *entries,                      dict_t *dict) @@ -5405,14 +5380,12 @@ posix_readdirp_fill(xlator_t *this, fd_t *fd, gf_dirent_t *entries,          if (stbuf.ia_ino)              entry->d_ino = stbuf.ia_ino; -#ifdef _DIRENT_HAVE_D_TYPE          if (entry->d_type == DT_UNKNOWN && !IA_ISINVAL(stbuf.ia_type)) {              /* The platform supports d_type but the underlying                 filesystem doesn't. We set d_type to the correct                 value from ia_type */ -            entry->d_type = posix_d_type_from_ia_type(stbuf.ia_type); +            entry->d_type = gf_d_type_from_ia_type(stbuf.ia_type);          } -#endif          inode = NULL;      }  | 
