Add some counters

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-01-12 15:38:28 -08:00
parent ded184b481
commit 0a5fb7fd83
5 changed files with 23 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
#include "treap.h"
#include "cmp.h"
#include "alloc.h"
#include "counters.h"
/*
* scoutfs allocates segments by storing regions of a bitmap in treap
@@ -165,6 +166,8 @@ int scoutfs_alloc_segno(struct super_block *sb, u64 *segno)
ret = 0;
out:
if (ret == 0)
scoutfs_inc_counter(sb, alloc_alloc);
up_write(&sal->rwsem);
trace_printk("segno %llu ret %d\n", *segno, ret);
@@ -201,6 +204,7 @@ int scoutfs_alloc_free(struct super_block *sb, u64 segno)
}
set_bit_le(nr, pend->reg.bits);
scoutfs_inc_counter(sb, alloc_free);
ret = 0;
out:
up_write(&sal->rwsem);

View File

@@ -23,6 +23,7 @@
#include "compact.h"
#include "manifest.h"
#include "trans.h"
#include "counters.h"
#include "scoutfs_trace.h"
/*
@@ -131,6 +132,7 @@ static int read_segments(struct super_block *sb, struct compact_cursor *curs)
}
cseg->seg = seg;
scoutfs_inc_counter(sb, compact_segment_read);
}
list_for_each_entry(cseg, &curs->csegs, entry) {
@@ -165,6 +167,7 @@ static int write_segments(struct super_block *sb, struct list_head *results)
ret = scoutfs_seg_submit_write(sb, cseg->seg, &comp);
if (ret)
break;
scoutfs_inc_counter(sb, compact_segment_write);
}
err = scoutfs_bio_wait_comp(sb, &comp);
@@ -475,6 +478,8 @@ static void scoutfs_compact_func(struct work_struct *work)
if (ret <= 0)
goto out;
scoutfs_inc_counter(sb, compact_compactions);
ret = read_segments(sb, &curs) ?:
compact_segments(sb, &curs, &results) ?:
write_segments(sb, &results) ?:

View File

@@ -12,11 +12,18 @@
* other places by this macro. Don't forget to update LAST_COUNTER.
*/
#define EXPAND_EACH_COUNTER \
EXPAND_COUNTER(alloc_alloc) \
EXPAND_COUNTER(alloc_free) \
EXPAND_COUNTER(block_mem_alloc) \
EXPAND_COUNTER(block_mem_free)
EXPAND_COUNTER(block_mem_free) \
EXPAND_COUNTER(trans_level0_seg_write) \
EXPAND_COUNTER(manifest_compact_migrate) \
EXPAND_COUNTER(compact_compactions) \
EXPAND_COUNTER(compact_segment_read) \
EXPAND_COUNTER(compact_segment_write)
#define FIRST_COUNTER block_mem_alloc
#define LAST_COUNTER block_mem_free
#define LAST_COUNTER compact_segment_write
#undef EXPAND_COUNTER
#define EXPAND_COUNTER(which) struct percpu_counter which;

View File

@@ -25,6 +25,7 @@
#include "compact.h"
#include "manifest.h"
#include "trans.h"
#include "counters.h"
#include "scoutfs_trace.h"
/*
@@ -762,6 +763,7 @@ int scoutfs_manifest_next_compact(struct super_block *sb, void *data)
goto out;
}
scoutfs_inc_counter(sb, manifest_compact_migrate);
goto done;
}

View File

@@ -29,6 +29,7 @@
#include "alloc.h"
#include "treap.h"
#include "compact.h"
#include "counters.h"
#include "scoutfs_trace.h"
/*
@@ -116,6 +117,8 @@ void scoutfs_trans_write_func(struct work_struct *work)
scoutfs_seg_put(seg);
if (ret)
goto out;
scoutfs_inc_counter(sb, trans_level0_seg_write);
}
if (scoutfs_manifest_has_dirty(sb) || scoutfs_alloc_has_dirty(sb)) {