mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
ceph: rename the metric helpers
Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
54b026b456
commit
8ae99ae2b4
@ -225,7 +225,7 @@ static void finish_netfs_read(struct ceph_osd_request *req)
|
||||
int num_pages;
|
||||
int err = req->r_result;
|
||||
|
||||
ceph_update_read_latency(&fsc->mdsc->metric, req->r_start_latency,
|
||||
ceph_update_read_metrics(&fsc->mdsc->metric, req->r_start_latency,
|
||||
req->r_end_latency, err);
|
||||
|
||||
dout("%s: result %d subreq->len=%zu i_size=%lld\n", __func__, req->r_result,
|
||||
@ -559,7 +559,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
|
||||
if (!err)
|
||||
err = ceph_osdc_wait_request(osdc, req);
|
||||
|
||||
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
|
||||
ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
|
||||
req->r_end_latency, err);
|
||||
|
||||
ceph_osdc_put_request(req);
|
||||
@ -647,7 +647,7 @@ static void writepages_finish(struct ceph_osd_request *req)
|
||||
ceph_clear_error_write(ci);
|
||||
}
|
||||
|
||||
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
|
||||
ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
|
||||
req->r_end_latency, rc);
|
||||
|
||||
/*
|
||||
@ -1716,7 +1716,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
|
||||
if (!err)
|
||||
err = ceph_osdc_wait_request(&fsc->client->osdc, req);
|
||||
|
||||
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
|
||||
ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
|
||||
req->r_end_latency, err);
|
||||
|
||||
out_put:
|
||||
|
@ -162,34 +162,34 @@ static int metric_show(struct seq_file *s, void *p)
|
||||
seq_printf(s, "item total avg_lat(us) min_lat(us) max_lat(us) stdev(us)\n");
|
||||
seq_printf(s, "-----------------------------------------------------------------------------------\n");
|
||||
|
||||
spin_lock(&m->read_latency_lock);
|
||||
spin_lock(&m->read_metric_lock);
|
||||
total = m->total_reads;
|
||||
sum = m->read_latency_sum;
|
||||
avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
|
||||
min = m->read_latency_min;
|
||||
max = m->read_latency_max;
|
||||
sq = m->read_latency_sq_sum;
|
||||
spin_unlock(&m->read_latency_lock);
|
||||
spin_unlock(&m->read_metric_lock);
|
||||
CEPH_METRIC_SHOW("read", total, avg, min, max, sq);
|
||||
|
||||
spin_lock(&m->write_latency_lock);
|
||||
spin_lock(&m->write_metric_lock);
|
||||
total = m->total_writes;
|
||||
sum = m->write_latency_sum;
|
||||
avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
|
||||
min = m->write_latency_min;
|
||||
max = m->write_latency_max;
|
||||
sq = m->write_latency_sq_sum;
|
||||
spin_unlock(&m->write_latency_lock);
|
||||
spin_unlock(&m->write_metric_lock);
|
||||
CEPH_METRIC_SHOW("write", total, avg, min, max, sq);
|
||||
|
||||
spin_lock(&m->metadata_latency_lock);
|
||||
spin_lock(&m->metadata_metric_lock);
|
||||
total = m->total_metadatas;
|
||||
sum = m->metadata_latency_sum;
|
||||
avg = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum, total) : 0;
|
||||
min = m->metadata_latency_min;
|
||||
max = m->metadata_latency_max;
|
||||
sq = m->metadata_latency_sq_sum;
|
||||
spin_unlock(&m->metadata_latency_lock);
|
||||
spin_unlock(&m->metadata_metric_lock);
|
||||
CEPH_METRIC_SHOW("metadata", total, avg, min, max, sq);
|
||||
|
||||
seq_printf(s, "\n");
|
||||
|
@ -895,7 +895,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to,
|
||||
if (!ret)
|
||||
ret = ceph_osdc_wait_request(osdc, req);
|
||||
|
||||
ceph_update_read_latency(&fsc->mdsc->metric,
|
||||
ceph_update_read_metrics(&fsc->mdsc->metric,
|
||||
req->r_start_latency,
|
||||
req->r_end_latency,
|
||||
ret);
|
||||
@ -1040,10 +1040,10 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
|
||||
/* r_start_latency == 0 means the request was not submitted */
|
||||
if (req->r_start_latency) {
|
||||
if (aio_req->write)
|
||||
ceph_update_write_latency(metric, req->r_start_latency,
|
||||
ceph_update_write_metrics(metric, req->r_start_latency,
|
||||
req->r_end_latency, rc);
|
||||
else
|
||||
ceph_update_read_latency(metric, req->r_start_latency,
|
||||
ceph_update_read_metrics(metric, req->r_start_latency,
|
||||
req->r_end_latency, rc);
|
||||
}
|
||||
|
||||
@ -1293,10 +1293,10 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
|
||||
ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
|
||||
|
||||
if (write)
|
||||
ceph_update_write_latency(metric, req->r_start_latency,
|
||||
ceph_update_write_metrics(metric, req->r_start_latency,
|
||||
req->r_end_latency, ret);
|
||||
else
|
||||
ceph_update_read_latency(metric, req->r_start_latency,
|
||||
ceph_update_read_metrics(metric, req->r_start_latency,
|
||||
req->r_end_latency, ret);
|
||||
|
||||
size = i_size_read(inode);
|
||||
@ -1470,7 +1470,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
|
||||
if (!ret)
|
||||
ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
|
||||
|
||||
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
|
||||
ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
|
||||
req->r_end_latency, ret);
|
||||
out:
|
||||
ceph_osdc_put_request(req);
|
||||
|
@ -3306,7 +3306,7 @@ out_err:
|
||||
/* kick calling process */
|
||||
complete_request(mdsc, req);
|
||||
|
||||
ceph_update_metadata_latency(&mdsc->metric, req->r_start_latency,
|
||||
ceph_update_metadata_metrics(&mdsc->metric, req->r_start_latency,
|
||||
req->r_end_latency, err);
|
||||
out:
|
||||
ceph_mdsc_put_request(req);
|
||||
|
@ -183,21 +183,21 @@ int ceph_metric_init(struct ceph_client_metric *m)
|
||||
if (ret)
|
||||
goto err_i_caps_mis;
|
||||
|
||||
spin_lock_init(&m->read_latency_lock);
|
||||
spin_lock_init(&m->read_metric_lock);
|
||||
m->read_latency_sq_sum = 0;
|
||||
m->read_latency_min = KTIME_MAX;
|
||||
m->read_latency_max = 0;
|
||||
m->total_reads = 0;
|
||||
m->read_latency_sum = 0;
|
||||
|
||||
spin_lock_init(&m->write_latency_lock);
|
||||
spin_lock_init(&m->write_metric_lock);
|
||||
m->write_latency_sq_sum = 0;
|
||||
m->write_latency_min = KTIME_MAX;
|
||||
m->write_latency_max = 0;
|
||||
m->total_writes = 0;
|
||||
m->write_latency_sum = 0;
|
||||
|
||||
spin_lock_init(&m->metadata_latency_lock);
|
||||
spin_lock_init(&m->metadata_metric_lock);
|
||||
m->metadata_latency_sq_sum = 0;
|
||||
m->metadata_latency_min = KTIME_MAX;
|
||||
m->metadata_latency_max = 0;
|
||||
@ -274,7 +274,7 @@ static inline void __update_latency(ktime_t *totalp, ktime_t *lsump,
|
||||
*sq_sump += sq;
|
||||
}
|
||||
|
||||
void ceph_update_read_latency(struct ceph_client_metric *m,
|
||||
void ceph_update_read_metrics(struct ceph_client_metric *m,
|
||||
ktime_t r_start, ktime_t r_end,
|
||||
int rc)
|
||||
{
|
||||
@ -283,14 +283,14 @@ void ceph_update_read_latency(struct ceph_client_metric *m,
|
||||
if (unlikely(rc < 0 && rc != -ENOENT && rc != -ETIMEDOUT))
|
||||
return;
|
||||
|
||||
spin_lock(&m->read_latency_lock);
|
||||
spin_lock(&m->read_metric_lock);
|
||||
__update_latency(&m->total_reads, &m->read_latency_sum,
|
||||
&m->read_latency_min, &m->read_latency_max,
|
||||
&m->read_latency_sq_sum, lat);
|
||||
spin_unlock(&m->read_latency_lock);
|
||||
spin_unlock(&m->read_metric_lock);
|
||||
}
|
||||
|
||||
void ceph_update_write_latency(struct ceph_client_metric *m,
|
||||
void ceph_update_write_metrics(struct ceph_client_metric *m,
|
||||
ktime_t r_start, ktime_t r_end,
|
||||
int rc)
|
||||
{
|
||||
@ -299,14 +299,14 @@ void ceph_update_write_latency(struct ceph_client_metric *m,
|
||||
if (unlikely(rc && rc != -ETIMEDOUT))
|
||||
return;
|
||||
|
||||
spin_lock(&m->write_latency_lock);
|
||||
spin_lock(&m->write_metric_lock);
|
||||
__update_latency(&m->total_writes, &m->write_latency_sum,
|
||||
&m->write_latency_min, &m->write_latency_max,
|
||||
&m->write_latency_sq_sum, lat);
|
||||
spin_unlock(&m->write_latency_lock);
|
||||
spin_unlock(&m->write_metric_lock);
|
||||
}
|
||||
|
||||
void ceph_update_metadata_latency(struct ceph_client_metric *m,
|
||||
void ceph_update_metadata_metrics(struct ceph_client_metric *m,
|
||||
ktime_t r_start, ktime_t r_end,
|
||||
int rc)
|
||||
{
|
||||
@ -315,9 +315,9 @@ void ceph_update_metadata_latency(struct ceph_client_metric *m,
|
||||
if (unlikely(rc && rc != -ENOENT))
|
||||
return;
|
||||
|
||||
spin_lock(&m->metadata_latency_lock);
|
||||
spin_lock(&m->metadata_metric_lock);
|
||||
__update_latency(&m->total_metadatas, &m->metadata_latency_sum,
|
||||
&m->metadata_latency_min, &m->metadata_latency_max,
|
||||
&m->metadata_latency_sq_sum, lat);
|
||||
spin_unlock(&m->metadata_latency_lock);
|
||||
spin_unlock(&m->metadata_metric_lock);
|
||||
}
|
||||
|
@ -108,21 +108,21 @@ struct ceph_client_metric {
|
||||
struct percpu_counter i_caps_hit;
|
||||
struct percpu_counter i_caps_mis;
|
||||
|
||||
spinlock_t read_latency_lock;
|
||||
spinlock_t read_metric_lock;
|
||||
u64 total_reads;
|
||||
ktime_t read_latency_sum;
|
||||
ktime_t read_latency_sq_sum;
|
||||
ktime_t read_latency_min;
|
||||
ktime_t read_latency_max;
|
||||
|
||||
spinlock_t write_latency_lock;
|
||||
spinlock_t write_metric_lock;
|
||||
u64 total_writes;
|
||||
ktime_t write_latency_sum;
|
||||
ktime_t write_latency_sq_sum;
|
||||
ktime_t write_latency_min;
|
||||
ktime_t write_latency_max;
|
||||
|
||||
spinlock_t metadata_latency_lock;
|
||||
spinlock_t metadata_metric_lock;
|
||||
u64 total_metadatas;
|
||||
ktime_t metadata_latency_sum;
|
||||
ktime_t metadata_latency_sq_sum;
|
||||
@ -162,13 +162,13 @@ static inline void ceph_update_cap_mis(struct ceph_client_metric *m)
|
||||
percpu_counter_inc(&m->i_caps_mis);
|
||||
}
|
||||
|
||||
extern void ceph_update_read_latency(struct ceph_client_metric *m,
|
||||
extern void ceph_update_read_metrics(struct ceph_client_metric *m,
|
||||
ktime_t r_start, ktime_t r_end,
|
||||
int rc);
|
||||
extern void ceph_update_write_latency(struct ceph_client_metric *m,
|
||||
extern void ceph_update_write_metrics(struct ceph_client_metric *m,
|
||||
ktime_t r_start, ktime_t r_end,
|
||||
int rc);
|
||||
extern void ceph_update_metadata_latency(struct ceph_client_metric *m,
|
||||
extern void ceph_update_metadata_metrics(struct ceph_client_metric *m,
|
||||
ktime_t r_start, ktime_t r_end,
|
||||
int rc);
|
||||
#endif /* _FS_CEPH_MDS_METRIC_H */
|
||||
|
Loading…
Reference in New Issue
Block a user