diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-05 07:37:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:38 -0500 |
commit | b4a95b949ee15054cf503029327bde9e75b7d17b (patch) | |
tree | db5b1138988fa3ec50fc6dd14d1fd6706e7668f1 /source4 | |
parent | d934cb71d0bd2d6ad7a2908cc3c3802cb37e922c (diff) | |
download | samba-b4a95b949ee15054cf503029327bde9e75b7d17b.tar.gz samba-b4a95b949ee15054cf503029327bde9e75b7d17b.tar.bz2 samba-b4a95b949ee15054cf503029327bde9e75b7d17b.zip |
r7296: avoid two stat() calls per message. This increases the raw message
rate from 20k/sec to 55k/sec. The irpc rate goes from 16k/sec to
34k/sec.
I should have run strace -T on this a long time ago.
(This used to be commit b9281668bb0c971af14df37ec3e979b9d5ef276e)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/messaging/messaging.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index be89c97e5b..4c4b6ea8da 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -36,6 +36,7 @@ struct messaging_context { uint32_t server_id; struct socket_context *sock; + const char *base_path; const char *path; struct dispatch_fn *dispatch; struct messaging_rec *pending; @@ -94,13 +95,9 @@ static void ping_message(struct messaging_context *msg, void *private, /* return the path to a messaging socket */ -static char *messaging_path(TALLOC_CTX *mem_ctx, uint32_t server_id) +static char *messaging_path(struct messaging_context *msg, uint32_t server_id) { - char *name = talloc_asprintf(mem_ctx, "messaging/msg.%u", (unsigned)server_id); - char *ret; - ret = smbd_tmp_path(mem_ctx, name); - talloc_free(name); - return ret; + return talloc_asprintf(msg, "%s/msg.%u", msg->base_path, (unsigned)server_id); } /* @@ -308,7 +305,8 @@ NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server, data->data, dlength); } - rec->path = messaging_path(rec, server); + rec->path = messaging_path(msg, server); + talloc_steal(rec, rec->path); status = try_send(rec); if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { @@ -369,7 +367,8 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id mkdir(path, 0700); talloc_free(path); - msg->path = messaging_path(msg, server_id); + msg->base_path = smbd_tmp_path(msg, "messaging"); + msg->path = messaging_path(msg, server_id); msg->server_id = server_id; msg->dispatch = NULL; msg->pending = NULL; |