summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2013-10-01 14:51:46 -0400
committerAnand Avati <avati@redhat.com>2013-10-02 16:57:22 -0700
commita5ef7bc7de744d1324ddf63207b1172d11086441 (patch)
tree328f31ab316c13ab40c39798b9124332716f6c85
parentc499ef86a2dfd4e7727ce876b6cf18ba79c94fe5 (diff)
protocol/server: eliminate an unnecessary frame create and destroy
connection_cleanup creates a frame solely so that it can be copied. But the process of copying creates a new frame, and there's nothing apparently magic about the one being copied; we can eliminate an unnecessary create and destroy. Which in the grand scheme of things probably isn't the worst thing we do, but it's low hanging fruit. Change-Id: I4a23b84a53e086137b7d4167ad8c20b673d1ffe5 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/6019 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/protocol/server/src/server-helpers.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 98894143fb0..14d07412497 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -156,8 +156,7 @@ out:
static int
-do_lock_table_cleanup (xlator_t *this, client_t *client, call_frame_t *frame,
- struct _lock_table *ltable)
+do_lock_table_cleanup (xlator_t *this, client_t *client, struct _lock_table *ltable)
{
call_frame_t *tmp_frame = NULL;
xlator_t *bound_xl = NULL;
@@ -168,7 +167,6 @@ do_lock_table_cleanup (xlator_t *this, client_t *client, call_frame_t *frame,
struct list_head inodelk_lockers, entrylk_lockers;
GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", frame, out);
GF_VALIDATE_OR_GOTO ("server", ltable, out);
bound_xl = client->bound_xl;
@@ -185,7 +183,7 @@ do_lock_table_cleanup (xlator_t *this, client_t *client, call_frame_t *frame,
flock.l_start = 0;
flock.l_len = 0;
list_for_each_entry_safe (locker, tmp, &inodelk_lockers, lockers) {
- tmp_frame = copy_frame (frame);
+ tmp_frame = create_frame (this, this->ctx->pool);
if (tmp_frame == NULL) {
goto out;
}
@@ -240,7 +238,10 @@ do_lock_table_cleanup (xlator_t *this, client_t *client, call_frame_t *frame,
tmp = NULL;
locker = NULL;
list_for_each_entry_safe (locker, tmp, &entrylk_lockers, lockers) {
- tmp_frame = copy_frame (frame);
+ tmp_frame = create_frame (this, this->ctx->pool);
+ if (tmp_frame == NULL) {
+ goto out;
+ }
tmp_frame->root->pid = 0;
gf_client_ref (client);
@@ -322,8 +323,7 @@ out:
static int
-do_fd_cleanup (xlator_t *this, client_t* client, call_frame_t *frame,
- fdentry_t *fdentries, int fd_count)
+do_fd_cleanup (xlator_t *this, client_t* client, fdentry_t *fdentries, int fd_count)
{
fd_t *fd = NULL;
int i = 0, ret = -1;
@@ -332,7 +332,6 @@ do_fd_cleanup (xlator_t *this, client_t* client, call_frame_t *frame,
char *path = NULL;
GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", frame, out);
GF_VALIDATE_OR_GOTO ("server", fdentries, out);
bound_xl = client->bound_xl;
@@ -340,7 +339,7 @@ do_fd_cleanup (xlator_t *this, client_t* client, call_frame_t *frame,
fd = fdentries[i].fd;
if (fd != NULL) {
- tmp_frame = copy_frame (frame);
+ tmp_frame = create_frame (this, this->ctx->pool);
if (tmp_frame == NULL) {
goto out;
}
@@ -389,30 +388,17 @@ do_connection_cleanup (xlator_t *this, client_t *client,
{
int ret = 0;
int saved_ret = 0;
- call_frame_t *frame = NULL;
- server_state_t *state = NULL;
GF_VALIDATE_OR_GOTO ("server", this, out);
if (!ltable && !fdentries)
goto out;
- frame = create_frame (this, this->ctx->pool);
- if (frame == NULL) {
- goto out;
- }
-
if (ltable)
- saved_ret = do_lock_table_cleanup (this, client, frame, ltable);
-
- if (fdentries != NULL) {
- ret = do_fd_cleanup (this, client, frame, fdentries, fd_count);
- }
+ saved_ret = do_lock_table_cleanup (this, client, ltable);
- state = CALL_STATE (frame);
- GF_FREE (state);
-
- STACK_DESTROY (frame->root);
+ if (fdentries != NULL)
+ ret = do_fd_cleanup (this, client, fdentries, fd_count);
if (saved_ret || ret) {
ret = -1;