~ubuntu-branches/ubuntu/maverick/btrfs-tools/maverick

« back to all changes in this revision

Viewing changes to debug-tree.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2010-06-01 07:27:38 UTC
  • mfrom: (1.1.7 upstream) (2.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20100601072738-4ng36v0xufr9xzjp
Tags: 0.19+20100601-1
* Updating patch to fix FTBFS on alpha and ia64, thanks to Alexander
  Kurtz <kurtz.alex@googlemail.com> (Closes: #583768).
* Renumbering patches.
* Merging upstream version 0.19+20100601 (Closes: #583793).
* Removing upstream patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        int ret;
117
117
        int slot;
118
118
        int extent_only = 0;
 
119
        u64 block_only = 0;
119
120
        struct btrfs_root *tree_root_scan;
120
121
 
121
122
        radix_tree_init();
122
123
 
123
124
        while(1) {
124
125
                int c;
125
 
                c = getopt(ac, av, "e");
 
126
                c = getopt(ac, av, "eb:");
126
127
                if (c < 0)
127
128
                        break;
128
129
                switch(c) {
129
130
                        case 'e':
130
131
                                extent_only = 1;
131
132
                                break;
 
133
                        case 'b':
 
134
                                block_only = atoll(optarg);
 
135
                                break;
132
136
                        default:
133
137
                                print_usage();
134
138
                }
142
146
                fprintf(stderr, "unable to open %s\n", av[optind]);
143
147
                exit(1);
144
148
        }
 
149
        if (block_only) {
 
150
                leaf = read_tree_block(root,
 
151
                                      block_only,
 
152
                                      root->leafsize, 0);
 
153
 
 
154
                if (leaf && btrfs_header_level(leaf) != 0) {
 
155
                        free_extent_buffer(leaf);
 
156
                        leaf = NULL;
 
157
                }
 
158
 
 
159
                if (!leaf) {
 
160
                        leaf = read_tree_block(root,
 
161
                                              block_only,
 
162
                                              root->nodesize, 0);
 
163
                }
 
164
                if (!leaf) {
 
165
                        fprintf(stderr, "failed to read %llu\n", block_only);
 
166
                        return 0;
 
167
                }
 
168
                btrfs_print_tree(root, leaf, 0);
 
169
                return 0;
 
170
        }
 
171
 
145
172
        if (!extent_only) {
146
173
                printf("root tree\n");
147
174
                btrfs_print_tree(root->fs_info->tree_root,
148
 
                                 root->fs_info->tree_root->node);
 
175
                                 root->fs_info->tree_root->node, 1);
149
176
 
150
177
                printf("chunk tree\n");
151
178
                btrfs_print_tree(root->fs_info->chunk_root,
152
 
                                 root->fs_info->chunk_root->node);
 
179
                                 root->fs_info->chunk_root->node, 1);
153
180
        }
154
181
        tree_root_scan = root->fs_info->tree_root;
155
182
 
260
287
                                printf(" tree ");
261
288
                                btrfs_print_key(&disk_key);
262
289
                                printf(" \n");
263
 
                                btrfs_print_tree(tree_root_scan, buf);
 
290
                                btrfs_print_tree(tree_root_scan, buf, 1);
264
291
                        } else if (extent_only && !skip) {
265
292
                                print_extents(tree_root_scan, buf);
266
293
                        }