mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-08 09:07:30 +00:00
scoutfs: always trace item create/delete ret
Add a trace event for item creation and always trace the return value of create and delete events. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+16
-9
@@ -1046,15 +1046,17 @@ int scoutfs_item_create(struct super_block *sb, struct scoutfs_key *key,
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
if (invalid_key_val(key, val))
|
||||
return -EINVAL;
|
||||
|
||||
if (WARN_ON_ONCE(!lock_coverage(lock, key, DLM_LOCK_EX)))
|
||||
return -EINVAL;
|
||||
if (invalid_key_val(key, val) ||
|
||||
WARN_ON_ONCE(!lock_coverage(lock, key, DLM_LOCK_EX))) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
item = alloc_item(sb, key, val);
|
||||
if (!item)
|
||||
return -ENOMEM;
|
||||
if (!item) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
do {
|
||||
spin_lock_irqsave(&cac->lock, flags);
|
||||
@@ -1078,6 +1080,8 @@ int scoutfs_item_create(struct super_block *sb, struct scoutfs_key *key,
|
||||
if (ret)
|
||||
free_item(sb, item);
|
||||
|
||||
out:
|
||||
trace_scoutfs_item_create(sb, key, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1355,8 +1359,10 @@ int scoutfs_item_delete(struct super_block *sb, struct scoutfs_key *key,
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
if (WARN_ON_ONCE(!lock_coverage(lock, key, DLM_LOCK_EX)))
|
||||
return -EINVAL;
|
||||
if (WARN_ON_ONCE(!lock_coverage(lock, key, DLM_LOCK_EX))) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
do {
|
||||
spin_lock_irqsave(&cac->lock, flags);
|
||||
@@ -1377,6 +1383,7 @@ int scoutfs_item_delete(struct super_block *sb, struct scoutfs_key *key,
|
||||
(ret = scoutfs_manifest_read_items(sb, key, &lock->start,
|
||||
&lock->end)) == 0);
|
||||
|
||||
out:
|
||||
trace_scoutfs_item_delete(sb, key, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -249,6 +249,10 @@ DECLARE_EVENT_CLASS(scoutfs_key_ret_class,
|
||||
__entry->fsid, SK_ARG(&__entry->key), __entry->ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(scoutfs_key_ret_class, scoutfs_item_create,
|
||||
TP_PROTO(struct super_block *sb, struct scoutfs_key *key, int ret),
|
||||
TP_ARGS(sb, key, ret)
|
||||
);
|
||||
DEFINE_EVENT(scoutfs_key_ret_class, scoutfs_item_delete,
|
||||
TP_PROTO(struct super_block *sb, struct scoutfs_key *key, int ret),
|
||||
TP_ARGS(sb, key, ret)
|
||||
|
||||
Reference in New Issue
Block a user