diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 10:49:20 +0900 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 10:49:20 +0900 | 
| commit | 72055425e53540d9d0e59a57ac8c9b8ce77b62d5 (patch) | |
| tree | 8033d7d7bfdf8725eed785d02f7121d201052d2e /fs/btrfs/volumes.c | |
| parent | fc81c038c2d61d4fcd8150f383fec1ce23087597 (diff) | |
| parent | f46dbe3dee853f8a860f889cb2b7ff4c624f2a7a (diff) | |
| download | olio-linux-3.10-72055425e53540d9d0e59a57ac8c9b8ce77b62d5.tar.xz olio-linux-3.10-72055425e53540d9d0e59a57ac8c9b8ce77b62d5.zip  | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs update from Chris Mason:
 "This is a large pull, with the bulk of the updates coming from:
   - Hole punching
   - send/receive fixes
   - fsync performance
   - Disk format extension allowing more hardlinks inside a single
     directory (btrfs-progs patch required to enable the compat bit for
     this one)
  I'm cooking more unrelated RAID code, but I wanted to make sure this
  original batch makes it in.  The largest updates here are relatively
  old and have been in testing for some time."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (121 commits)
  btrfs: init ref_index to zero in add_inode_ref
  Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer
  Btrfs: fix page leakage
  Btrfs: do not warn_on when we cannot alloc a page for an extent buffer
  Btrfs: don't bug on enomem in readpage
  Btrfs: cleanup pages properly when ENOMEM in compression
  Btrfs: make filesystem read-only when submitting barrier fails
  Btrfs: detect corrupted filesystem after write I/O errors
  Btrfs: make compress and nodatacow mount options mutually exclusive
  btrfs: fix message printing
  Btrfs: don't bother committing delayed inode updates when fsyncing
  btrfs: move inline function code to header file
  Btrfs: remove unnecessary IS_ERR in bio_readpage_error()
  btrfs: remove unused function btrfs_insert_some_items()
  Btrfs: don't commit instead of overcommitting
  Btrfs: confirmation of value is added before trace_btrfs_get_extent() is called
  Btrfs: be smarter about dropping things from the tree log
  Btrfs: don't lookup csums for prealloc extents
  Btrfs: cache extent state when writing out dirty metadata pages
  Btrfs: do not hold the file extent leaf locked when adding extent item
  ...
