client: avoid higher-order pages for hashing

This commit is contained in:
Thomas Schoebel-Theuer 2013-04-12 14:13:21 +02:00
parent 3ca7f91900
commit 1e56c2bffc
2 changed files with 11 additions and 3 deletions

View File

@ -16,6 +16,8 @@
#include "mars_client.h"
#define CLIENT_HASH_MAX (PAGE_SIZE / sizeof(struct list_head))
///////////////////////// own helper functions ////////////////////////
static int thread_count = 0;
@ -672,6 +674,13 @@ static int client_brick_construct(struct client_brick *brick)
static int client_output_construct(struct client_output *output)
{
int i;
output->hash_table = brick_block_alloc(0, PAGE_SIZE);
if (unlikely(!output->hash_table)) {
MARS_ERR("cannot allocate hash table\n");
return -ENOMEM;
}
for (i = 0; i < CLIENT_HASH_MAX; i++) {
INIT_LIST_HEAD(&output->hash_table[i]);
}
@ -691,6 +700,7 @@ static int client_output_destruct(struct client_output *output)
brick_string_free(output->path);
output->path = NULL;
}
brick_block_free(output->hash_table, PAGE_SIZE);
return 0;
}

View File

@ -8,8 +8,6 @@
extern struct mars_limiter client_limiter;
extern int global_net_io_timeout;
#define CLIENT_HASH_MAX 256
struct client_mref_aspect {
GENERIC_ASPECT(mref);
struct list_head io_head;
@ -59,7 +57,7 @@ struct client_output {
wait_queue_head_t info_event;
bool get_info;
bool got_info;
struct list_head hash_table[CLIENT_HASH_MAX];
struct list_head *hash_table;
};
MARS_TYPES(client);