Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
"Almost all of these are bug fixes. Dave Sterba's documentation update
is the big exception because he removed our promises to set any
machine running Btrfs on fire"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Documentation: filesystems: update btrfs tools section
Documentation: filesystems: add new btrfs mount options
btrfs: update kconfig help text
btrfs: fix bio_size_ok() for max_sectors > 0xffff
btrfs: Use trace condition for get_extent tracepoint
btrfs: fix typo in the log message
Btrfs: fix list delete warning when removing ordered root from the list
Btrfs: print bytenr instead of page pointer in check-int
Btrfs: remove dead codes from ctree.h
Btrfs: don't wait for ordered data outside desired range
Btrfs: fix lockdep error in async commit
Btrfs: avoid heavy operations in btrfs_commit_super
Btrfs: fix __btrfs_start_workers retval
Btrfs: disable online raid-repair on ro mounts
Btrfs: do not inc uncorrectable_errors counter on ro scrubs
Btrfs: only drop modified extents if we logged the whole inode
Btrfs: make sure to copy everything if we rename
Btrfs: don't BUG_ON() if we get an error walking backrefs

+73 -72
+17 -17
Documentation/filesystems/btrfs.txt
··· 70 70 71 71 See comments at the top of fs/btrfs/check-integrity.c for more info. 72 72 73 + commit=<seconds> 74 + Set the interval of periodic commit, 30 seconds by default. Higher 75 + values defer data being synced to permanent storage with obvious 76 + consequences when the system crashes. The upper bound is not forced, 77 + but a warning is printed if it's more than 300 seconds (5 minutes). 78 + 73 79 compress 74 80 compress=<type> 75 81 compress-force ··· 160 154 Currently this scans a list of several previous tree roots and tries to 161 155 use the first readable. 162 156 163 - skip_balance 157 + rescan_uuid_tree 158 + Force check and rebuild procedure of the UUID tree. This should not 159 + normally be needed. 160 + 161 + skip_balance 164 162 Skip automatic resume of interrupted balance operation after mount. 165 163 May be resumed with "btrfs balance resume." 166 164 ··· 244 234 245 235 These include the following tools: 246 236 247 - mkfs.btrfs: create a filesystem 237 + * mkfs.btrfs: create a filesystem 248 238 249 - btrfsctl: control program to create snapshots and subvolumes: 239 + * btrfs: a single tool to manage the filesystems, refer to the manpage for more details 250 240 251 - mount /dev/sda2 /mnt 252 - btrfsctl -s new_subvol_name /mnt 253 - btrfsctl -s snapshot_of_default /mnt/default 254 - btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name 255 - btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol 256 - ls /mnt 257 - default snapshot_of_a_snapshot snapshot_of_new_subvol 258 - new_subvol_name snapshot_of_default 241 + * 'btrfsck' or 'btrfs check': do a consistency check of the filesystem 259 242 260 - Snapshots and subvolumes cannot be deleted right now, but you can 261 - rm -rf all the files and directories inside them. 243 + Other tools for specific tasks: 262 244 263 - btrfsck: do a limited check of the FS extent trees. 245 + * btrfs-convert: in-place conversion from ext2/3/4 filesystems 264 246 265 - btrfs-debug-tree: print all of the FS metadata in text form. Example: 266 - 267 - btrfs-debug-tree /dev/sda2 >& big_output_file 247 + * btrfs-image: dump filesystem metadata for debugging
+10 -5
fs/btrfs/Kconfig
··· 9 9 select XOR_BLOCKS 10 10 11 11 help 12 - Btrfs is a new filesystem with extents, writable snapshotting, 13 - support for multiple devices and many more features. 12 + Btrfs is a general purpose copy-on-write filesystem with extents, 13 + writable snapshotting, support for multiple devices and many more 14 + features focused on fault tolerance, repair and easy administration. 14 15 15 - Btrfs is highly experimental, and THE DISK FORMAT IS NOT YET 16 - FINALIZED. You should say N here unless you are interested in 17 - testing Btrfs with non-critical data. 16 + The filesystem disk format is no longer unstable, and it's not 17 + expected to change unless there are strong reasons to do so. If there 18 + is a format change, file systems with a unchanged format will 19 + continue to be mountable and usable by newer kernels. 20 + 21 + For more information, please see the web pages at 22 + http://btrfs.wiki.kernel.org. 18 23 19 24 To compile this file system support as a module, choose M here. The 20 25 module will be called btrfs.
+1
fs/btrfs/async-thread.c
··· 495 495 spin_lock_irq(&workers->lock); 496 496 if (workers->stopping) { 497 497 spin_unlock_irq(&workers->lock); 498 + ret = -EINVAL; 498 499 goto fail_kthread; 499 500 } 500 501 list_add_tail(&worker->worker_list, &workers->idle_list);
+17 -8
fs/btrfs/check-integrity.c
··· 77 77 * the integrity of (super)-block write requests, do not 78 78 * enable the config option BTRFS_FS_CHECK_INTEGRITY to 79 79 * include and compile the integrity check tool. 80 + * 81 + * Expect millions of lines of information in the kernel log with an 82 + * enabled check_int_print_mask. Therefore set LOG_BUF_SHIFT in the 83 + * kernel config to at least 26 (which is 64MB). Usually the value is 84 + * limited to 21 (which is 2MB) in init/Kconfig. The file needs to be 85 + * changed like this before LOG_BUF_SHIFT can be set to a high value: 86 + * config LOG_BUF_SHIFT 87 + * int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" 88 + * range 12 30 80 89 */ 81 90 82 91 #include <linux/sched.h> ··· 133 124 #define BTRFSIC_PRINT_MASK_INITIAL_DATABASE 0x00000400 134 125 #define BTRFSIC_PRINT_MASK_NUM_COPIES 0x00000800 135 126 #define BTRFSIC_PRINT_MASK_TREE_WITH_ALL_MIRRORS 0x00001000 127 + #define BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH_VERBOSE 0x00002000 136 128 137 129 struct btrfsic_dev_state; 138 130 struct btrfsic_state; ··· 3025 3015 (rw & WRITE) && NULL != bio->bi_io_vec) { 3026 3016 unsigned int i; 3027 3017 u64 dev_bytenr; 3018 + u64 cur_bytenr; 3028 3019 int bio_is_patched; 3029 3020 char **mapped_datav; 3030 3021 ··· 3044 3033 GFP_NOFS); 3045 3034 if (!mapped_datav) 3046 3035 goto leave; 3036 + cur_bytenr = dev_bytenr; 3047 3037 for (i = 0; i < bio->bi_vcnt; i++) { 3048 3038 BUG_ON(bio->bi_io_vec[i].bv_len != PAGE_CACHE_SIZE); 3049 3039 mapped_datav[i] = kmap(bio->bi_io_vec[i].bv_page); ··· 3056 3044 kfree(mapped_datav); 3057 3045 goto leave; 3058 3046 } 3059 - if ((BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | 3060 - BTRFSIC_PRINT_MASK_VERBOSE) == 3061 - (dev_state->state->print_mask & 3062 - (BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH | 3063 - BTRFSIC_PRINT_MASK_VERBOSE))) 3047 + if (dev_state->state->print_mask & 3048 + BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH_VERBOSE) 3064 3049 printk(KERN_INFO 3065 - "#%u: page=%p, len=%u, offset=%u\n", 3066 - i, bio->bi_io_vec[i].bv_page, 3067 - bio->bi_io_vec[i].bv_len, 3050 + "#%u: bytenr=%llu, len=%u, offset=%u\n", 3051 + i, cur_bytenr, bio->bi_io_vec[i].bv_len, 3068 3052 bio->bi_io_vec[i].bv_offset); 3053 + cur_bytenr += bio->bi_io_vec[i].bv_len; 3069 3054 } 3070 3055 btrfsic_process_written_block(dev_state, dev_bytenr, 3071 3056 mapped_datav, bio->bi_vcnt,
-6
fs/btrfs/ctree.h
··· 3613 3613 struct btrfs_ordered_sum *sums); 3614 3614 int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, 3615 3615 struct bio *bio, u64 file_start, int contig); 3616 - int btrfs_csum_truncate(struct btrfs_trans_handle *trans, 3617 - struct btrfs_root *root, struct btrfs_path *path, 3618 - u64 isize); 3619 3616 int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, 3620 3617 struct list_head *list, int search_commit); 3621 3618 /* inode.c */ ··· 3741 3744 int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync); 3742 3745 void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, 3743 3746 int skip_pinned); 3744 - int btrfs_replace_extent_cache(struct inode *inode, struct extent_map *replace, 3745 - u64 start, u64 end, int skip_pinned, 3746 - int modified); 3747 3747 extern const struct file_operations btrfs_file_operations; 3748 3748 int __btrfs_drop_extents(struct btrfs_trans_handle *trans, 3749 3749 struct btrfs_root *root, struct inode *inode,
+1 -1
fs/btrfs/dev-replace.c
··· 366 366 dev_replace->tgtdev = tgt_device; 367 367 368 368 printk_in_rcu(KERN_INFO 369 - "btrfs: dev_replace from %s (devid %llu) to %s) started\n", 369 + "btrfs: dev_replace from %s (devid %llu) to %s started\n", 370 370 src_device->missing ? "<missing disk>" : 371 371 rcu_str_deref(src_device->name), 372 372 src_device->devid,
+1 -20
fs/btrfs/disk-io.c
··· 3517 3517 int btrfs_commit_super(struct btrfs_root *root) 3518 3518 { 3519 3519 struct btrfs_trans_handle *trans; 3520 - int ret; 3521 3520 3522 3521 mutex_lock(&root->fs_info->cleaner_mutex); 3523 3522 btrfs_run_delayed_iputs(root); ··· 3530 3531 trans = btrfs_join_transaction(root); 3531 3532 if (IS_ERR(trans)) 3532 3533 return PTR_ERR(trans); 3533 - ret = btrfs_commit_transaction(trans, root); 3534 - if (ret) 3535 - return ret; 3536 - /* run commit again to drop the original snapshot */ 3537 - trans = btrfs_join_transaction(root); 3538 - if (IS_ERR(trans)) 3539 - return PTR_ERR(trans); 3540 - ret = btrfs_commit_transaction(trans, root); 3541 - if (ret) 3542 - return ret; 3543 - ret = btrfs_write_and_wait_transaction(NULL, root); 3544 - if (ret) { 3545 - btrfs_error(root->fs_info, ret, 3546 - "Failed to sync btree inode to disk."); 3547 - return ret; 3548 - } 3549 - 3550 - ret = write_ctree_super(NULL, root, 0); 3551 - return ret; 3534 + return btrfs_commit_transaction(trans, root); 3552 3535 } 3553 3536 3554 3537 int close_ctree(struct btrfs_root *root)
+8 -3
fs/btrfs/extent_io.c
··· 1980 1980 struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; 1981 1981 int ret; 1982 1982 1983 + ASSERT(!(fs_info->sb->s_flags & MS_RDONLY)); 1983 1984 BUG_ON(!mirror_num); 1984 1985 1985 1986 /* we can't repair anything in raid56 yet */ ··· 2037 2036 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); 2038 2037 int ret = 0; 2039 2038 2039 + if (root->fs_info->sb->s_flags & MS_RDONLY) 2040 + return -EROFS; 2041 + 2040 2042 for (i = 0; i < num_pages; i++) { 2041 2043 struct page *p = extent_buffer_page(eb, i); 2042 2044 ret = repair_io_failure(root->fs_info, start, PAGE_CACHE_SIZE, ··· 2061 2057 u64 private; 2062 2058 u64 private_failure; 2063 2059 struct io_failure_record *failrec; 2064 - struct btrfs_fs_info *fs_info; 2060 + struct inode *inode = page->mapping->host; 2061 + struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; 2065 2062 struct extent_state *state; 2066 2063 int num_copies; 2067 2064 int did_repair = 0; 2068 2065 int ret; 2069 - struct inode *inode = page->mapping->host; 2070 2066 2071 2067 private = 0; 2072 2068 ret = count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, ··· 2089 2085 did_repair = 1; 2090 2086 goto out; 2091 2087 } 2088 + if (fs_info->sb->s_flags & MS_RDONLY) 2089 + goto out; 2092 2090 2093 2091 spin_lock(&BTRFS_I(inode)->io_tree.lock); 2094 2092 state = find_first_extent_bit_state(&BTRFS_I(inode)->io_tree, ··· 2100 2094 2101 2095 if (state && state->start <= failrec->start && 2102 2096 state->end >= failrec->start + failrec->len - 1) { 2103 - fs_info = BTRFS_I(inode)->root->fs_info; 2104 2097 num_copies = btrfs_num_copies(fs_info, failrec->logical, 2105 2098 failrec->len); 2106 2099 if (num_copies > 1) {
+3 -3
fs/btrfs/inode.c
··· 2129 2129 old->extent_offset, fs_info, 2130 2130 path, record_one_backref, 2131 2131 old); 2132 - BUG_ON(ret < 0 && ret != -ENOENT); 2132 + if (ret < 0 && ret != -ENOENT) 2133 + return false; 2133 2134 2134 2135 /* no backref to be processed for this extent */ 2135 2136 if (!old->count) { ··· 6187 6186 write_unlock(&em_tree->lock); 6188 6187 out: 6189 6188 6190 - if (em) 6191 - trace_btrfs_get_extent(root, em); 6189 + trace_btrfs_get_extent(root, em); 6192 6190 6193 6191 if (path) 6194 6192 btrfs_free_path(path);
+2 -1
fs/btrfs/ordered-data.c
··· 638 638 WARN_ON(nr < 0); 639 639 } 640 640 } 641 + list_splice_tail(&splice, &fs_info->ordered_roots); 641 642 spin_unlock(&fs_info->ordered_root_lock); 642 643 } 643 644 ··· 804 803 btrfs_put_ordered_extent(ordered); 805 804 break; 806 805 } 807 - if (ordered->file_offset + ordered->len < start) { 806 + if (ordered->file_offset + ordered->len <= start) { 808 807 btrfs_put_ordered_extent(ordered); 809 808 break; 810 809 }
+4 -2
fs/btrfs/scrub.c
··· 938 938 BTRFS_DEV_STAT_CORRUPTION_ERRS); 939 939 } 940 940 941 - if (sctx->readonly && !sctx->is_dev_replace) 942 - goto did_not_correct_error; 941 + if (sctx->readonly) { 942 + ASSERT(!sctx->is_dev_replace); 943 + goto out; 944 + } 943 945 944 946 if (!is_metadata && !have_csum) { 945 947 struct scrub_fixup_nodatasum *fixup_nodatasum;
+2 -2
fs/btrfs/transaction.c
··· 1480 1480 * We've got freeze protection passed with the transaction. 1481 1481 * Tell lockdep about it. 1482 1482 */ 1483 - if (ac->newtrans->type < TRANS_JOIN_NOLOCK) 1483 + if (ac->newtrans->type & __TRANS_FREEZABLE) 1484 1484 rwsem_acquire_read( 1485 1485 &ac->root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1], 1486 1486 0, 1, _THIS_IP_); ··· 1521 1521 * Tell lockdep we've released the freeze rwsem, since the 1522 1522 * async commit thread will be the one to unlock it. 1523 1523 */ 1524 - if (trans->type < TRANS_JOIN_NOLOCK) 1524 + if (ac->newtrans->type & __TRANS_FREEZABLE) 1525 1525 rwsem_release( 1526 1526 &root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1], 1527 1527 1, _THIS_IP_);
+3 -2
fs/btrfs/tree-log.c
··· 3697 3697 ret = btrfs_truncate_inode_items(trans, log, 3698 3698 inode, 0, 0); 3699 3699 } else if (test_and_clear_bit(BTRFS_INODE_COPY_EVERYTHING, 3700 - &BTRFS_I(inode)->runtime_flags)) { 3700 + &BTRFS_I(inode)->runtime_flags) || 3701 + inode_only == LOG_INODE_EXISTS) { 3701 3702 if (inode_only == LOG_INODE_ALL) 3702 3703 fast_search = true; 3703 3704 max_key.type = BTRFS_XATTR_ITEM_KEY; ··· 3802 3801 err = ret; 3803 3802 goto out_unlock; 3804 3803 } 3805 - } else { 3804 + } else if (inode_only == LOG_INODE_ALL) { 3806 3805 struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree; 3807 3806 struct extent_map *em, *n; 3808 3807
+1 -1
fs/btrfs/volumes.c
··· 5394 5394 { 5395 5395 struct bio_vec *prev; 5396 5396 struct request_queue *q = bdev_get_queue(bdev); 5397 - unsigned short max_sectors = queue_max_sectors(q); 5397 + unsigned int max_sectors = queue_max_sectors(q); 5398 5398 struct bvec_merge_data bvm = { 5399 5399 .bi_bdev = bdev, 5400 5400 .bi_sector = sector,
+3 -1
include/trace/events/btrfs.h
··· 162 162 { EXTENT_FLAG_LOGGING, "LOGGING" }, \ 163 163 { EXTENT_FLAG_FILLING, "FILLING" }) 164 164 165 - TRACE_EVENT(btrfs_get_extent, 165 + TRACE_EVENT_CONDITION(btrfs_get_extent, 166 166 167 167 TP_PROTO(struct btrfs_root *root, struct extent_map *map), 168 168 169 169 TP_ARGS(root, map), 170 + 171 + TP_CONDITION(map), 170 172 171 173 TP_STRUCT__entry( 172 174 __field( u64, root_objectid )