scoutfs: add trans item tracking trace

Add a trace event that records the changes to a reservation's dirty item
count.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2018-04-18 09:26:30 -07:00
committed by Zach Brown
parent 1b3645db8b
commit dd091e18a9
2 changed files with 47 additions and 0 deletions

View File

@@ -660,6 +660,39 @@ TRACE_EVENT(scoutfs_trans_acquired_hold,
__entry->tri_items, __entry->tri_vals)
);
TRACE_EVENT(scoutfs_trans_track_item,
TP_PROTO(struct super_block *sb, int delta_items, int delta_vals,
int act_items, int act_vals, int res_items, int res_vals),
TP_ARGS(sb, delta_items, delta_vals, act_items, act_vals, res_items,
res_vals),
TP_STRUCT__entry(
__field(__u64, fsid)
__field(int, delta_items)
__field(int, delta_vals)
__field(int, act_items)
__field(int, act_vals)
__field(int, res_items)
__field(int, res_vals)
),
TP_fast_assign(
__entry->fsid = FSID_ARG(sb);
__entry->delta_items = delta_items;
__entry->delta_vals = delta_vals;
__entry->act_items = act_items;
__entry->act_vals = act_vals;
__entry->res_items = res_items;
__entry->res_vals = res_vals;
),
TP_printk("fsid "FSID_FMT" delta_items %d delta_vals %d act_items %d act_vals %d res_items %d res_vals %d",
__entry->fsid, __entry->delta_items, __entry->delta_vals,
__entry->act_items, __entry->act_vals, __entry->res_items,
__entry->res_vals)
);
TRACE_EVENT(scoutfs_ioc_release_ret,
TP_PROTO(struct super_block *sb, int ret),

View File

@@ -392,6 +392,16 @@ bool scoutfs_trans_held(void)
return rsv && rsv->magic == SCOUTFS_RESERVATION_MAGIC;
}
/*
* Record a transaction holder's individual contribution to the dirty
* items in the current transaction. We're making sure that the
* reservation matches the possible item manipulations while they hold
* the reservation.
*
* It is possible and legitimate for an individual contribution to be
* negative if they delete dirty items. The item cache makes sure that
* the total dirty item count doesn't fall below zero.
*/
void scoutfs_trans_track_item(struct super_block *sb, signed items,
signed vals)
{
@@ -406,6 +416,10 @@ void scoutfs_trans_track_item(struct super_block *sb, signed items,
rsv->actual.items += items;
rsv->actual.vals += vals;
trace_scoutfs_trans_track_item(sb, items, vals, rsv->actual.items,
rsv->actual.vals, rsv->reserved.items,
rsv->reserved.vals);
WARN_ON_ONCE(rsv->actual.items > rsv->reserved.items);
WARN_ON_ONCE(rsv->actual.vals > rsv->reserved.vals);
}