diff options
| author | Csaba Henk <csaba@redhat.com> | 2012-04-17 00:19:54 +0200 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-04-23 14:50:55 -0700 | 
| commit | 664daecef49d5e497bb5dd867fc1f51b046d4bf2 (patch) | |
| tree | 5a5b1aa5684981f82f3c582267d9c2eefb9148df /xlators | |
| parent | 6fbf369d59cf87b903403699666d99232a372fef (diff) | |
clean up handling of special client pids
- no need to name a lower boundary [drop GF_CLIENT_PID_MIN]
- drop utility function to decide about pid speciality [gf_pid_client_check()];
  when we implement uniform policy for special pids, use just comparison with
  GF_CLIENT_PID_MAX (currently such uniform policy exists in io-threads, where
  special clients get lowest priority)
- io-threads: drop numeric literal, use GF_CLIENT_PID_MAX
- xattr flipping (in fuse):
  - fuse_xattr_alloc_default() made static
  - avoid compiler warnings wrt. partial enum traversal in the switch
    by not casting the original numeric value to gf_client_pid_t (enum) type
  - trim down the switch to those cases with which there is something to do
    [GF_CLIENT_PID_GSYNCD, GF_CLIENT_PID_HADOOP]
  - eliminate the (theoretical) chance of succesfully returning
    from fuse_flip_xattr_ns() with unallocated nkey
    [as was the case with pids GF_CLIENT_PID_{MIN,MAX,DEFRAG}]
Change-Id: Ic2b83b908d8e3be23a7fba1e5895869828a6194b
BUG: 765433
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3170
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 1 | ||||
| -rw-r--r-- | xlators/mount/fuse/src/fuse-helpers.c | 30 | ||||
| -rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 2 | 
3 files changed, 6 insertions, 27 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index d20413055..3711ca54d 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -350,7 +350,6 @@ inode_t *fuse_ino_to_inode (uint64_t ino, xlator_t *fuse);  int send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error);  int fuse_gfid_set (fuse_state_t *state);  int fuse_flip_xattr_ns (struct fuse_private *priv, char *okey, char **nkey); -int fuse_xattr_alloc_default (char *okey, char **nkey);  fuse_fd_ctx_t * __fuse_fd_ctx_check_n_create (fd_t *fd, xlator_t *this);  fuse_fd_ctx_t * fuse_fd_ctx_check_n_create (fd_t *fd, xlator_t *this); diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index 8af19de9d..452a48194 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -450,7 +450,7 @@ fuse_do_flip_xattr_ns (char *okey, const char *nns, char **nkey)          return ret;  } -int +static int  fuse_xattr_alloc_default (char *okey, char **nkey)  {          int ret = 0; @@ -469,28 +469,12 @@ fuse_flip_xattr_ns (fuse_private_t *priv, char *okey, char **nkey)  {          int             ret       = 0;          gf_boolean_t    need_flip = _gf_false; -        gf_client_pid_t npid      = 0; - -        npid = priv->client_pid; -        if (gf_client_pid_check (npid)) { -                ret = fuse_xattr_alloc_default (okey, nkey); -                goto out; -        } - -        switch (npid) { -                /* -                 * These two cases will never execute as we check the -                 * pid range above, but are kept to keep the compiler -                 * happy. -                 */ -        case GF_CLIENT_PID_MAX: -        case GF_CLIENT_PID_MIN: -                goto out; +        switch (priv->client_pid) {          case GF_CLIENT_PID_GSYNCD:                  /* valid xattr(s): *xtime, volume-mark* */                  gf_log("glusterfs-fuse", GF_LOG_DEBUG, "PID: %d, checking xattr(s): " -                       "volume-mark*, *xtime", npid); +                       "volume-mark*, *xtime", priv->client_pid);                  if ( (strcmp (okey, UNPRIV_XA_NS".glusterfs.volume-mark") == 0)                       || (fnmatch (UNPRIV_XA_NS".glusterfs.volume-mark.*", okey, FNM_PERIOD) == 0)                       || (fnmatch (UNPRIV_XA_NS".glusterfs.*.xtime", okey, FNM_PERIOD) == 0) ) @@ -500,14 +484,10 @@ fuse_flip_xattr_ns (fuse_private_t *priv, char *okey, char **nkey)          case GF_CLIENT_PID_HADOOP:                  /* valid xattr(s): pathinfo */                  gf_log("glusterfs-fuse", GF_LOG_DEBUG, "PID: %d, checking xattr(s): " -                       "pathinfo", npid); +                       "pathinfo", priv->client_pid);                  if (strcmp (okey, UNPRIV_XA_NS".glusterfs.pathinfo") == 0)                          need_flip = _gf_true;                  break; - -                /* This is never true for fuse mount, as defrag uses syncops */ -        case GF_CLIENT_PID_DEFRAG: -                goto out;          }          if (need_flip) { @@ -518,6 +498,6 @@ fuse_flip_xattr_ns (fuse_private_t *priv, char *okey, char **nkey)                  /* if we cannot match, continue with what we got */                  ret = fuse_xattr_alloc_default (okey, nkey);          } - out: +          return ret;  } diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index d316a19a4..66864fcd4 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -202,7 +202,7 @@ iot_schedule (call_frame_t *frame, xlator_t *this, call_stub_t *stub)          int             ret = -1;          iot_pri_t       pri = IOT_PRI_MAX - 1; -        if (frame->root->pid < 0) { +        if (frame->root->pid < GF_CLIENT_PID_MAX) {                  pri = IOT_PRI_LEAST;                  goto out;          }  | 
