~ubuntu-branches/debian/jessie/btrfs-tools/jessie

« back to all changes in this revision

Viewing changes to cmds-check.c

  • Committer: Package Import Robot
  • Author(s): Dimitri John Ledkov
  • Date: 2014-10-11 16:54:05 UTC
  • mfrom: (1.2.14) (6.1.39 sid)
  • Revision ID: package-import@ubuntu.com-20141011165405-zvdemnhzw41f2doj
Tags: 3.16.2-1
* New upstream release.
* Drop patches (not needed, or upstremed), but unaligned memory access.
* Update upstream location in uscan, to pull release by kdave.
* Use upstream fsck.btrfs script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
243
243
 
244
244
static void reset_cached_block_groups(struct btrfs_fs_info *fs_info);
245
245
 
 
246
static void record_root_in_trans(struct btrfs_trans_handle *trans,
 
247
                                 struct btrfs_root *root)
 
248
{
 
249
        if (root->last_trans != trans->transid) {
 
250
                root->track_dirty = 1;
 
251
                root->last_trans = trans->transid;
 
252
                root->commit_root = root->node;
 
253
                extent_buffer_get(root->node);
 
254
        }
 
255
}
 
256
 
246
257
static u8 imode_to_type(u32 imode)
247
258
{
248
259
#define S_SHIFT 12
1287
1298
        u32 nritems;
1288
1299
        u32 blocksize;
1289
1300
        int i;
1290
 
        int ret;
1291
1301
        int level;
1292
1302
 
1293
1303
        level = btrfs_header_level(node);
1299
1309
        for (i = slot; i < nritems; i++) {
1300
1310
                bytenr = btrfs_node_blockptr(node, i);
1301
1311
                ptr_gen = btrfs_node_ptr_generation(node, i);
1302
 
                ret = readahead_tree_block(root, bytenr, blocksize, ptr_gen);
1303
 
                if (ret)
1304
 
                        break;
 
1312
                readahead_tree_block(root, bytenr, blocksize, ptr_gen);
1305
1313
        }
1306
1314
}
1307
1315
 
2432
2440
        if (IS_ERR(root))
2433
2441
                return -EIO;
2434
2442
 
 
2443
        record_root_in_trans(trans, root);
 
2444
 
2435
2445
        path = btrfs_alloc_path();
2436
2446
        if (!path)
2437
2447
                return -EIO;
3857
3867
        unsigned long leaf_offset;
3858
3868
 
3859
3869
        root = root->fs_info->csum_root;
 
3870
        if (!extent_buffer_uptodate(root->node)) {
 
3871
                fprintf(stderr, "No valid csum tree found\n");
 
3872
                return -ENOENT;
 
3873
        }
3860
3874
 
3861
3875
        key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
3862
3876
        key.type = BTRFS_EXTENT_CSUM_KEY;
4670
4684
         * Have to make sure that this root gets updated when we commit the
4671
4685
         * transaction
4672
4686
         */
4673
 
        root->track_dirty = 1;
4674
 
        if (root->last_trans != trans->transid) {
4675
 
                root->last_trans = trans->transid;
4676
 
                root->commit_root = root->node;
4677
 
                extent_buffer_get(root->node);
4678
 
        }
 
4687
        record_root_in_trans(trans, root);
4679
4688
 
4680
4689
        /*
4681
4690
         * Ok we have the key of the file extent we want to fix, now we can cow
6355
6364
                fprintf(stderr, "Error reading data reloc tree\n");
6356
6365
                return PTR_ERR(root);
6357
6366
        }
6358
 
        root->track_dirty = 1;
6359
 
        if (root->last_trans != trans->transid) {
6360
 
                root->last_trans = trans->transid;
6361
 
                root->commit_root = root->node;
6362
 
                extent_buffer_get(root->node);
6363
 
        }
 
6367
        record_root_in_trans(trans, root);
6364
6368
        ret = btrfs_fsck_reinit_root(trans, root, 0);
6365
6369
        if (ret)
6366
6370
                goto out;