diff --git a/kmod/src/counters.h b/kmod/src/counters.h index 3cfea65f..94101e6a 100644 --- a/kmod/src/counters.h +++ b/kmod/src/counters.h @@ -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) \ diff --git a/kmod/src/item.c b/kmod/src/item.c index e9e7bc65..b5afda23 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -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; } diff --git a/kmod/src/super.c b/kmod/src/super.c index 83dabb5e..719640e1 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -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, diff --git a/kmod/src/trans.c b/kmod/src/trans.c index 31b4a768..2f3fde7e 100644 --- a/kmod/src/trans.c +++ b/kmod/src/trans.c @@ -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; } diff --git a/kmod/src/trans.h b/kmod/src/trans.h index 775c9f62..0df05ff3 100644 --- a/kmod/src/trans.h +++ b/kmod/src/trans.h @@ -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);