]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: tracepoints: add trace event for btrfs_record_snapshot_destroy()
authorFilipe Manana <fdmanana@suse.com>
Mon, 11 May 2026 15:05:13 +0000 (16:05 +0100)
committerFilipe Manana <fdmanana@suse.com>
Tue, 9 Jun 2026 10:49:24 +0000 (11:49 +0100)
btrfs_record_snapshot_destroy() is an important operation that affects
inode logging and is called during subvolume/snapshot deletion as well as
during rmdir. Add a trace event for it to help debug issues.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c
include/trace/events/btrfs.h

index 627705faa851b7bfe4bdb50a7ad700ab0a18eac6..7f014e6be4b713050321213763932e66dd803406 100644 (file)
@@ -8002,6 +8002,8 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
 void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
                                   struct btrfs_inode *dir)
 {
+       trace_btrfs_record_snapshot_destroy(trans, dir);
+
        mutex_lock(&dir->log_mutex);
        dir->last_unlink_trans = trans->transid;
        mutex_unlock(&dir->log_mutex);
index 1571c445abe6db5e4bfa155395b6059cd8bf396e..a14a8d32a6f18e8dc123d74acb070dcb70d8baf3 100644 (file)
@@ -1431,6 +1431,31 @@ TRACE_EVENT(btrfs_record_unlink_dir,
                        __entry->ino, __entry->dir, __entry->for_rename)
 );
 
+TRACE_EVENT(btrfs_record_snapshot_destroy,
+
+       TP_PROTO(const struct btrfs_trans_handle *trans,
+                const struct btrfs_inode *dir),
+
+       TP_ARGS(trans, dir),
+
+       TP_STRUCT__entry_btrfs(
+               __field(        u64,            root_objectid           )
+               __field(        u64,            transid                 )
+               __field(        u64,            dir                     )
+       ),
+
+       TP_fast_assign(
+               TP_fast_assign_fsid(trans->fs_info);
+               __entry->root_objectid          = btrfs_root_id(dir->root);
+               __entry->transid                = trans->transid;
+               __entry->dir                    = btrfs_ino(dir);
+       ),
+
+       TP_printk_btrfs("root=%llu(%s) transid=%llu dir=%llu",
+                       show_root_type(__entry->root_objectid), __entry->transid,
+                       __entry->dir)
+);
+
 TRACE_EVENT(btrfs_sync_fs,
 
        TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),