diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-22 17:58:49 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-22 17:58:49 -0400 |
| commit | 0fbf2cc983ca15208545010863c6536d36a25f3a (patch) | |
| tree | 19a6b5d197d9051c6775c69cb1731f7563ee35ca | |
| parent | c43a3855f41a25330326570d8e8d54e9927b3f56 (diff) | |
| parent | 94aebfb2e7d83748d882992196cb05dd39ba1807 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason:
"These are mostly bug fixes and a two small performance fixes. The
most important of the bunch are Josef's fix for a snapshotting
regression and Mark's update to fix compile problems on arm"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (25 commits)
Btrfs: create the uuid tree on remount rw
btrfs: change extent-same to copy entire argument struct
Btrfs: dir_inode_operations should use btrfs_update_time also
btrfs: Add btrfs: prefix to kernel log output
btrfs: refuse to remount read-write after abort
Btrfs: btrfs_ioctl_default_subvol: Revert back to toplevel subvolume when arg is 0
Btrfs: don't leak transaction in btrfs_sync_file()
Btrfs: add the missing mutex unlock in write_all_supers()
Btrfs: iput inode on allocation failure
Btrfs: remove space_info->reservation_progress
Btrfs: kill delay_iput arg to the wait_ordered functions
Btrfs: fix worst case calculator for space usage
Revert "Btrfs: rework the overcommit logic to be based on the total size"
Btrfs: improve replacing nocow extents
Btrfs: drop dir i_size when adding new names on replay
Btrfs: replay dir_index items before other items
Btrfs: check roots last log commit when checking if an inode has been logged
Btrfs: actually log directory we are fsync()'ing
Btrfs: actually limit the size of delalloc range
Btrfs: allocate the free space by the existed max extent size when ENOSPC
...
| -rw-r--r-- | fs/btrfs/btrfs_inode.h | 5 | ||||
| -rw-r--r-- | fs/btrfs/ctree.c | 7 | ||||
| -rw-r--r-- | fs/btrfs/ctree.h | 17 | ||||
| -rw-r--r-- | fs/btrfs/dev-replace.c | 4 | ||||
| -rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/extent-tree.c | 57 | ||||
| -rw-r--r-- | fs/btrfs/extent_io.c | 8 | ||||
| -rw-r--r-- | fs/btrfs/file.c | 4 | ||||
| -rw-r--r-- | fs/btrfs/free-space-cache.c | 67 | ||||
| -rw-r--r-- | fs/btrfs/free-space-cache.h | 5 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 16 | ||||
| -rw-r--r-- | fs/btrfs/ioctl.c | 80 | ||||
| -rw-r--r-- | fs/btrfs/ordered-data.c | 24 | ||||
| -rw-r--r-- | fs/btrfs/ordered-data.h | 5 | ||||
| -rw-r--r-- | fs/btrfs/relocation.c | 43 | ||||
| -rw-r--r-- | fs/btrfs/scrub.c | 112 | ||||
| -rw-r--r-- | fs/btrfs/super.c | 21 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/tree-log.c | 52 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 7 | ||||
| -rw-r--r-- | include/trace/events/btrfs.h | 1 |
21 files changed, 364 insertions, 175 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index d0ae226926ee..71f074e1870b 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -213,7 +213,10 @@ static inline bool btrfs_is_free_space_inode(struct inode *inode) | |||
| 213 | static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | 213 | static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) |
| 214 | { | 214 | { |
| 215 | if (BTRFS_I(inode)->logged_trans == generation && | 215 | if (BTRFS_I(inode)->logged_trans == generation && |
| 216 | BTRFS_I(inode)->last_sub_trans <= BTRFS_I(inode)->last_log_commit) | 216 | BTRFS_I(inode)->last_sub_trans <= |
| 217 | BTRFS_I(inode)->last_log_commit && | ||
| 218 | BTRFS_I(inode)->last_sub_trans <= | ||
| 219 | BTRFS_I(inode)->root->last_log_commit) | ||
| 217 | return 1; | 220 | return 1; |
| 218 | return 0; | 221 | return 0; |
| 219 | } | 222 | } |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 64346721173f..61b5bcd57b7e 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -1005,8 +1005,11 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
| 1005 | return ret; | 1005 | return ret; |
| 1006 | } | 1006 | } |
| 1007 | 1007 | ||
| 1008 | if (root->ref_cows) | 1008 | if (root->ref_cows) { |
| 1009 | btrfs_reloc_cow_block(trans, root, buf, cow); | 1009 | ret = btrfs_reloc_cow_block(trans, root, buf, cow); |
| 1010 | if (ret) | ||
| 1011 | return ret; | ||
| 1012 | } | ||
| 1010 | 1013 | ||
| 1011 | if (buf == root->node) { | 1014 | if (buf == root->node) { |
| 1012 | WARN_ON(parent && parent != buf); | 1015 | WARN_ON(parent && parent != buf); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 3c1da6f98a4d..0506f40ede83 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -1118,15 +1118,6 @@ struct btrfs_space_info { | |||
| 1118 | */ | 1118 | */ |
| 1119 | struct percpu_counter total_bytes_pinned; | 1119 | struct percpu_counter total_bytes_pinned; |
| 1120 | 1120 | ||
| 1121 | /* | ||
| 1122 | * we bump reservation progress every time we decrement | ||
| 1123 | * bytes_reserved. This way people waiting for reservations | ||
| 1124 | * know something good has happened and they can check | ||
| 1125 | * for progress. The number here isn't to be trusted, it | ||
| 1126 | * just shows reclaim activity | ||
| 1127 | */ | ||
| 1128 | unsigned long reservation_progress; | ||
| 1129 | |||
| 1130 | unsigned int full:1; /* indicates that we cannot allocate any more | 1121 | unsigned int full:1; /* indicates that we cannot allocate any more |
| 1131 | chunks for this space */ | 1122 | chunks for this space */ |
| 1132 | unsigned int chunk_alloc:1; /* set if we are allocating a chunk */ | 1123 | unsigned int chunk_alloc:1; /* set if we are allocating a chunk */ |
| @@ -3135,7 +3126,7 @@ static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_root *root, | |||
| 3135 | unsigned num_items) | 3126 | unsigned num_items) |
| 3136 | { | 3127 | { |
| 3137 | return (root->leafsize + root->nodesize * (BTRFS_MAX_LEVEL - 1)) * | 3128 | return (root->leafsize + root->nodesize * (BTRFS_MAX_LEVEL - 1)) * |
| 3138 | 3 * num_items; | 3129 | 2 * num_items; |
| 3139 | } | 3130 | } |
| 3140 | 3131 | ||
| 3141 | /* | 3132 | /* |
| @@ -3939,9 +3930,9 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, | |||
| 3939 | struct btrfs_root *root); | 3930 | struct btrfs_root *root); |
| 3940 | int btrfs_recover_relocation(struct btrfs_root *root); | 3931 | int btrfs_recover_relocation(struct btrfs_root *root); |
| 3941 | int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len); | 3932 | int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len); |
| 3942 | void btrfs_reloc_cow_block(struct btrfs_trans_handle *trans, | 3933 | int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans, |
| 3943 | struct btrfs_root *root, struct extent_buffer *buf, | 3934 | struct btrfs_root *root, struct extent_buffer *buf, |
| 3944 | struct extent_buffer *cow); | 3935 | struct extent_buffer *cow); |
| 3945 | void btrfs_reloc_pre_snapshot(struct btrfs_trans_handle *trans, | 3936 | void btrfs_reloc_pre_snapshot(struct btrfs_trans_handle *trans, |
| 3946 | struct btrfs_pending_snapshot *pending, | 3937 | struct btrfs_pending_snapshot *pending, |
| 3947 | u64 *bytes_to_reserve); | 3938 | u64 *bytes_to_reserve); |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index a64435359385..70681686e8dc 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
| @@ -400,7 +400,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root, | |||
| 400 | args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR; | 400 | args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR; |
| 401 | btrfs_dev_replace_unlock(dev_replace); | 401 | btrfs_dev_replace_unlock(dev_replace); |
| 402 | 402 | ||
| 403 | btrfs_wait_all_ordered_extents(root->fs_info, 0); | 403 | btrfs_wait_all_ordered_extents(root->fs_info); |
| 404 | 404 | ||
| 405 | /* force writing the updated state information to disk */ | 405 | /* force writing the updated state information to disk */ |
| 406 | trans = btrfs_start_transaction(root, 0); | 406 | trans = btrfs_start_transaction(root, 0); |
| @@ -475,7 +475,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
| 475 | mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); | 475 | mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
| 476 | return ret; | 476 | return ret; |
| 477 | } | 477 | } |
| 478 | btrfs_wait_all_ordered_extents(root->fs_info, 0); | 478 | btrfs_wait_all_ordered_extents(root->fs_info); |
| 479 | 479 | ||
| 480 | trans = btrfs_start_transaction(root, 0); | 480 | trans = btrfs_start_transaction(root, 0); |
| 481 | if (IS_ERR(trans)) { | 481 | if (IS_ERR(trans)) { |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 4cbb00af92ff..4ae17ed13b32 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -157,6 +157,7 @@ static struct btrfs_lockdep_keyset { | |||
| 157 | { .id = BTRFS_TREE_LOG_OBJECTID, .name_stem = "log" }, | 157 | { .id = BTRFS_TREE_LOG_OBJECTID, .name_stem = "log" }, |
| 158 | { .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" }, | 158 | { .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" }, |
| 159 | { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" }, | 159 | { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" }, |
| 160 | { .id = BTRFS_UUID_TREE_OBJECTID, .name_stem = "uuid" }, | ||
| 160 | { .id = 0, .name_stem = "tree" }, | 161 | { .id = 0, .name_stem = "tree" }, |
| 161 | }; | 162 | }; |
| 162 | 163 | ||
| @@ -3415,6 +3416,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
| 3415 | if (total_errors > max_errors) { | 3416 | if (total_errors > max_errors) { |
| 3416 | printk(KERN_ERR "btrfs: %d errors while writing supers\n", | 3417 | printk(KERN_ERR "btrfs: %d errors while writing supers\n", |
| 3417 | total_errors); | 3418 | total_errors); |
| 3419 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | ||
| 3418 | 3420 | ||
| 3419 | /* FUA is masked off if unsupported and can't be the reason */ | 3421 | /* FUA is masked off if unsupported and can't be the reason */ |
| 3420 | btrfs_error(root->fs_info, -EIO, | 3422 | btrfs_error(root->fs_info, -EIO, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index cfb3cf711b34..d58bef130a41 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -3925,7 +3925,6 @@ static int can_overcommit(struct btrfs_root *root, | |||
| 3925 | u64 space_size; | 3925 | u64 space_size; |
| 3926 | u64 avail; | 3926 | u64 avail; |
| 3927 | u64 used; | 3927 | u64 used; |
| 3928 | u64 to_add; | ||
| 3929 | 3928 | ||
| 3930 | used = space_info->bytes_used + space_info->bytes_reserved + | 3929 | used = space_info->bytes_used + space_info->bytes_reserved + |
| 3931 | space_info->bytes_pinned + space_info->bytes_readonly; | 3930 | space_info->bytes_pinned + space_info->bytes_readonly; |
| @@ -3959,25 +3958,17 @@ static int can_overcommit(struct btrfs_root *root, | |||
| 3959 | BTRFS_BLOCK_GROUP_RAID10)) | 3958 | BTRFS_BLOCK_GROUP_RAID10)) |
| 3960 | avail >>= 1; | 3959 | avail >>= 1; |
| 3961 | 3960 | ||
| 3962 | to_add = space_info->total_bytes; | ||
| 3963 | |||
| 3964 | /* | 3961 | /* |
| 3965 | * If we aren't flushing all things, let us overcommit up to | 3962 | * If we aren't flushing all things, let us overcommit up to |
| 3966 | * 1/2th of the space. If we can flush, don't let us overcommit | 3963 | * 1/2th of the space. If we can flush, don't let us overcommit |
| 3967 | * too much, let it overcommit up to 1/8 of the space. | 3964 | * too much, let it overcommit up to 1/8 of the space. |
| 3968 | */ | 3965 | */ |
