print-tree.c (c1362fd0f2fdebf5c56d505100ba37600b5c20a5) | print-tree.c (6c75a589cb35b8ea5cf9a22f389981acf687ab85) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2007 Oracle. All rights reserved. 4 */ 5 6#include "messages.h" 7#include "ctree.h" 8#include "disk-io.h" --- 35 unchanged lines hidden (view full) --- 44 if (root_map[i].id == key->objectid) 45 return root_map[i].name; 46 } 47 48 snprintf(buf, BTRFS_ROOT_NAME_BUF_LEN, "%llu", key->objectid); 49 return buf; 50} 51 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2007 Oracle. All rights reserved. 4 */ 5 6#include "messages.h" 7#include "ctree.h" 8#include "disk-io.h" --- 35 unchanged lines hidden (view full) --- 44 if (root_map[i].id == key->objectid) 45 return root_map[i].name; 46 } 47 48 snprintf(buf, BTRFS_ROOT_NAME_BUF_LEN, "%llu", key->objectid); 49 return buf; 50} 51 |
52static void print_chunk(struct extent_buffer *eb, struct btrfs_chunk *chunk) | 52static void print_chunk(const struct extent_buffer *eb, struct btrfs_chunk *chunk) |
53{ 54 int num_stripes = btrfs_chunk_num_stripes(eb, chunk); 55 int i; 56 pr_info("\t\tchunk length %llu owner %llu type %llu num_stripes %d\n", 57 btrfs_chunk_length(eb, chunk), btrfs_chunk_owner(eb, chunk), 58 btrfs_chunk_type(eb, chunk), num_stripes); 59 for (i = 0 ; i < num_stripes ; i++) { 60 pr_info("\t\t\tstripe %d devid %llu offset %llu\n", i, 61 btrfs_stripe_devid_nr(eb, chunk, i), 62 btrfs_stripe_offset_nr(eb, chunk, i)); 63 } 64} | 53{ 54 int num_stripes = btrfs_chunk_num_stripes(eb, chunk); 55 int i; 56 pr_info("\t\tchunk length %llu owner %llu type %llu num_stripes %d\n", 57 btrfs_chunk_length(eb, chunk), btrfs_chunk_owner(eb, chunk), 58 btrfs_chunk_type(eb, chunk), num_stripes); 59 for (i = 0 ; i < num_stripes ; i++) { 60 pr_info("\t\t\tstripe %d devid %llu offset %llu\n", i, 61 btrfs_stripe_devid_nr(eb, chunk, i), 62 btrfs_stripe_offset_nr(eb, chunk, i)); 63 } 64} |
65static void print_dev_item(struct extent_buffer *eb, | 65static void print_dev_item(const struct extent_buffer *eb, |
66 struct btrfs_dev_item *dev_item) 67{ 68 pr_info("\t\tdev item devid %llu total_bytes %llu bytes used %llu\n", 69 btrfs_device_id(eb, dev_item), 70 btrfs_device_total_bytes(eb, dev_item), 71 btrfs_device_bytes_used(eb, dev_item)); 72} | 66 struct btrfs_dev_item *dev_item) 67{ 68 pr_info("\t\tdev item devid %llu total_bytes %llu bytes used %llu\n", 69 btrfs_device_id(eb, dev_item), 70 btrfs_device_total_bytes(eb, dev_item), 71 btrfs_device_bytes_used(eb, dev_item)); 72} |
73static void print_extent_data_ref(struct extent_buffer *eb, | 73static void print_extent_data_ref(const struct extent_buffer *eb, |
74 struct btrfs_extent_data_ref *ref) 75{ 76 pr_cont("extent data backref root %llu objectid %llu offset %llu count %u\n", 77 btrfs_extent_data_ref_root(eb, ref), 78 btrfs_extent_data_ref_objectid(eb, ref), 79 btrfs_extent_data_ref_offset(eb, ref), 80 btrfs_extent_data_ref_count(eb, ref)); 81} 82 | 74 struct btrfs_extent_data_ref *ref) 75{ 76 pr_cont("extent data backref root %llu objectid %llu offset %llu count %u\n", 77 btrfs_extent_data_ref_root(eb, ref), 78 btrfs_extent_data_ref_objectid(eb, ref), 79 btrfs_extent_data_ref_offset(eb, ref), 80 btrfs_extent_data_ref_count(eb, ref)); 81} 82 |
83static void print_extent_item(struct extent_buffer *eb, int slot, int type) | 83static void print_extent_item(const struct extent_buffer *eb, int slot, int type) |
84{ 85 struct btrfs_extent_item *ei; 86 struct btrfs_extent_inline_ref *iref; 87 struct btrfs_extent_data_ref *dref; 88 struct btrfs_shared_data_ref *sref; 89 struct btrfs_disk_key key; 90 unsigned long end; 91 unsigned long ptr; --- 72 unchanged lines hidden (view full) --- 164 eb->start, type); 165 return; 166 } 167 ptr += btrfs_extent_inline_ref_size(type); 168 } 169 WARN_ON(ptr > end); 170} 171 | 84{ 85 struct btrfs_extent_item *ei; 86 struct btrfs_extent_inline_ref *iref; 87 struct btrfs_extent_data_ref *dref; 88 struct btrfs_shared_data_ref *sref; 89 struct btrfs_disk_key key; 90 unsigned long end; 91 unsigned long ptr; --- 72 unchanged lines hidden (view full) --- 164 eb->start, type); 165 return; 166 } 167 ptr += btrfs_extent_inline_ref_size(type); 168 } 169 WARN_ON(ptr > end); 170} 171 |
172static void print_uuid_item(struct extent_buffer *l, unsigned long offset, | 172static void print_uuid_item(const struct extent_buffer *l, unsigned long offset, |
173 u32 item_size) 174{ 175 if (!IS_ALIGNED(item_size, sizeof(u64))) { 176 pr_warn("BTRFS: uuid item with illegal size %lu!\n", 177 (unsigned long)item_size); 178 return; 179 } 180 while (item_size) { --- 5 unchanged lines hidden (view full) --- 186 offset += sizeof(u64); 187 } 188} 189 190/* 191 * Helper to output refs and locking status of extent buffer. Useful to debug 192 * race condition related problems. 193 */ | 173 u32 item_size) 174{ 175 if (!IS_ALIGNED(item_size, sizeof(u64))) { 176 pr_warn("BTRFS: uuid item with illegal size %lu!\n", 177 (unsigned long)item_size); 178 return; 179 } 180 while (item_size) { --- 5 unchanged lines hidden (view full) --- 186 offset += sizeof(u64); 187 } 188} 189 190/* 191 * Helper to output refs and locking status of extent buffer. Useful to debug 192 * race condition related problems. 193 */ |
194static void print_eb_refs_lock(struct extent_buffer *eb) | 194static void print_eb_refs_lock(const struct extent_buffer *eb) |
195{ 196#ifdef CONFIG_BTRFS_DEBUG 197 btrfs_info(eb->fs_info, "refs %u lock_owner %u current %u", 198 atomic_read(&eb->refs), eb->lock_owner, current->pid); 199#endif 200} 201 | 195{ 196#ifdef CONFIG_BTRFS_DEBUG 197 btrfs_info(eb->fs_info, "refs %u lock_owner %u current %u", 198 atomic_read(&eb->refs), eb->lock_owner, current->pid); 199#endif 200} 201 |
202void btrfs_print_leaf(struct extent_buffer *l) | 202void btrfs_print_leaf(const struct extent_buffer *l) |
203{ 204 struct btrfs_fs_info *fs_info; 205 int i; 206 u32 type, nr; 207 struct btrfs_root_item *ri; 208 struct btrfs_dir_item *di; 209 struct btrfs_inode_item *ii; 210 struct btrfs_block_group_item *bi; --- 139 unchanged lines hidden (view full) --- 350 case BTRFS_UUID_KEY_RECEIVED_SUBVOL: 351 print_uuid_item(l, btrfs_item_ptr_offset(l, i), 352 btrfs_item_size(l, i)); 353 break; 354 } 355 } 356} 357 | 203{ 204 struct btrfs_fs_info *fs_info; 205 int i; 206 u32 type, nr; 207 struct btrfs_root_item *ri; 208 struct btrfs_dir_item *di; 209 struct btrfs_inode_item *ii; 210 struct btrfs_block_group_item *bi; --- 139 unchanged lines hidden (view full) --- 350 case BTRFS_UUID_KEY_RECEIVED_SUBVOL: 351 print_uuid_item(l, btrfs_item_ptr_offset(l, i), 352 btrfs_item_size(l, i)); 353 break; 354 } 355 } 356} 357 |
358void btrfs_print_tree(struct extent_buffer *c, bool follow) | 358void btrfs_print_tree(const struct extent_buffer *c, bool follow) |
359{ 360 struct btrfs_fs_info *fs_info; 361 int i; u32 nr; 362 struct btrfs_key key; 363 int level; 364 365 if (!c) 366 return; --- 50 unchanged lines hidden --- | 359{ 360 struct btrfs_fs_info *fs_info; 361 int i; u32 nr; 362 struct btrfs_key key; 363 int level; 364 365 if (!c) 366 return; --- 50 unchanged lines hidden --- |