mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-07 11:10:44 +00:00
scoutfs: track segment writes and bytes
Add counters for the count of used bytes in segments written. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -430,7 +430,9 @@ static int compact_segments(struct super_block *sb,
|
||||
if (ret)
|
||||
break;
|
||||
|
||||
scoutfs_inc_counter(sb, compact_segment_written);
|
||||
scoutfs_inc_counter(sb, compact_segment_writes);
|
||||
scoutfs_add_counter(sb, compact_segment_write_bytes,
|
||||
scoutfs_seg_total_bytes(seg));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -17,12 +17,14 @@
|
||||
EXPAND_COUNTER(seg_alloc) \
|
||||
EXPAND_COUNTER(seg_shrink) \
|
||||
EXPAND_COUNTER(seg_free) \
|
||||
EXPAND_COUNTER(trans_level0_seg_write) \
|
||||
EXPAND_COUNTER(trans_level0_seg_writes) \
|
||||
EXPAND_COUNTER(trans_level0_seg_write_bytes) \
|
||||
EXPAND_COUNTER(manifest_compact_migrate) \
|
||||
EXPAND_COUNTER(compact_operations) \
|
||||
EXPAND_COUNTER(compact_segment_moved) \
|
||||
EXPAND_COUNTER(compact_segment_read) \
|
||||
EXPAND_COUNTER(compact_segment_written) \
|
||||
EXPAND_COUNTER(compact_segment_writes) \
|
||||
EXPAND_COUNTER(compact_segment_write_bytes) \
|
||||
EXPAND_COUNTER(compact_sticky_upper) \
|
||||
EXPAND_COUNTER(compact_sticky_written) \
|
||||
EXPAND_COUNTER(data_readpage) \
|
||||
|
||||
@@ -557,6 +557,16 @@ int scoutfs_seg_next_off(struct scoutfs_segment *seg, int off)
|
||||
return off;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the count of bytes of the segment actually used.
|
||||
*/
|
||||
u32 scoutfs_seg_total_bytes(struct scoutfs_segment *seg)
|
||||
{
|
||||
struct scoutfs_segment_block *sblk = off_ptr(seg, 0);
|
||||
|
||||
return le32_to_cpu(sblk->total_bytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the given item population will fit in a single
|
||||
* segment.
|
||||
|
||||
@@ -25,6 +25,7 @@ int scoutfs_seg_wait(struct super_block *sb, struct scoutfs_segment *seg);
|
||||
int scoutfs_seg_find_off(struct scoutfs_segment *seg,
|
||||
struct scoutfs_key_buf *key);
|
||||
int scoutfs_seg_next_off(struct scoutfs_segment *seg, int off);
|
||||
u32 scoutfs_seg_total_bytes(struct scoutfs_segment *seg);
|
||||
int scoutfs_seg_item_ptrs(struct scoutfs_segment *seg, int off,
|
||||
struct scoutfs_key_buf *key, struct kvec *val,
|
||||
u8 *flags);
|
||||
|
||||
@@ -142,7 +142,9 @@ void scoutfs_trans_write_func(struct work_struct *work)
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
scoutfs_inc_counter(sb, trans_level0_seg_write);
|
||||
scoutfs_inc_counter(sb, trans_level0_seg_writes);
|
||||
scoutfs_add_counter(sb, trans_level0_seg_write_bytes,
|
||||
scoutfs_seg_total_bytes(seg));
|
||||
|
||||
} else if (sbi->trans_deadline_expired) {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user