scoutfs: add counters for the source of commits

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-11-30 13:13:45 -06:00
committed by Mark Fasheh
parent e800cb6785
commit 15fe0eaa95
5 changed files with 27 additions and 6 deletions
+5
View File
@@ -17,6 +17,11 @@
EXPAND_COUNTER(seg_alloc) \
EXPAND_COUNTER(seg_shrink) \
EXPAND_COUNTER(seg_free) \
EXPAND_COUNTER(trans_commit_fsync) \
EXPAND_COUNTER(trans_commit_full) \
EXPAND_COUNTER(trans_commit_item_flush) \
EXPAND_COUNTER(trans_commit_sync_fs) \
EXPAND_COUNTER(trans_commit_timer) \
EXPAND_COUNTER(trans_level0_seg_writes) \
EXPAND_COUNTER(trans_level0_seg_write_bytes) \
EXPAND_COUNTER(manifest_compact_migrate) \
+4 -2
View File
@@ -1805,8 +1805,10 @@ int scoutfs_item_writeback(struct super_block *sb,
spin_unlock_irqrestore(&cac->lock, flags);
if (sync)
ret = scoutfs_sync_fs(sb, 1);
if (sync) {
scoutfs_inc_counter(sb, trans_commit_item_flush);
ret = scoutfs_trans_sync(sb, 1);
}
return ret;
}
+8
View File
@@ -90,6 +90,14 @@ static int scoutfs_statfs(struct dentry *dentry, struct kstatfs *kst)
return 0;
}
static int scoutfs_sync_fs(struct super_block *sb, int wait)
{
trace_scoutfs_sync_fs(sb, wait);
scoutfs_inc_counter(sb, trans_commit_sync_fs);
return scoutfs_trans_sync(sb, wait);
}
static const struct super_operations scoutfs_super_ops = {
.alloc_inode = scoutfs_alloc_inode,
.drop_inode = scoutfs_drop_inode,
+9 -3
View File
@@ -123,7 +123,10 @@ void scoutfs_trans_write_func(struct work_struct *work)
trace_scoutfs_trans_write_func(sb, scoutfs_item_has_dirty(sb));
if (scoutfs_item_has_dirty(sb)) {
if (sbi->trans_deadline_expired)
scoutfs_inc_counter(sb, trans_commit_timer);
/*
* XXX only straight pass through, we're not worrying
* about leaking segnos nor duplicate manifest entries
@@ -218,13 +221,12 @@ static void queue_trans_work(struct scoutfs_sb_info *sbi)
* before the caller got here that wouldn't be covered by a commit
* that's in flight.
*/
int scoutfs_sync_fs(struct super_block *sb, int wait)
int scoutfs_trans_sync(struct super_block *sb, int wait)
{
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);
struct write_attempt attempt;
int ret;
trace_scoutfs_sync_fs(sb, wait);
if (!wait) {
queue_trans_work(sbi);
@@ -248,7 +250,10 @@ int scoutfs_sync_fs(struct super_block *sb, int wait)
int scoutfs_file_fsync(struct file *file, loff_t start, loff_t end,
int datasync)
{
return scoutfs_sync_fs(file->f_inode->i_sb, 1);
struct super_block *sb = file_inode(file)->i_sb;
scoutfs_inc_counter(sb, trans_commit_fsync);
return scoutfs_trans_sync(sb, 1);
}
void scoutfs_trans_restart_sync_deadline(struct super_block *sb)
@@ -317,6 +322,7 @@ static bool acquired_hold(struct super_block *sb,
vals = tri->reserved_vals + cnt->vals;
fits = scoutfs_item_dirty_fits_single(sb, items, keys, vals);
if (!fits) {
scoutfs_inc_counter(sb, trans_commit_full);
queue_trans_work(sbi);
goto out;
}
+1 -1
View File
@@ -4,7 +4,7 @@
#include "count.h"
void scoutfs_trans_write_func(struct work_struct *work);
int scoutfs_sync_fs(struct super_block *sb, int wait);
int scoutfs_trans_sync(struct super_block *sb, int wait);
int scoutfs_file_fsync(struct file *file, loff_t start, loff_t end,
int datasync);
void scoutfs_trans_restart_sync_deadline(struct super_block *sb);