diff options
| author | Amar Tumballi <amar@gluster.com> | 2012-02-17 17:22:59 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-02-21 02:41:42 -0800 | 
| commit | 1f296b84e6c7bf55fc81d0c1dade7ccda75229a6 (patch) | |
| tree | 44dc4ab5d7d8081f64fb4f60f544fc17f729c6c0 | |
| parent | 1979cee4716fdb95909654148eebb8b0b973f484 (diff) | |
cluster/distribute: send the right 'dict' for check_is_linkfile()
earlier we were using 'check_is_linkfile_wo_dict()' for readdirp_cbk(),
which is no more required now.
Change-Id: I52295e08f8c494b7a081cfc684164a7f72562d0d
Signed-off-by: Amar Tumballi <amar@gluster.com>
BUG: 794641
Reviewed-on: http://review.gluster.com/2763
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
| -rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 42 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 4 | 
2 files changed, 34 insertions, 12 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 9f364d10c..3db75850b 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2712,10 +2712,10 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,          list_for_each_entry (orig_entry, (&orig_entries->list), list) {                  next_offset = orig_entry->d_off; - -                if (check_is_linkfile_wo_dict (NULL, (&orig_entry->d_stat)) -                    || (check_is_dir (NULL, (&orig_entry->d_stat), NULL) -                        && (prev->this != dht_first_up_subvol (this)))) { +                if ((check_is_dir (NULL, (&orig_entry->d_stat), NULL) && +                     (prev->this != dht_first_up_subvol (this))) || +                    check_is_linkfile (NULL, (&orig_entry->d_stat), +                                       orig_entry->dict)) {                          continue;                  } @@ -2896,7 +2896,7 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,          int           op_errno = -1;          xlator_t     *xvol = NULL;          off_t         xoff = 0; - +        int           ret = 0;          VALIDATE_OR_GOTO (frame, err);          VALIDATE_OR_GOTO (this, err); @@ -2914,6 +2914,14 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,          dht_deitransform (this, yoff, &xvol, (uint64_t *)&xoff); +        if (dict) { +                ret = dict_set_uint32 (dict, "trusted.glusterfs.dht.linkto", +                                       256); +                if (ret) +                        gf_log (this->name, GF_LOG_WARNING, +                                "failed to set 'glusterfs.dht.linkto' key"); +        } +          /* TODO: do proper readdir */          if (whichop == GF_FOP_READDIR)                  STACK_WIND (frame, dht_readdir_cbk, xvol, xvol->fops->readdir, @@ -4014,7 +4022,7 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,                          continue;                  if (strcmp (trav->d_name, "..") == 0)                          continue; -                if (check_is_linkfile (NULL, (&trav->d_stat), NULL) == 1) { +                if (check_is_linkfile (NULL, (&trav->d_stat), trav->dict)) {                          ret++;                          continue;                  } @@ -4132,7 +4140,8 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          dht_local_t  *local = NULL;          int           this_call_cnt = -1;          call_frame_t *prev = NULL; - +        dict_t       *dict = NULL; +        int           ret = 0;          local = frame->local;          prev  = cookie; @@ -4147,9 +4156,26 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  goto err;          } +        dict = dict_new (); +        if (!dict) { +                local->op_ret = -1; +                local->op_errno = ENOMEM; +                goto err; +        } + +        ret = dict_set_uint32 (dict, +                               "trusted.glusterfs.dht.linkto", 256); +        if (ret) +                gf_log (this->name, GF_LOG_WARNING, +                        "%s: failed to set 'trusted.glusterfs.dht.linkto' key", +                        local->loc.path); +          STACK_WIND (frame, dht_rmdir_readdirp_cbk,                      prev->this, prev->this->fops->readdirp, -                    local->fd, 4096, 0, NULL); +                    local->fd, 4096, 0, dict); + +        if (dict) +                dict_unref (dict);          return 0; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 2ccdea747..798d5b6d9 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -287,10 +287,6 @@ typedef enum {                   == DHT_LINKFILE_MODE) &&                               \                  dict_get (x, DHT_LINKFILE_KEY)) -#define check_is_linkfile_wo_dict(i,s) (                                \ -                ((st_mode_from_ia ((s)->ia_prot, (s)->ia_type) & ~S_IFMT) \ -                 == DHT_LINKFILE_MODE)) -  #define IS_DHT_MIGRATION_PHASE2(buf)  (                                 \                  IA_ISREG ((buf)->ia_type) &&                            \                  ((st_mode_from_ia ((buf)->ia_prot, (buf)->ia_type) &    \  | 
