diff options
| author | Amar Tumballi <amarts@redhat.com> | 2012-02-21 14:47:48 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-02-21 02:42:09 -0800 | 
| commit | 0ef7e763c85c045ef7937d0ca02d8c5f0333e6e8 (patch) | |
| tree | e41180dde3fd17b008d8da13357c779b98e351c3 /xlators/protocol/client/src/client3_1-fops.c | |
| parent | 1f296b84e6c7bf55fc81d0c1dade7ccda75229a6 (diff) | |
core: utilize mempool for frame->local allocations
in each translator, which uses 'frame->local', we are using
GF_CALLOC/GF_FREE, which would be costly considering the
number of allocation happening in a lifetime of 'fop'. It
would be good to utilize the mem pool framework for xlator's
local structures, so there is no allocation overhead.
Change-Id: Ida6e65039a24d9c219b380aa1c3559f36046dc94
Signed-off-by: Amar Tumballi <amar@gluster.com>
BUG: 765336
Reviewed-on: http://review.gluster.com/2772
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client3_1-fops.c')
| -rw-r--r-- | xlators/protocol/client/src/client3_1-fops.c | 40 | 
1 files changed, 17 insertions, 23 deletions
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index 0bc91527a..800761662 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -2510,7 +2510,7 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this,          conf = this->private;          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -2960,7 +2960,7 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this,                  goto unwind;          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3108,7 +3108,7 @@ client3_1_link (call_frame_t *frame, xlator_t *this,          GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,                                         !uuid_is_null (*((uuid_t*)req.newgfid)),                                         unwind, op_errno, EINVAL); -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3153,7 +3153,7 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this,          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3229,7 +3229,7 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this,          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3304,7 +3304,7 @@ client3_1_create (call_frame_t *frame, xlator_t *this,          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3382,7 +3382,7 @@ client3_1_open (call_frame_t *frame, xlator_t *this,          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3489,7 +3489,7 @@ client3_1_readv (call_frame_t *frame, xlator_t *this,                  goto unwind;          } -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (local == NULL) {                  op_errno = ENOMEM;                  goto unwind; @@ -3594,7 +3594,7 @@ client3_1_flush (call_frame_t *frame, xlator_t *this,          conf = this->private; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  STACK_UNWIND (frame, -1, ENOMEM);                  return 0; @@ -3721,7 +3721,7 @@ client3_1_opendir (call_frame_t *frame, xlator_t *this,          args = data; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -3997,8 +3997,7 @@ client3_1_fgetxattr (call_frame_t *frame, xlator_t *this,          CLIENT_GET_REMOTE_FD(conf, args->fd, remote_fd, op_errno, unwind); -        local = GF_CALLOC (1, sizeof (*local), -                           gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -4100,8 +4099,7 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,                  goto unwind;          } -        local = GF_CALLOC (1, sizeof (*local), -                           gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -4226,8 +4224,7 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this,          if (!(args->loc && args->loc->inode))                  goto unwind; -        local = GF_CALLOC (1, sizeof (*local), -                           gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -4346,8 +4343,7 @@ client3_1_fxattrop (call_frame_t *frame, xlator_t *this,          req.flags  = args->flags;          memcpy (req.gfid, args->fd->inode->gfid, 16); -        local = GF_CALLOC (1, sizeof (*local), -                           gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -4536,7 +4532,7 @@ client3_1_lk (call_frame_t *frame, xlator_t *this,          args = data;          conf = this->private; -        local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind; @@ -4919,8 +4915,7 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this,          if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE + GLUSTERFS_RDMA_MAX_HEADER_SIZE)              > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) { -                local = GF_CALLOC (1, sizeof (*local), -                                   gf_client_mt_clnt_local_t); +                local = mem_get0 (this->local_pool);                  if (!local) {                          op_errno = ENOMEM;                          goto unwind; @@ -5022,8 +5017,7 @@ client3_1_readdirp (call_frame_t *frame, xlator_t *this,          readdirp_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfs3_readdirp_rsp, &rsp)                  + args->size; -        local = GF_CALLOC (1, sizeof (*local), -                           gf_client_mt_clnt_local_t); +        local = mem_get0 (this->local_pool);          if (!local) {                  op_errno = ENOMEM;                  goto unwind;  | 
