From bb4e14b213a39e9d403be9790ef0a75388496dee Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 15 Jun 2009 13:05:52 +0000 Subject: client: Replace saved_fds dict with list Thhie change removes a huge inefficiency in file open path where every open resulted in dictionary operations in order to let the client maintain a list of fd_t's being used over a particular client context. Resolves: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=16 Signed-off-by: Anand V. Avati --- xlators/protocol/client/src/client-protocol.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'xlators/protocol/client/src/client-protocol.h') diff --git a/xlators/protocol/client/src/client-protocol.h b/xlators/protocol/client/src/client-protocol.h index 1cbb22ef1..24769e8e4 100644 --- a/xlators/protocol/client/src/client-protocol.h +++ b/xlators/protocol/client/src/client-protocol.h @@ -65,6 +65,18 @@ typedef struct client_connection client_connection_t; #include "transport.h" #include "protocol.h" +typedef struct _client_fd_ctx { + int remote_fd; + struct list_head sfd_pos; /* Stores the reference to this + fd's position in the saved_fds list. + */ + fd_t *fd; /* Reverse reference to the fd itself. + This is needed to delete this fdctx + from the fd's context in + protocol_client_mark_fd_bad. + */ +} client_fd_ctx_t; + struct _client_conf { transport_t *transport[CHANNEL_MAX]; @@ -76,7 +88,7 @@ struct _client_conf { uint32_t frames_in_transit; gf_lock_t lock; } forget; - dict_t *saved_fds; + struct list_head saved_fds; struct timeval last_sent; struct timeval last_received; pthread_mutex_t mutex; -- cgit