diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 14:29:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 14:29:13 -0700 |
commit | 704996566f97e0e24c97052f81678060c213c260 (patch) | |
tree | 9a33550b4302e0f848e985a29f5fe56db9ca79a5 /include | |
parent | e3a44fd7e63321338f652714c20a4c75bed9f60b (diff) | |
parent | 23d0b79dfaed2305b500b0215b0421701ada6b1a (diff) |
Merge tag 'for-4.18-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs updates from David Sterba:
"User visible features:
- added support for the ioctl FS_IOC_FSGETXATTR, per-inode flags,
successor of GET/SETFLAGS; now supports only existing flags:
append, immutable, noatime, nodump, sync
- 3 new unprivileged ioctls to allow users to enumerate subvolumes
- dedupe syscall implementation does not restrict the range to 16MiB,
though it still splits the whole range to 16MiB chunks
- on user demand, rmdir() is able to delete an empty subvolume,
export the capability in sysfs
- fix inode number types in tracepoints, other cleanups
- send: improved speed when dealing with a large removed directory,
measurements show decrease from 2000 minutes to 2 minutes on a
directory with 2 million entries
- pre-commit check of superblock to detect a mysterious in-memory
corruption
- log message updates
Other changes:
- orphan inode cleanup improved, does no keep long-standing
reservations that could lead up to early ENOSPC in some cases
- slight improvement of handling snapshotted NOCOW files by avoiding
some unnecessary tree searches
- avoid OOM when dealing with many unmergeable small extents at flush
time
- speedup conversion of free space tree representations from/to
bitmap/tree
- code refactoring, deletion, cleanups:
+ delayed refs
+ delayed iput
+ redundant argument removals
+ memory barrier cleanups
+ remove a redundant mutex supposedly excluding several ioctls to
run in parallel
- new tracepoints for blockgroup manipulation
- more sanity checks of compressed headers"
* tag 'for-4.18-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (183 commits)
btrfs: Add unprivileged version of ino_lookup ioctl
btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF
btrfs: Add unprivileged ioctl which returns subvolume information
Btrfs: clean up error handling in btrfs_truncate()
btrfs: Factor out write portion of btrfs_get_blocks_direct
btrfs: Factor out read portion of btrfs_get_blocks_direct
btrfs: return ENOMEM if path allocation fails in btrfs_cross_ref_exist
btrfs: raid56: Remove VLA usage
btrfs: return error value if create_io_em failed in cow_file_range
btrfs: drop useless member qgroup_reserved of btrfs_pending_snapshot
btrfs: drop unused parameter qgroup_reserved
btrfs: balance dirty metadata pages in btrfs_finish_ordered_io
btrfs: lift some btrfs_cross_ref_exist checks in nocow path
btrfs: Remove fs_info argument from btrfs_uuid_tree_rem
btrfs: Remove fs_info argument from btrfs_uuid_tree_add
Btrfs: remove unused check of skip_locking
Btrfs: remove always true check in unlock_up
Btrfs: grab write lock directly if write_lock_level is the max level
Btrfs: move get root out of btrfs_search_slot to a helper
Btrfs: use more straightforward extent_buffer_uptodate check
...
Diffstat (limited to 'include')
-rw-r--r-- | include/trace/events/btrfs.h | 323 | ||||
-rw-r--r-- | include/uapi/linux/btrfs.h | 97 |
2 files changed, 281 insertions, 139 deletions
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 965c650a5273..39b94ec965be 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -121,9 +121,9 @@ TRACE_EVENT(btrfs_transaction_commit, __entry->root_objectid = root->root_key.objectid; ), - TP_printk_btrfs("root = %llu(%s), gen = %llu", + TP_printk_btrfs("root=%llu(%s) gen=%llu", show_root_type(__entry->root_objectid), - (unsigned long long)__entry->generation) + __entry->generation) ); DECLARE_EVENT_CLASS(btrfs__inode, @@ -133,7 +133,7 @@ DECLARE_EVENT_CLASS(btrfs__inode, TP_ARGS(inode), TP_STRUCT__entry_btrfs( - __field( ino_t, ino ) + __field( u64, ino ) __field( blkcnt_t, blocks ) __field( u64, disk_i_size ) __field( u64, generation ) @@ -143,7 +143,7 @@ DECLARE_EVENT_CLASS(btrfs__inode, ), TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), - __entry->ino = inode->i_ino; + __entry->ino = btrfs_ino(BTRFS_I(inode)); __entry->blocks = inode->i_blocks; __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; __entry->generation = BTRFS_I(inode)->generation; @@ -153,15 +153,15 @@ DECLARE_EVENT_CLASS(btrfs__inode, BTRFS_I(inode)->root->root_key.objectid; ), - TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu " + TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " "disk_i_size=%llu last_trans=%llu logged_trans=%llu", show_root_type(__entry->root_objectid), - (unsigned long long)__entry->generation, - (unsigned long)__entry->ino, + __entry->generation, + __entry->ino, (unsigned long long)__entry->blocks, - (unsigned long long)__entry->disk_i_size, - (unsigned long long)__entry->last_trans, - (unsigned long long)__entry->logged_trans) + __entry->disk_i_size, + __entry->last_trans, + __entry->logged_trans) ); DEFINE_EVENT(btrfs__inode, btrfs_inode_new, @@ -244,23 +244,25 @@ TRACE_EVENT_CONDITION(btrfs_get_extent, "block_len=%llu flags=%s refs=%u " "compress_type=%u", show_root_type(__entry->root_objectid), - (unsigned long long)__entry->ino, - (unsigned long long)__entry->start, - (unsigned long long)__entry->len, - (unsigned long long)__entry->orig_start, + __entry->ino, + __entry->start, + __entry->len, + __entry->orig_start, show_map_type(__entry->block_start), - (unsigned long long)__entry->block_len, + __entry->block_len, show_map_flags(__entry->flags), __entry->refs, __entry->compress_type) ); TRACE_EVENT(btrfs_handle_em_exist, - TP_PROTO(const struct extent_map *existing, const struct extent_map *map, u64 start, u64 len), + TP_PROTO(struct btrfs_fs_info *fs_info, + const struct extent_map *existing, const struct extent_map *map, + u64 start, u64 len), - TP_ARGS(existing, map, start, len), + TP_ARGS(fs_info, existing, map, start, len), - TP_STRUCT__entry( + TP_STRUCT__entry_btrfs( __field( u64, e_start ) __field( u64, e_len ) __field( u64, map_start ) @@ -269,7 +271,7 @@ TRACE_EVENT(btrfs_handle_em_exist, __field( u64, len ) ), - TP_fast_assign( + TP_fast_assign_btrfs(fs_info, __entry->e_start = existing->start; __entry->e_len = existing->len; __entry->map_start = map->start; @@ -278,15 +280,15 @@ TRACE_EVENT(btrfs_handle_em_exist, __entry->len = len; ), - TP_printk("start=%llu len=%llu " + TP_printk_btrfs("start=%llu len=%llu " "existing(start=%llu len=%llu) " "em(start=%llu len=%llu)", - (unsigned long long)__entry->start, - (unsigned long long)__entry->len, - (unsigned long long)__entry->e_start, - (unsigned long long)__entry->e_len, - (unsigned long long)__entry->map_start, - (unsigned long long)__entry->map_len) + __entry->start, + __entry->len, + __entry->e_start, + __entry->e_len, + __entry->map_start, + __entry->map_len) ); /* file extent item */ @@ -443,7 +445,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent, TP_ARGS(inode, ordered), TP_STRUCT__entry_btrfs( - __field( ino_t, ino ) + __field( u64, ino ) __field( u64, file_offset ) __field( u64, start ) __field( u64, len ) @@ -457,7 +459,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent, ), TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), - __entry->ino = inode->i_ino; + __entry->ino = btrfs_ino(BTRFS_I(inode)); __entry->file_offset = ordered->file_offset; __entry->start = ordered->start; __entry->len = ordered->len; @@ -477,13 +479,13 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent, "bytes_left=%llu flags=%s compress_type=%d " "refs=%d", show_root_type(__entry->root_objectid), - (unsigned long long)__entry->ino, - (unsigned long long)__entry->file_offset, - (unsigned long long)__entry->start, - (unsigned long long)__entry->len, - (unsigned long long)__entry->disk_len, - (unsigned long long)__entry->truncated_len, - (unsigned long long)__entry->bytes_left, + __entry->ino, + __entry->file_offset, + __entry->start, + __entry->len, + __entry->disk_len, + __entry->truncated_len, + __entry->bytes_left, show_ordered_flags(__entry->flags), __entry->compress_type, __entry->refs) ); @@ -528,7 +530,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage, TP_ARGS(page, inode, wbc), TP_STRUCT__entry_btrfs( - __field( ino_t, ino ) + __field( u64, ino ) __field( pgoff_t, index ) __field( long, nr_to_write ) __field( long, pages_skipped ) @@ -542,7 +544,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage, ), TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), - __entry->ino = inode->i_ino; + __entry->ino = btrfs_ino(BTRFS_I(inode)); __entry->index = page->index; __entry->nr_to_write = wbc->nr_to_write; __entry->pages_skipped = wbc->pages_skipped; @@ -556,12 +558,12 @@ DECLARE_EVENT_CLASS(btrfs__writepage, BTRFS_I(inode)->root->root_key.objectid; ), - TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu " + TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " "nr_to_write=%ld pages_skipped=%ld range_start=%llu " "range_end=%llu for_kupdate=%d " "for_reclaim=%d range_cyclic=%d writeback_index=%lu", show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, __entry->index, + __entry->ino, __entry->index, __entry->nr_to_write, __entry->pages_skipped, __entry->range_start, __entry->range_end, __entry->for_kupdate, @@ -584,7 +586,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook, TP_ARGS(page, start, end, uptodate), TP_STRUCT__entry_btrfs( - __field( ino_t, ino ) + __field( u64, ino ) __field( pgoff_t, index ) __field( u64, start ) __field( u64, end ) @@ -593,7 +595,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook, ), TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), - __entry->ino = page->mapping->host->i_ino; + __entry->ino = btrfs_ino(BTRFS_I(page->mapping->host)); __entry->index = page->index; __entry->start = start; __entry->end = end; @@ -602,12 +604,12 @@ TRACE_EVENT(btrfs_writepage_end_io_hook, BTRFS_I(page->mapping->host)->root->root_key.objectid; ), - TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu " + TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu start=%llu " "end=%llu uptodate=%d", show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, (unsigned long)__entry->index, - (unsigned long long)__entry->start, - (unsigned long long)__entry->end, __entry->uptodate) + __entry->ino, (unsigned long)__entry->index, + __entry->start, + __entry->end, __entry->uptodate) ); TRACE_EVENT(btrfs_sync_file, @@ -617,8 +619,8 @@ TRACE_EVENT(btrfs_sync_file, TP_ARGS(file, datasync), TP_STRUCT__entry_btrfs( - __field( ino_t, ino ) - __field( ino_t, parent ) + __field( u64, ino ) + __field( u64, parent ) __field( int, datasync ) __field( u64, root_objectid ) ), @@ -628,16 +630,17 @@ TRACE_EVENT(btrfs_sync_file, const struct inode *inode = d_inode(dentry); TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); - __entry->ino = inode->i_ino; - __entry->parent = d_inode(dentry->d_parent)->i_ino; + __entry->ino = btrfs_ino(BTRFS_I(inode)); + __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); __entry->datasync = datasync; __entry->root_objectid = BTRFS_I(inode)->root->root_key.objectid; ), - TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d", + TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", show_root_type(__entry->root_objectid), - (unsigned long)__entry->ino, (unsigned long)__entry->parent, + __entry->ino, + __entry->parent, __entry->datasync) ); @@ -655,7 +658,7 @@ TRACE_EVENT(btrfs_sync_fs, __entry->wait = wait; ), - TP_printk_btrfs("wait = %d", __entry->wait) + TP_printk_btrfs("wait=%d", __entry->wait) ); TRACE_EVENT(btrfs_add_block_group, @@ -665,8 +668,7 @@ TRACE_EVENT(btrfs_add_block_group, TP_ARGS(fs_info, block_group, create), - TP_STRUCT__entry( - __array( u8, fsid, BTRFS_FSID_SIZE ) + TP_STRUCT__entry_btrfs( __field( u64, offset ) __field( u64, size ) __field( u64, flags ) @@ -675,8 +677,7 @@ TRACE_EVENT(btrfs_add_block_group, __field( int, create ) ), - TP_fast_assign( - memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); + TP_fast_assign_btrfs(fs_info, __entry->offset = block_group->key.objectid; __entry->size = block_group->key.offset; __entry->flags = block_group->flags; @@ -686,16 +687,16 @@ TRACE_EVENT(btrfs_add_block_group, __entry->create = create; ), - TP_printk("%pU: block_group offset=%llu size=%llu " + TP_printk_btrfs("block_group offset=%llu size=%llu " "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " - "create=%d", __entry->fsid, - (unsigned long long)__entry->offset, - (unsigned long long)__entry->size, - (unsigned long long)__entry->flags, + "create=%d", + __entry->offset, + __entry->size, + __entry->flags, __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), - (unsigned long long)__entry->bytes_used, - (unsigned long long)__entry->bytes_super, __entry->create) + __entry->bytes_used, + __entry->bytes_super, __entry->create) ); #define show_ref_action(action) \ @@ -740,13 +741,13 @@ DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " "parent=%llu(%s) ref_root=%llu(%s) level=%d " "type=%s seq=%llu", - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->num_bytes, + __entry->bytenr, + __entry->num_bytes, show_ref_action(__entry->action), show_root_type(__entry->parent), show_root_type(__entry->ref_root), __entry->level, show_ref_type(__entry->type), - (unsigned long long)__entry->seq) + __entry->seq) ); DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, @@ -805,15 +806,15 @@ DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " "offset=%llu type=%s seq=%llu", - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->num_bytes, + __entry->bytenr, + __entry->num_bytes, show_ref_action(__entry->action), show_root_type(__entry->parent), show_root_type(__entry->ref_root), - (unsigned long long)__entry->owner, - (unsigned long long)__entry->offset, + __entry->owner, + __entry->offset, show_ref_type(__entry->type), - (unsigned long long)__entry->seq) + __entry->seq) ); DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, @@ -859,8 +860,8 @@ DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, ), TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->num_bytes, + __entry->bytenr, + __entry->num_bytes, show_ref_action(__entry->action), __entry->is_data) ); @@ -923,8 +924,8 @@ DECLARE_EVENT_CLASS(btrfs__chunk, TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " "num_stripes=%d sub_stripes=%d type=%s", show_root_type(__entry->root_objectid), - (unsigned long long)__entry->offset, - (unsigned long long)__entry->size, + __entry->offset, + __entry->size, __entry->num_stripes, __entry->sub_stripes, show_chunk_type(__entry->type)) ); @@ -974,9 +975,9 @@ TRACE_EVENT(btrfs_cow_block, "(orig_level=%d) cow_buf=%llu (cow_level=%d)", show_root_type(__entry->root_objectid), __entry->refs, - (unsigned long long)__entry->buf_start, + __entry->buf_start, __entry->buf_level, - (unsigned long long)__entry->cow_start, + __entry->cow_start, __entry->cow_level) ); @@ -1001,7 +1002,7 @@ TRACE_EVENT(btrfs_space_reservation, __entry->reserve = reserve; ), - TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val, + TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, __entry->reserve ? "reserve" : "release", __entry->bytes) ); @@ -1019,29 +1020,27 @@ TRACE_EVENT(btrfs_trigger_flush, TP_ARGS(fs_info, flags, bytes, flush, reason), - TP_STRUCT__entry( - __array( u8, fsid, BTRFS_FSID_SIZE ) + TP_STRUCT__entry_btrfs( __field( u64, flags ) __field( u64, bytes ) __field( int, flush ) __string( reason, reason ) ), - TP_fast_assign( - memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); + TP_fast_assign_btrfs(fs_info, __entry->flags = flags; __entry->bytes = bytes; __entry->flush = flush; __assign_str(reason, reason) ), - TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu", - __entry->fsid, __get_str(reason), __entry->flush, + TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", + __get_str(reason), __entry->flush, show_flush_action(__entry->flush), - (unsigned long long)__entry->flags, + __entry->flags, __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), - (unsigned long long)__entry->bytes) + __entry->bytes) ); #define show_flush_state(state) \ @@ -1060,29 +1059,27 @@ TRACE_EVENT(btrfs_flush_space, TP_ARGS(fs_info, flags, num_bytes, state, ret), - TP_STRUCT__entry( - __array( u8, fsid, BTRFS_FSID_SIZE ) + TP_STRUCT__entry_btrfs( __field( u64, flags ) __field( u64, num_bytes ) __field( int, state ) __field( int, ret ) ), - TP_fast_assign( - memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); + TP_fast_assign_btrfs(fs_info, __entry->flags = flags; __entry->num_bytes = num_bytes; __entry->state = state; __entry->ret = ret; ), - TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d", - __entry->fsid, __entry->state, + TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d", + __entry->state, show_flush_state(__entry->state), - (unsigned long long)__entry->flags, + __entry->flags, __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), - (unsigned long long)__entry->num_bytes, __entry->ret) + __entry->num_bytes, __entry->ret) ); DECLARE_EVENT_CLASS(btrfs__reserved_extent, @@ -1103,8 +1100,8 @@ DECLARE_EVENT_CLASS(btrfs__reserved_extent, TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", show_root_type(BTRFS_EXTENT_TREE_OBJECTID), - (unsigned long long)__entry->start, - (unsigned long long)__entry->len) + __entry->start, + __entry->len) ); DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, @@ -1140,7 +1137,7 @@ TRACE_EVENT(find_free_extent, __entry->data = data; ), - TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)", + TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", show_root_type(BTRFS_EXTENT_TREE_OBJECTID), __entry->num_bytes, __entry->empty_size, __entry->data, __print_flags((unsigned long)__entry->data, "|", @@ -1149,11 +1146,10 @@ TRACE_EVENT(find_free_extent, DECLARE_EVENT_CLASS(btrfs__reserve_extent, - TP_PROTO(const struct btrfs_fs_info *fs_info, - const struct btrfs_block_group_cache *block_group, u64 start, + TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start, u64 len), - TP_ARGS(fs_info, block_group, start, len), + TP_ARGS(block_group, start, len), TP_STRUCT__entry_btrfs( __field( u64, bg_objectid ) @@ -1162,15 +1158,15 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent, __field( u64, len ) ), - TP_fast_assign_btrfs(fs_info, + TP_fast_assign_btrfs(block_group->fs_info, __entry->bg_objectid = block_group->key.objectid; __entry->flags = block_group->flags; __entry->start = start; __entry->len = len; ), - TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) " - "start=%Lu len=%Lu", + TP_printk_btrfs("root=%llu(%s) block_group=%llu flags=%llu(%s) " + "start=%llu len=%llu", show_root_type(BTRFS_EXTENT_TREE_OBJECTID), __entry->bg_objectid, __entry->flags, __print_flags((unsigned long)__entry->flags, @@ -1180,20 +1176,18 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent, DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, - TP_PROTO(const struct btrfs_fs_info *fs_info, - const struct btrfs_block_group_cache *block_group, u64 start, + TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start, u64 len), - TP_ARGS(fs_info, block_group, start, len) + TP_ARGS(block_group, start, len) ); DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, - TP_PROTO(const struct btrfs_fs_info *fs_info, - const struct btrfs_block_group_cache *block_group, u64 start, + TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start, u64 len), - TP_ARGS(fs_info, block_group, start, len) + TP_ARGS(block_group, start, len) ); TRACE_EVENT(btrfs_find_cluster, @@ -1221,8 +1215,8 @@ TRACE_EVENT(btrfs_find_cluster, __entry->min_bytes = min_bytes; ), - TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu " - "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid, + TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " + "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, __entry->flags, __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), __entry->start, @@ -1243,7 +1237,7 @@ TRACE_EVENT(btrfs_failed_cluster_setup, __entry->bg_objectid = block_group->key.objectid; ), - TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid) + TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) ); TRACE_EVENT(btrfs_setup_cluster, @@ -1272,8 +1266,8 @@ TRACE_EVENT(btrfs_setup_cluster, __entry->bitmap = bitmap; ), - TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu " - "size=%Lu max_size=%Lu bitmap=%d", + TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " + "size=%llu max_size=%llu bitmap=%d", __entry->bg_objectid, __entry->flags, __print_flags((unsigned long)__entry->flags, "|", @@ -1476,7 +1470,7 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, TP_STRUCT__entry_btrfs( __field( u64, rootid ) - __field( unsigned long, ino ) + __field( u64, ino ) __field( u64, start ) __field( u64, len ) __field( u64, reserved ) @@ -1485,14 +1479,14 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), __entry->rootid = BTRFS_I(inode)->root->objectid; - __entry->ino = inode->i_ino; + __entry->ino = btrfs_ino(BTRFS_I(inode)); __entry->start = start; __entry->len = len; __entry->reserved = reserved; __entry->op = op; ), - TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s", + TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", __entry->rootid, __entry->ino, __entry->start, __entry->len, __entry->reserved, __print_flags((unsigned long)__entry->op, "", @@ -1584,12 +1578,14 @@ DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, TRACE_EVENT(btrfs_qgroup_account_extent, - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr, + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), - TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots), + TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, + nr_new_roots), TP_STRUCT__entry_btrfs( + __field( u64, transid ) __field( u64, bytenr ) __field( u64, num_bytes ) __field( u64, nr_old_roots ) @@ -1597,43 +1593,49 @@ TRACE_EVENT(btrfs_qgroup_account_extent, ), TP_fast_assign_btrfs(fs_info, + __entry->transid = transid; __entry->bytenr = bytenr; __entry->num_bytes = num_bytes; __entry->nr_old_roots = nr_old_roots; __entry->nr_new_roots = nr_new_roots; ), - TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu " - "nr_new_roots=%llu", - __entry->bytenr, - __entry->num_bytes, - __entry->nr_old_roots, - __entry->nr_new_roots) + TP_printk_btrfs( +"transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", + __entry->transid, + __entry->bytenr, + __entry->num_bytes, + __entry->nr_old_roots, + __entry->nr_new_roots) ); TRACE_EVENT(qgroup_update_counters, - TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid, + TP_PROTO(const struct btrfs_fs_info *fs_info, + struct btrfs_qgroup *qgroup, u64 cur_old_count, u64 cur_new_count), - TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count), + TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), TP_STRUCT__entry_btrfs( __field( u64, qgid ) + __field( u64, old_rfer ) + __field( u64, old_excl ) __field( u64, cur_old_count ) __field( u64, cur_new_count ) ), TP_fast_assign_btrfs(fs_info, - __entry->qgid = qgid; + __entry->qgid = qgroup->qgroupid; + __entry->old_rfer = qgroup->rfer; + __entry->old_excl = qgroup->excl; __entry->cur_old_count = cur_old_count; __entry->cur_new_count = cur_new_count; ), - TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu", - __entry->qgid, - __entry->cur_old_count, - __entry->cur_new_count) + TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", + __entry->qgid, __entry->old_rfer, __entry->old_excl, + __entry->cur_old_count, __entry->cur_new_count) ); TRACE_EVENT(qgroup_update_reserve, @@ -1765,14 +1767,14 @@ DECLARE_EVENT_CLASS(btrfs__prelim_ref, ), TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu", - (unsigned long long)__entry->root_id, - (unsigned long long)__entry->objectid, __entry->type, - (unsigned long long)__entry->offset, __entry->level, + __entry->root_id, + __entry->objectid, __entry->type, + __entry->offset, __entry->level, __entry->old_count, __entry->mod_count, __entry->old_count + __entry->mod_count, - (unsigned long long)__entry->parent, - (unsigned long long)__entry->bytenr, - (unsigned long long)__entry->tree_size) + __entry->parent, + __entry->bytenr, + __entry->tree_size) ); DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, @@ -1808,8 +1810,51 @@ TRACE_EVENT(btrfs_inode_mod_outstanding_extents, TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", show_root_type(__entry->root_objectid), - (unsigned long long)__entry->ino, __entry->mod) + __entry->ino, __entry->mod) ); + +DECLARE_EVENT_CLASS(btrfs__block_group, + TP_PROTO(const struct btrfs_block_group_cache *bg_cache), + + TP_ARGS(bg_cache), + + TP_STRUCT__entry_btrfs( + __field( u64, bytenr ) + __field( u64, len ) + __field( u64, used ) + __field( u64, flags ) + ), + + TP_fast_assign_btrfs(bg_cache->fs_info, + __entry->bytenr = bg_cache->key.objectid, + __entry->len = bg_cache->key.offset, + __entry->used = btrfs_block_group_used(&bg_cache->item); + __entry->flags = bg_cache->flags; + ), + + TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", + __entry->bytenr, __entry->len, __entry->used, __entry->flags, + __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) +); + +DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, + TP_PROTO(const struct btrfs_block_group_cache *bg_cache), + + TP_ARGS(bg_cache) +); + +DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, + TP_PROTO(const struct btrfs_block_group_cache *bg_cache), + + TP_ARGS(bg_cache) +); + +DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, + TP_PROTO(const struct btrfs_block_group_cache *bg_cache), + + TP_ARGS(bg_cache) +); + #endif /* _TRACE_BTRFS_H */ /* This part must be outside protection */ diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index c8d99b9ca550..5ca1d21fc4a7 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h @@ -422,6 +422,21 @@ struct btrfs_ioctl_ino_lookup_args { char name[BTRFS_INO_LOOKUP_PATH_MAX]; }; +#define BTRFS_INO_LOOKUP_USER_PATH_MAX (4080 - BTRFS_VOL_NAME_MAX - 1) +struct btrfs_ioctl_ino_lookup_user_args { + /* in, inode number containing the subvolume of 'subvolid' */ + __u64 dirid; + /* in */ + __u64 treeid; + /* out, name of the subvolume of 'treeid' */ + char name[BTRFS_VOL_NAME_MAX + 1]; + /* + * out, constructed path from the directory with which the ioctl is + * called to dirid + */ + char path[BTRFS_INO_LOOKUP_USER_PATH_MAX]; +}; + /* Search criteria for the btrfs SEARCH ioctl family. */ struct btrfs_ioctl_search_key { /* @@ -725,6 +740,82 @@ struct btrfs_ioctl_send_args { __u64 reserved[4]; /* in */ }; +/* + * Information about a fs tree root. + * + * All items are filled by the ioctl + */ +struct btrfs_ioctl_get_subvol_info_args { + /* Id of this subvolume */ + __u64 treeid; + + /* Name of this subvolume, used to get the real name at mount point */ + char name[BTRFS_VOL_NAME_MAX + 1]; + + /* + * Id of the subvolume which contains this subvolume. + * Zero for top-level subvolume or a deleted subvolume. + */ + __u64 parent_id; + + /* + * Inode number of the directory which contains this subvolume. + * Zero for top-level subvolume or a deleted subvolume + */ + __u64 dirid; + + /* Latest transaction id of this subvolume */ + __u64 generation; + + /* Flags of this subvolume */ + __u64 flags; + + /* UUID of this subvolume */ + __u8 uuid[BTRFS_UUID_SIZE]; + + /* + * UUID of the subvolume of which this subvolume is a snapshot. + * All zero for a non-snapshot subvolume. + */ + __u8 parent_uuid[BTRFS_UUID_SIZE]; + + /* + * UUID of the subvolume from which this subvolume was received. + * All zero for non-received subvolume. + */ + __u8 received_uuid[BTRFS_UUID_SIZE]; + + /* Transaction id indicating when change/create/send/receive happened */ + __u64 ctransid; + __u64 otransid; + __u64 stransid; + __u64 rtransid; + /* Time corresponding to c/o/s/rtransid */ + struct btrfs_ioctl_timespec ctime; + struct btrfs_ioctl_timespec otime; + struct btrfs_ioctl_timespec stime; + struct btrfs_ioctl_timespec rtime; + + /* Must be zero */ + __u64 reserved[8]; +}; + +#define BTRFS_MAX_ROOTREF_BUFFER_NUM 255 +struct btrfs_ioctl_get_subvol_rootref_args { + /* in/out, minimum id of rootref's treeid to be searched */ + __u64 min_treeid; + + /* out */ + struct { + __u64 treeid; + __u64 dirid; + } rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM]; + + /* out, number of found items */ + __u8 num_items; + __u8 align[7]; +}; + /* Error codes as returned by the kernel */ enum btrfs_err_code { BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1, @@ -843,5 +934,11 @@ enum btrfs_err_code { struct btrfs_ioctl_vol_args_v2) #define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \ struct btrfs_ioctl_logical_ino_args) +#define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, \ + struct btrfs_ioctl_get_subvol_info_args) +#define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, \ + struct btrfs_ioctl_get_subvol_rootref_args) +#define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, \ + struct btrfs_ioctl_ino_lookup_user_args) #endif /* _UAPI_LINUX_BTRFS_H */ |