~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to fs/btrfs/file-item.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
                        u32 item_size;
194
194
 
195
195
                        if (item)
196
 
                                btrfs_release_path(root, path);
 
196
                                btrfs_release_path(path);
197
197
                        item = btrfs_lookup_csum(NULL, root->fs_info->csum_root,
198
198
                                                 path, disk_bytenr, 0);
199
199
                        if (IS_ERR(item)) {
208
208
                                                EXTENT_NODATASUM, GFP_NOFS);
209
209
                                } else {
210
210
                                        printk(KERN_INFO "btrfs no csum found "
211
 
                                               "for inode %lu start %llu\n",
212
 
                                               inode->i_ino,
 
211
                                               "for inode %llu start %llu\n",
 
212
                                               (unsigned long long)
 
213
                                               btrfs_ino(inode),
213
214
                                               (unsigned long long)offset);
214
215
                                }
215
216
                                item = NULL;
216
 
                                btrfs_release_path(root, path);
 
217
                                btrfs_release_path(path);
217
218
                                goto found;
218
219
                        }
219
220
                        btrfs_item_key_to_cpu(path->nodes[0], &found_key,
266
267
}
267
268
 
268
269
int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
269
 
                             struct list_head *list)
 
270
                             struct list_head *list, int search_commit)
270
271
{
271
272
        struct btrfs_key key;
272
273
        struct btrfs_path *path;
283
284
        path = btrfs_alloc_path();
284
285
        BUG_ON(!path);
285
286
 
 
287
        if (search_commit) {
 
288
                path->skip_locking = 1;
 
289
                path->reada = 2;
 
290
                path->search_commit_root = 1;
 
291
        }
 
292
 
286
293
        key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
287
294
        key.offset = start;
288
295
        key.type = BTRFS_EXTENT_CSUM_KEY;
495
502
                u32 new_size = (bytenr - key->offset) >> blocksize_bits;
496
503
                new_size *= csum_size;
497
504
                ret = btrfs_truncate_item(trans, root, path, new_size, 1);
498
 
                BUG_ON(ret);
499
505
        } else if (key->offset >= bytenr && csum_end > end_byte &&
500
506
                   end_byte > key->offset) {
501
507
                /*
508
514
                new_size *= csum_size;
509
515
 
510
516
                ret = btrfs_truncate_item(trans, root, path, new_size, 0);
511
 
                BUG_ON(ret);
512
517
 
513
518
                key->offset = end_byte;
514
519
                ret = btrfs_set_item_key_safe(trans, root, path, key);
551
556
                ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
552
557
                if (ret > 0) {
553
558
                        if (path->slots[0] == 0)
554
 
                                goto out;
 
559
                                break;
555
560
                        path->slots[0]--;
556
561
                } else if (ret < 0) {
557
 
                        goto out;
 
562
                        break;
558
563
                }
559
564
 
560
565
                leaf = path->nodes[0];
579
584
                /* delete the entire item, it is inside our range */
580
585
                if (key.offset >= bytenr && csum_end <= end_byte) {
581
586
                        ret = btrfs_del_item(trans, root, path);
582
 
                        BUG_ON(ret);
 
587
                        if (ret)
 
588
                                goto out;
583
589
                        if (key.offset == bytenr)
584
590
                                break;
585
591
                } else if (key.offset < bytenr && csum_end > end_byte) {
631
637
                        if (key.offset < bytenr)
632
638
                                break;
633
639
                }
634
 
                btrfs_release_path(root, path);
 
640
                btrfs_release_path(path);
635
641
        }
 
642
        ret = 0;
636
643
out:
637
644
        btrfs_free_path(path);
638
 
        return 0;
 
645
        return ret;
639
646
}
640
647
 
641
648
int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
722
729
         * at this point, we know the tree has an item, but it isn't big
723
730
         * enough yet to put our csum in.  Grow it
724
731
         */
725
 
        btrfs_release_path(root, path);
 
732
        btrfs_release_path(path);
726
733
        ret = btrfs_search_slot(trans, root, &file_key, path,
727
734
                                csum_size, 1);
728
735
        if (ret < 0)
761
768
                        goto insert;
762
769
 
763
770
                ret = btrfs_extend_item(trans, root, path, diff);
764
 
                BUG_ON(ret);
765
771
                goto csum;
766
772
        }
767
773
 
768
774
insert:
769
 
        btrfs_release_path(root, path);
 
775
        btrfs_release_path(path);
770
776
        csum_offset = 0;
771
777
        if (found_next) {
772
778
                u64 tmp = total_bytes + root->sectorsize;
850
856
        }
851
857
        btrfs_mark_buffer_dirty(path->nodes[0]);
852
858
        if (total_bytes < sums->len) {
853
 
                btrfs_release_path(root, path);
 
859
                btrfs_release_path(path);
854
860
                cond_resched();
855
861
                goto again;
856
862
        }