mirror of https://github.com/schoebel/mars
net: also hash remote dentries
This commit is contained in:
parent
ec962406c6
commit
a93cfb06f4
|
@ -100,6 +100,7 @@ const struct meta mars_dent_meta[] = {
|
||||||
META_INI(d_corr_A, struct mars_dent, FIELD_INT),
|
META_INI(d_corr_A, struct mars_dent, FIELD_INT),
|
||||||
META_INI(d_corr_B, struct mars_dent, FIELD_INT),
|
META_INI(d_corr_B, struct mars_dent, FIELD_INT),
|
||||||
META_INI(d_proto, struct mars_dent, FIELD_INT),
|
META_INI(d_proto, struct mars_dent, FIELD_INT),
|
||||||
|
META_INI(d_unordered, struct mars_dent, FIELD_INT),
|
||||||
META_INI_SUB(new_stat,struct mars_dent, mars_kstat_meta),
|
META_INI_SUB(new_stat,struct mars_dent, mars_kstat_meta),
|
||||||
META_INI_SUB(old_stat,struct mars_dent, mars_kstat_meta),
|
META_INI_SUB(old_stat,struct mars_dent, mars_kstat_meta),
|
||||||
META_INI(new_link, struct mars_dent, FIELD_STRING),
|
META_INI(new_link, struct mars_dent, FIELD_STRING),
|
||||||
|
|
|
@ -99,6 +99,8 @@ int mars_recv_dent_list(struct mars_global *global, struct mars_socket *sock)
|
||||||
anchor = &global->dent_anchor;
|
anchor = &global->dent_anchor;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct mars_dent *dent = brick_zmem_alloc(sizeof(struct mars_dent));
|
struct mars_dent *dent = brick_zmem_alloc(sizeof(struct mars_dent));
|
||||||
|
struct list_head *hash_anchor;
|
||||||
|
unsigned int hash;
|
||||||
|
|
||||||
if (!dent)
|
if (!dent)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -119,6 +121,12 @@ int mars_recv_dent_list(struct mars_global *global, struct mars_socket *sock)
|
||||||
sock->s_common_proto_level = min(dent->d_proto, MARS_PROTO_LEVEL);
|
sock->s_common_proto_level = min(dent->d_proto, MARS_PROTO_LEVEL);
|
||||||
}
|
}
|
||||||
list_add_tail(&dent->dent_link, anchor);
|
list_add_tail(&dent->dent_link, anchor);
|
||||||
|
if (!dent->d_path || dent->d_unordered)
|
||||||
|
continue;
|
||||||
|
hash = dent_hash(dent->d_path, strlen(dent->d_path));
|
||||||
|
dent->d_hash = hash;
|
||||||
|
hash_anchor = DENT_HASH_ANCHOR(global, hash);
|
||||||
|
list_add_tail(&dent->dent_hash_link, hash_anchor);
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
up_write(&global->dent_mutex);
|
up_write(&global->dent_mutex);
|
||||||
|
|
Loading…
Reference in New Issue