Changeset View
Changeset View
Standalone View
Standalone View
sys/nfs/nfs_fha.c
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | fha_hash_entry_remove(struct fha_hash_entry *e) | ||||
mtx_assert(e->mtx, MA_OWNED); | mtx_assert(e->mtx, MA_OWNED); | ||||
LIST_REMOVE(e, link); | LIST_REMOVE(e, link); | ||||
fha_hash_entry_destroy(e); | fha_hash_entry_destroy(e); | ||||
} | } | ||||
static struct fha_hash_entry * | static struct fha_hash_entry * | ||||
fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) | fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) | ||||
{ | { | ||||
SVCPOOL *pool; | |||||
struct fha_hash_slot *fhs; | struct fha_hash_slot *fhs; | ||||
struct fha_hash_entry *fhe, *new_fhe; | struct fha_hash_entry *fhe, *new_fhe; | ||||
pool = *softc->pool; | |||||
fhs = &softc->fha_hash[fh % FHA_HASH_SIZE]; | fhs = &softc->fha_hash[fh % FHA_HASH_SIZE]; | ||||
new_fhe = fha_hash_entry_new(fh); | new_fhe = fha_hash_entry_new(fh); | ||||
new_fhe->mtx = &fhs->mtx; | new_fhe->mtx = &fhs->mtx; | ||||
mtx_lock(&fhs->mtx); | mtx_lock(&fhs->mtx); | ||||
LIST_FOREACH(fhe, &fhs->list, link) | LIST_FOREACH(fhe, &fhs->list, link) | ||||
if (fhe->fh == fh) | if (fhe->fh == fh) | ||||
break; | break; | ||||
if (!fhe) { | if (!fhe) { | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
* Get the service thread currently associated with the fhe that is | * Get the service thread currently associated with the fhe that is | ||||
* appropriate to handle this operation. | * appropriate to handle this operation. | ||||
*/ | */ | ||||
static SVCTHREAD * | static SVCTHREAD * | ||||
fha_hash_entry_choose_thread(struct fha_params *softc, | fha_hash_entry_choose_thread(struct fha_params *softc, | ||||
struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread) | struct fha_hash_entry *fhe, struct fha_info *i, SVCTHREAD *this_thread) | ||||
{ | { | ||||
SVCTHREAD *thread, *min_thread = NULL; | SVCTHREAD *thread, *min_thread = NULL; | ||||
SVCPOOL *pool; | |||||
int req_count, min_count = 0; | int req_count, min_count = 0; | ||||
off_t offset1, offset2; | off_t offset1, offset2; | ||||
pool = *softc->pool; | |||||
LIST_FOREACH(thread, &fhe->threads, st_alink) { | LIST_FOREACH(thread, &fhe->threads, st_alink) { | ||||
req_count = thread->st_p2; | req_count = thread->st_p2; | ||||
/* If there are any writes in progress, use the first thread. */ | /* If there are any writes in progress, use the first thread. */ | ||||
if (fhe->num_exclusive) { | if (fhe->num_exclusive) { | ||||
#if 0 | #if 0 | ||||
ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, | ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, | ||||
"fha: %p(%d)w", thread, req_count); | "fha: %p(%d)w", thread, req_count); | ||||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc) | fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, struct fha_params *softc) | ||||
{ | { | ||||
int error, i; | int error, i; | ||||
struct sbuf sb; | struct sbuf sb; | ||||
struct fha_hash_entry *fhe; | struct fha_hash_entry *fhe; | ||||
bool_t first, hfirst; | bool_t first, hfirst; | ||||
SVCTHREAD *thread; | SVCTHREAD *thread; | ||||
SVCPOOL *pool; | |||||
sbuf_new(&sb, NULL, 65536, SBUF_FIXEDLEN); | sbuf_new(&sb, NULL, 65536, SBUF_FIXEDLEN); | ||||
pool = NULL; | |||||
if (!*softc->pool) { | if (!*softc->pool) { | ||||
sbuf_printf(&sb, "NFSD not running\n"); | sbuf_printf(&sb, "NFSD not running\n"); | ||||
goto out; | goto out; | ||||
} | } | ||||
pool = *softc->pool; | |||||
for (i = 0; i < FHA_HASH_SIZE; i++) | for (i = 0; i < FHA_HASH_SIZE; i++) | ||||
if (!LIST_EMPTY(&softc->fha_hash[i].list)) | if (!LIST_EMPTY(&softc->fha_hash[i].list)) | ||||
break; | break; | ||||
if (i == FHA_HASH_SIZE) { | if (i == FHA_HASH_SIZE) { | ||||
sbuf_printf(&sb, "No file handle entries.\n"); | sbuf_printf(&sb, "No file handle entries.\n"); | ||||
goto out; | goto out; | ||||
Show All 40 Lines |