diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-03-02 19:03:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-03-02 19:03:00 -0500 |
commit | bbe08c0a43e2c5ee3a00de68c0e867a08a9aa990 (patch) | |
tree | 389386abdf1ee5820514437d0c2e22b4b64773df /fs/btrfs/disk-io.c | |
parent | 94e877d0fb43bec0540d6a37d49cb4f7f05a5348 (diff) | |
parent | e9f467d028cd7d8bee2a4d6c4fb806caf8cd580b (diff) |
Merge branch 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull more btrfs updates from Chris Mason:
"Btrfs round two.
These are mostly a continuation of Dave Sterba's collection of
cleanups, but Filipe also has some bug fixes and performance
improvements"
* 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (69 commits)
btrfs: add dummy callback for readpage_io_failed and drop checks
btrfs: drop checks for mandatory extent_io_ops callbacks
btrfs: document existence of extent_io ops callbacks
btrfs: let writepage_end_io_hook return void
btrfs: do proper error handling in btrfs_insert_xattr_item
btrfs: handle allocation error in update_dev_stat_item
btrfs: remove BUG_ON from __tree_mod_log_insert
btrfs: derive maximum output size in the compression implementation
btrfs: use predefined limits for calculating maximum number of pages for compression
btrfs: export compression buffer limits in a header
btrfs: merge nr_pages input and output parameter in compress_pages
btrfs: merge length input and output parameter in compress_pages
btrfs: constify name of subvolume in creation helpers
btrfs: constify buffers used by compression helpers
btrfs: constify input buffer of btrfs_csum_data
btrfs: constify device path passed to relevant helpers
btrfs: make btrfs_inode_resume_unlocked_dio take btrfs_inode
btrfs: make btrfs_inode_block_unlocked_dio take btrfs_inode
btrfs: Make btrfs_add_nondir take btrfs_inode
btrfs: Make btrfs_add_link take btrfs_inode
...
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 207db0270b15..08b74daf35d0 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -219,12 +219,12 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb, | |||
219 | * extents on the btree inode are pretty simple, there's one extent | 219 | * extents on the btree inode are pretty simple, there's one extent |
220 | * that covers the entire device | 220 | * that covers the entire device |
221 | */ | 221 | */ |
222 | static struct extent_map *btree_get_extent(struct inode *inode, | 222 | static struct extent_map *btree_get_extent(struct btrfs_inode *inode, |
223 | struct page *page, size_t pg_offset, u64 start, u64 len, | 223 | struct page *page, size_t pg_offset, u64 start, u64 len, |
224 | int create) | 224 | int create) |
225 | { | 225 | { |
226 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); | 226 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); |
227 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | 227 | struct extent_map_tree *em_tree = &inode->extent_tree; |
228 | struct extent_map *em; | 228 | struct extent_map *em; |
229 | int ret; | 229 | int ret; |
230 | 230 | ||
@@ -265,7 +265,7 @@ out: | |||
265 | return em; | 265 | return em; |
266 | } | 266 | } |
267 | 267 | ||
268 | u32 btrfs_csum_data(char *data, u32 seed, size_t len) | 268 | u32 btrfs_csum_data(const char *data, u32 seed, size_t len) |
269 | { | 269 | { |
270 | return btrfs_crc32c(seed, data, len); | 270 | return btrfs_crc32c(seed, data, len); |
271 | } | 271 | } |
@@ -2205,11 +2205,9 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) | |||
2205 | btrfs_destroy_workqueue(fs_info->delalloc_workers); | 2205 | btrfs_destroy_workqueue(fs_info->delalloc_workers); |
2206 | btrfs_destroy_workqueue(fs_info->workers); | 2206 | btrfs_destroy_workqueue(fs_info->workers); |
2207 | btrfs_destroy_workqueue(fs_info->endio_workers); | 2207 | btrfs_destroy_workqueue(fs_info->endio_workers); |
2208 | btrfs_destroy_workqueue(fs_info->endio_meta_workers); | ||
2209 | btrfs_destroy_workqueue(fs_info->endio_raid56_workers); | 2208 | btrfs_destroy_workqueue(fs_info->endio_raid56_workers); |
2210 | btrfs_destroy_workqueue(fs_info->endio_repair_workers); | 2209 | btrfs_destroy_workqueue(fs_info->endio_repair_workers); |
2211 | btrfs_destroy_workqueue(fs_info->rmw_workers); | 2210 | btrfs_destroy_workqueue(fs_info->rmw_workers); |
2212 | btrfs_destroy_workqueue(fs_info->endio_meta_write_workers); | ||
2213 | btrfs_destroy_workqueue(fs_info->endio_write_workers); | 2211 | btrfs_destroy_workqueue(fs_info->endio_write_workers); |
2214 | btrfs_destroy_workqueue(fs_info->endio_freespace_worker); | 2212 | btrfs_destroy_workqueue(fs_info->endio_freespace_worker); |
2215 | btrfs_destroy_workqueue(fs_info->submit_workers); | 2213 | btrfs_destroy_workqueue(fs_info->submit_workers); |
@@ -2219,6 +2217,13 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) | |||
2219 | btrfs_destroy_workqueue(fs_info->flush_workers); | 2217 | btrfs_destroy_workqueue(fs_info->flush_workers); |
2220 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); | 2218 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); |
2221 | btrfs_destroy_workqueue(fs_info->extent_workers); | 2219 | btrfs_destroy_workqueue(fs_info->extent_workers); |
2220 | /* | ||
2221 | * Now that all other work queues are destroyed, we can safely destroy | ||
2222 | * the queues used for metadata I/O, since tasks from those other work | ||
2223 | * queues can do metadata I/O operations. | ||
2224 | */ | ||
2225 | btrfs_destroy_workqueue(fs_info->endio_meta_workers); | ||
2226 | btrfs_destroy_workqueue(fs_info->endio_meta_write_workers); | ||
2222 | } | 2227 | } |
2223 | 2228 | ||
2224 | static void free_root_extent_buffers(struct btrfs_root *root) | 2229 | static void free_root_extent_buffers(struct btrfs_root *root) |
@@ -3261,7 +3266,6 @@ fail_fsdev_sysfs: | |||
3261 | 3266 | ||
3262 | fail_block_groups: | 3267 | fail_block_groups: |
3263 | btrfs_put_block_group_cache(fs_info); | 3268 | btrfs_put_block_group_cache(fs_info); |
3264 | btrfs_free_block_groups(fs_info); | ||
3265 | 3269 | ||
3266 | fail_tree_roots: | 3270 | fail_tree_roots: |
3267 | free_root_pointers(fs_info, 1); | 3271 | free_root_pointers(fs_info, 1); |
@@ -3269,6 +3273,7 @@ fail_tree_roots: | |||
3269 | 3273 | ||
3270 | fail_sb_buffer: | 3274 | fail_sb_buffer: |
3271 | btrfs_stop_all_workers(fs_info); | 3275 | btrfs_stop_all_workers(fs_info); |
3276 | btrfs_free_block_groups(fs_info); | ||
3272 | fail_alloc: | 3277 | fail_alloc: |
3273 | fail_iput: | 3278 | fail_iput: |
3274 | btrfs_mapping_tree_free(&fs_info->mapping_tree); | 3279 | btrfs_mapping_tree_free(&fs_info->mapping_tree); |
@@ -3448,7 +3453,7 @@ static int write_dev_supers(struct btrfs_device *device, | |||
3448 | btrfs_set_super_bytenr(sb, bytenr); | 3453 | btrfs_set_super_bytenr(sb, bytenr); |
3449 | 3454 | ||
3450 | crc = ~(u32)0; | 3455 | crc = ~(u32)0; |
3451 | crc = btrfs_csum_data((char *)sb + | 3456 | crc = btrfs_csum_data((const char *)sb + |
3452 | BTRFS_CSUM_SIZE, crc, | 3457 | BTRFS_CSUM_SIZE, crc, |
3453 | BTRFS_SUPER_INFO_SIZE - | 3458 | BTRFS_SUPER_INFO_SIZE - |
3454 | BTRFS_CSUM_SIZE); | 3459 | BTRFS_CSUM_SIZE); |
@@ -3977,8 +3982,6 @@ void close_ctree(struct btrfs_fs_info *fs_info) | |||
3977 | 3982 | ||
3978 | btrfs_put_block_group_cache(fs_info); | 3983 | btrfs_put_block_group_cache(fs_info); |
3979 | 3984 | ||
3980 | btrfs_free_block_groups(fs_info); | ||
3981 | |||
3982 | /* | 3985 | /* |
3983 | * we must make sure there is not any read request to | 3986 | * we must make sure there is not any read request to |
3984 | * submit after we stopping all workers. | 3987 | * submit after we stopping all workers. |
@@ -3986,6 +3989,8 @@ void close_ctree(struct btrfs_fs_info *fs_info) | |||
3986 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 3989 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
3987 | btrfs_stop_all_workers(fs_info); | 3990 | btrfs_stop_all_workers(fs_info); |
3988 | 3991 | ||
3992 | btrfs_free_block_groups(fs_info); | ||
3993 | |||
3989 | clear_bit(BTRFS_FS_OPEN, &fs_info->flags); | 3994 | clear_bit(BTRFS_FS_OPEN, &fs_info->flags); |
3990 | free_root_pointers(fs_info, 1); | 3995 | free_root_pointers(fs_info, 1); |
3991 | 3996 | ||
@@ -4653,9 +4658,12 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info) | |||
4653 | } | 4658 | } |
4654 | 4659 | ||
4655 | static const struct extent_io_ops btree_extent_io_ops = { | 4660 | static const struct extent_io_ops btree_extent_io_ops = { |
4656 | .readpage_end_io_hook = btree_readpage_end_io_hook, | 4661 | /* mandatory callbacks */ |
4657 | .readpage_io_failed_hook = btree_io_failed_hook, | ||
4658 | .submit_bio_hook = btree_submit_bio_hook, | 4662 | .submit_bio_hook = btree_submit_bio_hook, |
4663 | .readpage_end_io_hook = btree_readpage_end_io_hook, | ||
4659 | /* note we're sharing with inode.c for the merge bio hook */ | 4664 | /* note we're sharing with inode.c for the merge bio hook */ |
4660 | .merge_bio_hook = btrfs_merge_bio_hook, | 4665 | .merge_bio_hook = btrfs_merge_bio_hook, |
4666 | .readpage_io_failed_hook = btree_io_failed_hook, | ||
4667 | |||
4668 | /* optional callbacks */ | ||
4661 | }; | 4669 | }; |