Browse Source

Merge pull request #1026 from trapexit/loglock

Lock less often during logging
pull/1031/head 2.33.4
trapexit 3 years ago
committed by GitHub
parent
commit
77e6f400b5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      libfuse/lib/fuse.c
  2. 16
      libfuse/lib/lfmp.h

13
libfuse/lib/fuse.c

@ -4006,7 +4006,7 @@ metrics_log_nodes_info(struct fuse *f_,
{ {
char buf[1024]; char buf[1024];
pthread_mutex_lock(&f_->lock);
lfmp_lock(&f_->node_fmp);
snprintf(buf,sizeof(buf), snprintf(buf,sizeof(buf),
"time: %zu\n" "time: %zu\n"
"sizeof(node): %zu\n" "sizeof(node): %zu\n"
@ -4030,12 +4030,12 @@ metrics_log_nodes_info(struct fuse *f_,
f_->name_table.size, f_->name_table.size,
f_->name_table.use, f_->name_table.use,
(f_->name_table.size * sizeof(struct node*)), (f_->name_table.size * sizeof(struct node*)),
lfmp_slab_count(&f_->node_fmp),
lfmp_slab_usage_ratio(&f_->node_fmp),
lfmp_avail_objs(&f_->node_fmp),
lfmp_total_allocated_memory(&f_->node_fmp)
fmp_slab_count(&f_->node_fmp.fmp),
fmp_slab_usage_ratio(&f_->node_fmp.fmp),
fmp_avail_objs(&f_->node_fmp.fmp),
fmp_total_allocated_memory(&f_->node_fmp.fmp)
); );
pthread_mutex_unlock(&f_->lock);
lfmp_unlock(&f_->node_fmp);
fputs(buf,file_); fputs(buf,file_);
} }
@ -4075,7 +4075,6 @@ fuse_maintenance_loop(void *fuse_)
int gc; int gc;
int loops; int loops;
int sleep_time; int sleep_time;
double slab_usage_ratio;
struct fuse *f = (struct fuse*)fuse_; struct fuse *f = (struct fuse*)fuse_;
gc = 0; gc = 0;

16
libfuse/lib/lfmp.h

@ -42,6 +42,22 @@ lfmp_init(lfmp_t *lfmp_,
pthread_mutex_init(&lfmp_->lock,NULL); pthread_mutex_init(&lfmp_->lock,NULL);
} }
static
inline
void
lfmp_lock(lfmp_t *lfmp_)
{
pthread_mutex_lock(&lfmp_->lock);
}
static
inline
void
lfmp_unlock(lfmp_t *lfmp_)
{
pthread_mutex_unlock(&lfmp_->lock);
}
static static
inline inline
uint64_t uint64_t

Loading…
Cancel
Save