mirror of https://github.com/schoebel/mars
client: avoid higher-order pages for hashing
This commit is contained in:
parent
3ca7f91900
commit
1e56c2bffc
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#include "mars_client.h"
|
#include "mars_client.h"
|
||||||
|
|
||||||
|
#define CLIENT_HASH_MAX (PAGE_SIZE / sizeof(struct list_head))
|
||||||
|
|
||||||
///////////////////////// own helper functions ////////////////////////
|
///////////////////////// own helper functions ////////////////////////
|
||||||
|
|
||||||
static int thread_count = 0;
|
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)
|
static int client_output_construct(struct client_output *output)
|
||||||
{
|
{
|
||||||
int i;
|
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++) {
|
for (i = 0; i < CLIENT_HASH_MAX; i++) {
|
||||||
INIT_LIST_HEAD(&output->hash_table[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);
|
brick_string_free(output->path);
|
||||||
output->path = NULL;
|
output->path = NULL;
|
||||||
}
|
}
|
||||||
|
brick_block_free(output->hash_table, PAGE_SIZE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
extern struct mars_limiter client_limiter;
|
extern struct mars_limiter client_limiter;
|
||||||
extern int global_net_io_timeout;
|
extern int global_net_io_timeout;
|
||||||
|
|
||||||
#define CLIENT_HASH_MAX 256
|
|
||||||
|
|
||||||
struct client_mref_aspect {
|
struct client_mref_aspect {
|
||||||
GENERIC_ASPECT(mref);
|
GENERIC_ASPECT(mref);
|
||||||
struct list_head io_head;
|
struct list_head io_head;
|
||||||
|
@ -59,7 +57,7 @@ struct client_output {
|
||||||
wait_queue_head_t info_event;
|
wait_queue_head_t info_event;
|
||||||
bool get_info;
|
bool get_info;
|
||||||
bool got_info;
|
bool got_info;
|
||||||
struct list_head hash_table[CLIENT_HASH_MAX];
|
struct list_head *hash_table;
|
||||||
};
|
};
|
||||||
|
|
||||||
MARS_TYPES(client);
|
MARS_TYPES(client);
|
||||||
|
|
Loading…
Reference in New Issue