Diffstat (limited to 'fs/btrfs/volumes.c')
| -rw-r--r-- | fs/btrfs/volumes.c | 73 | 
1 files changed, 56 insertions, 17 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 88b969aeeb7..029b903a4ae 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -639,7 +639,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,  		bdev = blkdev_get_by_path(device->name->str, flags, holder);  		if (IS_ERR(bdev)) { -			printk(KERN_INFO "open %s failed\n", device->name->str); +			printk(KERN_INFO "btrfs: open %s failed\n", device->name->str);  			goto error;  		}  		filemap_write_and_wait(bdev->bd_inode->i_mapping); @@ -1475,6 +1475,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)  		free_fs_devices(cur_devices);  	} +	root->fs_info->num_tolerated_disk_barrier_failures = +		btrfs_calc_num_tolerated_disk_barrier_failures(root->fs_info); +  	/*  	 * at this point, the device is zero sized.  We want to  	 * remove it from the devices list and zero out the old super @@ -1775,15 +1778,21 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)  	if (seeding_dev) {  		ret = init_first_rw_device(trans, root, device); -		if (ret) +		if (ret) { +			btrfs_abort_transaction(trans, root, ret);  			goto error_trans; +		}  		ret = btrfs_finish_sprout(trans, root); -		if (ret) +		if (ret) { +			btrfs_abort_transaction(trans, root, ret);  			goto error_trans; +		}  	} else {  		ret = btrfs_add_device(trans, root, device); -		if (ret) +		if (ret) { +			btrfs_abort_transaction(trans, root, ret);  			goto error_trans; +		}  	}  	/* @@ -1793,6 +1802,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)  	btrfs_clear_space_info_full(root->fs_info);  	unlock_chunks(root); +	root->fs_info->num_tolerated_disk_barrier_failures = +		btrfs_calc_num_tolerated_disk_barrier_failures(root->fs_info);  	ret = btrfs_commit_transaction(trans, root);  	if (seeding_dev) { @@ -1814,7 +1825,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)  error_trans:  	unlock_chunks(root); -	btrfs_abort_transaction(trans, root, ret);  	btrfs_end_transaction(trans, root);  	rcu_string_free(device->name);  	kfree(device); @@ -2804,6 +2814,26 @@ int btrfs_balance(struct btrfs_balance_control *bctl,  		}  	} +	if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) { +		int num_tolerated_disk_barrier_failures; +		u64 target = bctl->sys.target; + +		num_tolerated_disk_barrier_failures = +			btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); +		if (num_tolerated_disk_barrier_failures > 0 && +		    (target & +		     (BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID0 | +		      BTRFS_AVAIL_ALLOC_BIT_SINGLE))) +			num_tolerated_disk_barrier_failures = 0; +		else if (num_tolerated_disk_barrier_failures > 1 && +			 (target & +			  (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID10))) +			num_tolerated_disk_barrier_failures = 1; + +		fs_info->num_tolerated_disk_barrier_failures = +			num_tolerated_disk_barrier_failures; +	} +  	ret = insert_balance_item(fs_info->tree_root, bctl);  	if (ret && ret != -EEXIST)  		goto out; @@ -2836,6 +2866,11 @@ int btrfs_balance(struct btrfs_balance_control *bctl,  		__cancel_balance(fs_info);  	} +	if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) { +		fs_info->num_tolerated_disk_barrier_failures = +			btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); +	} +  	wake_up(&fs_info->balance_wait_q);  	return ret; @@ -3608,12 +3643,16 @@ static noinline int init_first_rw_device(struct btrfs_trans_handle *trans,  	ret = __btrfs_alloc_chunk(trans, extent_root, &sys_map,  				  &sys_chunk_size, &sys_stripe_size,  				  sys_chunk_offset, alloc_profile); -	if (ret) -		goto abort; +	if (ret) { +		btrfs_abort_transaction(trans, root, ret); +		goto out; +	}  	ret = btrfs_add_device(trans, fs_info->chunk_root, device); -	if (ret) -		goto abort; +	if (ret) { +		btrfs_abort_transaction(trans, root, ret); +		goto out; +	}  	/*  	 * Modifying chunk tree needs allocating new blocks from both @@ -3623,19 +3662,19 @@ static noinline int init_first_rw_device(struct btrfs_trans_handle *trans,  	 */  	ret = __finish_chunk_alloc(trans, extent_root, map, chunk_offset,  				   chunk_size, stripe_size); -	if (ret) -		goto abort; +	if (ret) { +		btrfs_abort_transaction(trans, root, ret); +		goto out; +	}  	ret = __finish_chunk_alloc(trans, extent_root, sys_map,  				   sys_chunk_offset, sys_chunk_size,  				   sys_stripe_size);  	if (ret) -		goto abort; +		btrfs_abort_transaction(trans, root, ret); -	return 0; +out: -abort: -	btrfs_abort_transaction(trans, root, ret);  	return ret;  } @@ -3760,7 +3799,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,  	read_unlock(&em_tree->lock);  	if (!em) { -		printk(KERN_CRIT "unable to find logical %llu len %llu\n", +		printk(KERN_CRIT "btrfs: unable to find logical %llu len %llu\n",  		       (unsigned long long)logical,  		       (unsigned long long)*length);  		BUG(); @@ -4217,7 +4256,7 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,  	total_devs = bbio->num_stripes;  	if (map_length < length) { -		printk(KERN_CRIT "mapping failed logical %llu bio len %llu " +		printk(KERN_CRIT "btrfs: mapping failed logical %llu bio len %llu "  		       "len %llu\n", (unsigned long long)logical,  		       (unsigned long long)length,  		       (unsigned long long)map_length);  |