Misc cleanups for 4.19
David Sterba
maintainercover Misc cleanups for 4.19
Minor interface/API and other safe cleanups.
David Sterba (14):
btrfs: simplify some assignments of inode numbers
btrfs: simplify pointer chasing of local fs_info variables
btrfs: use copy_page for copying pages instead of memcpy
btrfs: prune unused includes
btrfs: pass only eb to num_extent_pages
btrfs: switch types to int when counting eb pages
btrfs: open-code bio_set_op_attrs
btrfs: raid56: add new helper for starting async work
btrfs: raid56: use new helper for async_rmw_stripe
btrfs: raid56: use new helper for async_read_rebuild
btrfs: raid56: use new helper for async_scrub_parity
btrfs: raid56: merge rbio_is_full helpers
btrfs: raid56: don't lock stripe cache table when freeing
btrfs: raid56: catch errors from full_stripe_write
fs/btrfs/check-integrity.c | 2 +- fs/btrfs/compression.c | 8 +-- fs/btrfs/delayed-inode.c | 4 +- fs/btrfs/dev-replace.c | 5 -- fs/btrfs/disk-io.c | 4 +- fs/btrfs/extent-tree.c | 6 +- fs/btrfs/extent_io.c | 70 +++++++++++----------- fs/btrfs/extent_io.h | 6 +- fs/btrfs/file-item.c | 2 +- fs/btrfs/file.c | 17 +++--- fs/btrfs/free-space-cache.c | 11 ++-- fs/btrfs/inode-map.c | 1 - fs/btrfs/inode.c | 24 ++++---- fs/btrfs/ioctl.c | 5 -- fs/btrfs/ordered-data.c | 1 - fs/btrfs/raid56.c | 112 +++++++++++------------------------- fs/btrfs/reada.c | 1 - fs/btrfs/scrub.c | 6 +- fs/btrfs/struct-funcs.c | 1 - fs/btrfs/super.c | 3 - fs/btrfs/sysfs.c | 2 - fs/btrfs/tree-log.c | 6 +- fs/btrfs/volumes.c | 3 - 23 files changed, 109 insertions(+), 191 deletions(-)
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 1/14 btrfs: simplify some assignments of inode numbers
There are several places when the btrfs inode is converted to the generic inode, back to btrfs and then passed to btrfs_ino. We can remove the extra back and forth conversions.
--- fs/btrfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +6 -6
@@ -4243,9 +4243,9 @@ static void btrfs_prune_dentries(struct btrfs_root *root) prev = node; entry = rb_entry(node, struct btrfs_inode, rb_node); -if (objectid <btrfs_ino (BTRFS_I (&entry->vfs_inode))) +if (objectid <btrfs_ino (entry)) node = node->rb_left; -else if (objectid >btrfs_ino (BTRFS_I (&entry->vfs_inode))) +else if (objectid >btrfs_ino (entry)) node = node->rb_right;else break ;
@@ -4253,7 +4253,7 @@ static void btrfs_prune_dentries(struct btrfs_root *root)if (!node) {while (prev) { entry = rb_entry(prev, struct btrfs_inode, rb_node); -if (objectid <=btrfs_ino (BTRFS_I (&entry->vfs_inode))) { +if (objectid <=btrfs_ino (entry)) { node = prev;break ; }
@@ -4262,7 +4262,7 @@ static void btrfs_prune_dentries(struct btrfs_root *root) }while (node) { entry = rb_entry(node, struct btrfs_inode, rb_node); - objectid =btrfs_ino (BTRFS_I (&entry->vfs_inode)) +1 ; + objectid =btrfs_ino (entry) +1 ; inode =igrab (&entry->vfs_inode);if (inode) {spin_unlock (&root->inode_lock);
@@ -5615,9 +5615,9 @@ static void inode_tree_add(struct inode *inode) parent = *p; entry = rb_entry(parent, struct btrfs_inode, rb_node); -if (ino <btrfs_ino (BTRFS_I (&entry->vfs_inode))) +if (ino <btrfs_ino (entry)) p = &parent->rb_left; -else if (ino >btrfs_ino (BTRFS_I (&entry->vfs_inode))) +else if (ino >btrfs_ino (entry)) p = &parent->rb_right;else { WARN_ON(!(entry->vfs_inode.i_state &
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 2/14 btrfs: simplify pointer chasing of local fs_info variables
In reply to David SterbaFunctions that get btrfs inode can simply reach the fs_info by dereferencing the root and this looks a bit more straightforward compared to the btrfs_sb(...) indirection.
If the transaction handle is available and not NULL it's used instead.
--- fs/btrfs/delayed-inode.c | 4 ++-- fs/btrfs/disk-io.c | 2 +- fs/btrfs/extent-tree.c | 6 +++--- fs/btrfs/file-item.c | 2 +- fs/btrfs/file.c | 14 +++++++------- fs/btrfs/free-space-cache.c | 7 ++----- fs/btrfs/inode.c | 6 +++--- fs/btrfs/tree-log.c | 6 +++--- 8 files changed, 22 insertions(+), 25 deletions(-)
fs/btrfs/delayed-inode.c +2 -2
@@ -1222,7 +1222,7 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,int btrfs_commit_inode_delayed_inode (struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct btrfs_trans_handle *trans;struct btrfs_delayed_node *delayed_node =btrfs_get_delayed_node (inode);struct btrfs_path *path;
@@ -1837,7 +1837,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,int btrfs_delayed_delete_inode_ref (struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct btrfs_delayed_node *delayed_node;/*
fs/btrfs/disk-io.c +1 -1
@@ -212,7 +212,7 @@ struct extent_map *btree_get_extent(struct btrfs_inode *inode, struct page *page, size_t pg_offset, u64 start, u64 len, int create) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = inode->root->fs_info;struct extent_map_tree *em_tree = &inode->extent_tree;struct extent_map *em;int ret;
fs/btrfs/extent-tree.c +3 -3
@@ -6019,7 +6019,7 @@ static void btrfs_calculate_inode_block_rsv_size(struct btrfs_fs_info *fs_info,int btrfs_delalloc_reserve_metadata (struct btrfs_inode *inode,u64 num_bytes) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;unsigned nr_extents;enum btrfs_reserve_flush_enum flush =BTRFS_RESERVE_FLUSH_ALL ;int ret =0 ;
@@ -6092,7 +6092,7 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes)void btrfs_delalloc_release_metadata (struct btrfs_inode *inode,u64 num_bytes,bool qgroup_free) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info; num_bytes =ALIGN (num_bytes, fs_info->sectorsize);spin_lock (&inode->lock);
@@ -6121,7 +6121,7 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes,void btrfs_delalloc_release_extents (struct btrfs_inode *inode,u64 num_bytes,bool qgroup_free) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;unsigned num_extents;spin_lock (&inode->lock);
fs/btrfs/file-item.c +1 -1
@@ -922,7 +922,7 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,const bool new_inline, struct extent_map *em) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = inode->root->fs_info;struct btrfs_root *root = inode->root;struct extent_buffer *leaf = path->nodes[0 ];const int slot = path->slots[0 ];
fs/btrfs/file.c +7 -7
@@ -83,7 +83,7 @@ static int __compare_inode_defrag(struct inode_defrag *defrag1,static int __btrfs_add_inode_defrag (struct btrfs_inode *inode,struct inode_defrag *defrag) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct inode_defrag *entry;struct rb_node **p;struct rb_node *parent =NULL ;
@@ -135,8 +135,8 @@ static inline int __need_auto_defrag(struct btrfs_fs_info *fs_info)int btrfs_add_inode_defrag (struct btrfs_trans_handle *trans,struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb);struct btrfs_root *root = inode->root; +struct btrfs_fs_info *fs_info = root->fs_info;struct inode_defrag *defrag;u64 transid;int ret;
@@ -185,7 +185,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,static void btrfs_requeue_inode_defrag (struct btrfs_inode *inode,struct inode_defrag *defrag) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;int ret;if (!__need_auto_defrag (fs_info))
@@ -1133,7 +1133,7 @@ static int extent_mergeable(struct extent_buffer *leaf, int slot,int btrfs_mark_extent_written (struct btrfs_trans_handle *trans,struct btrfs_inode *inode,u64 start,u64 end) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = trans->fs_info;struct btrfs_root *root = inode->root;struct extent_buffer *leaf;struct btrfs_path *path;
@@ -1470,7 +1470,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages, u64 *lockstart, u64 *lockend, struct extent_state **cached_state) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;u64 start_pos;u64 last_pos;int i;
@@ -1526,7 +1526,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages, static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos,size_t *write_bytes) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct btrfs_root *root = inode->root;struct btrfs_ordered_extent *ordered;u64 lockstart, lockend;
@@ -2310,7 +2310,7 @@ static int fill_holes(struct btrfs_trans_handle *trans,struct btrfs_inode *inode, struct btrfs_path *path, u64 offset, u64 end) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = trans->fs_info;struct btrfs_root *root = inode->root;struct extent_buffer *leaf;struct btrfs_file_extent_item *fi;
fs/btrfs/free-space-cache.c +2 -5
@@ -655,7 +655,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,struct btrfs_free_space_ctl *ctl, struct btrfs_path *path, u64 offset) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); + struct btrfs_fs_info *fs_info = root->fs_info;struct btrfs_free_space_header *header;struct extent_buffer *leaf;struct btrfs_io_ctl io_ctl;
@@ -1123,13 +1123,10 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root, {int ret;struct inode *inode = io_ctl->inode; -struct btrfs_fs_info *fs_info;if (!inode)return 0 ; - fs_info =btrfs_sb (inode->i_sb); -/* Flush the dirty pages in the cache file. */ ret =flush_dirty_cache (inode);if (ret)
@@ -1145,7 +1142,7 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root,BTRFS_I (inode)->generation =0 ;if (block_group) {#ifdef DEBUG -btrfs_err (fs_info, +btrfs_err (root->fs_info,"failed to write free space cache for block group %llu" , block_group->key.objectid);#endif
fs/btrfs/inode.c +3 -3
@@ -1752,7 +1752,7 @@ static void btrfs_add_delalloc_inodes(struct btrfs_root *root,void __btrfs_del_delalloc_inode (struct btrfs_root *root,struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->vfs_inode.i_sb); +struct btrfs_fs_info *fs_info = root->fs_info;if (!list_empty (&inode->delalloc_inodes)) {list_del_init (&inode->delalloc_inodes);
@@ -6419,7 +6419,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, struct btrfs_inode *parent_inode, struct btrfs_inode *inode, const char *name, int name_len, int add_backref, u64 index) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = trans->fs_info;int ret =0 ;struct btrfs_key key;struct btrfs_root *root = parent_inode->root;
@@ -6847,7 +6847,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, size_t pg_offset, u64 start, u64 len, int create) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = inode->root->fs_info;int ret;int err =0 ;u64 extent_start =0 ;
fs/btrfs/tree-log.c +3 -3
@@ -3756,7 +3756,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, int start_slot, int nr, int inode_only, u64 logged_isize) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = trans->fs_info;unsigned long src_offset;unsigned long dst_offset;struct btrfs_root *log = inode->root->log_root;
@@ -5585,7 +5585,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,struct btrfs_inode *inode, struct btrfs_log_ctx *ctx) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = trans->fs_info;int ret;struct btrfs_path *path;struct btrfs_key key;
@@ -6120,7 +6120,7 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, struct btrfs_inode *inode, struct btrfs_inode *old_dir, struct dentry *parent) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); + struct btrfs_fs_info *fs_info = trans->fs_info;/* * this will force the logging code to walk the dentry chain
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 3/14 btrfs: use copy_page for copying pages instead of memcpy
In reply to David SterbaUse the helper that's possibly optimized for full page copies.
--- fs/btrfs/free-space-cache.c | 4 ++-- fs/btrfs/raid56.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-)
fs/btrfs/free-space-cache.c +2 -2
@@ -547,7 +547,7 @@ static int io_ctl_add_bitmap(struct btrfs_io_ctl *io_ctl, void *bitmap)io_ctl_map_page (io_ctl,0 ); } -memcpy (io_ctl->cur, bitmap,PAGE_SIZE ); +copy_page (io_ctl->cur, bitmap);io_ctl_set_crc (io_ctl, io_ctl->index -1 );if (io_ctl->index < io_ctl->num_pages)io_ctl_map_page (io_ctl,0 );
@@ -607,7 +607,7 @@ static int io_ctl_read_bitmap(struct btrfs_io_ctl *io_ctl,if (ret)return ret; -memcpy (entry->bitmap, io_ctl->cur,PAGE_SIZE ); +copy_page (entry->bitmap, io_ctl->cur);io_ctl_unmap_page (io_ctl);return 0 ;
fs/btrfs/raid56.c +5 -7
@@ -260,7 +260,7 @@ static void cache_rbio_pages(struct btrfs_raid_bio *rbio) s =kmap (rbio->bio_pages[i]); d =kmap (rbio->stripe_pages[i]); -memcpy (d, s,PAGE_SIZE ); +copy_page (d, s);kunmap (rbio->bio_pages[i]);kunmap (rbio->stripe_pages[i]);
@@ -1275,7 +1275,7 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio) pointers); }else {/* raid5 */ -memcpy (pointers[nr_data], pointers[0 ],PAGE_SIZE ); +copy_page (pointers[nr_data], pointers[0 ]);run_xor (pointers +1 , nr_data -1 ,PAGE_SIZE ); }
@@ -1941,9 +1941,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio)BUG_ON (failb !=-1 ); pstripe:/* Copy parity block into failed block to start with */ -memcpy (pointers[faila], - pointers[rbio->nr_data], -PAGE_SIZE ); +copy_page (pointers[faila], pointers[rbio->nr_data]);/* rearrange the pointer array */ p = pointers[faila];
@@ -2448,7 +2446,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, pointers); }else {/* raid5 */ -memcpy (pointers[nr_data], pointers[0 ],PAGE_SIZE ); +copy_page (pointers[nr_data], pointers[0 ]);run_xor (pointers +1 , nr_data -1 ,PAGE_SIZE ); }
@@ -2456,7 +2454,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, p =rbio_stripe_page (rbio, rbio->scrubp, pagenr); parity =kmap (p);if (memcmp (parity, pointers[rbio->scrubp],PAGE_SIZE )) -memcpy (parity, pointers[rbio->scrubp],PAGE_SIZE ); +copy_page (parity, pointers[rbio->scrubp]);else /* Parity is right, needn't writeback */ bitmap_clear (rbio->dbitmap, pagenr,1 );
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 4/14 btrfs: prune unused includes
In reply to David SterbaRemove includes if none of the interfaces and exports is used in the given source file.
--- fs/btrfs/compression.c | 4 ---- fs/btrfs/dev-replace.c | 5 ----- fs/btrfs/disk-io.c | 2 -- fs/btrfs/file.c | 3 --- fs/btrfs/inode-map.c | 1 - fs/btrfs/inode.c | 4 ---- fs/btrfs/ioctl.c | 5 ----- fs/btrfs/ordered-data.c | 1 - fs/btrfs/raid56.c | 13 ------------- fs/btrfs/reada.c | 1 - fs/btrfs/struct-funcs.c | 1 - fs/btrfs/super.c | 3 --- fs/btrfs/sysfs.c | 2 -- fs/btrfs/volumes.c | 3 --- 14 files changed, 48 deletions(-)
fs/btrfs/compression.c +0 -4
@@ -5,7 +5,6 @@#include <linux/kernel.h> #include <linux/bio.h> -#include <linux/buffer_head.h> #include <linux/file.h> #include <linux/fs.h> #include <linux/pagemap.h>
@@ -14,10 +13,7 @@#include <linux/init.h> #include <linux/string.h> #include <linux/backing-dev.h> -#include <linux/mpage.h> -#include <linux/swap.h> #include <linux/writeback.h> -#include <linux/bit_spinlock.h> #include <linux/slab.h> #include <linux/sched/mm.h> #include <linux/log2.h>
fs/btrfs/dev-replace.c +0 -5
@@ -6,14 +6,9 @@#include <linux/sched.h> #include <linux/bio.h> #include <linux/slab.h> -#include <linux/buffer_head.h> #include <linux/blkdev.h> -#include <linux/random.h> -#include <linux/iocontext.h> -#include <linux/capability.h> #include <linux/kthread.h> #include <linux/math64.h> -#include <asm/div64.h> #include "ctree.h" #include "extent_map.h" #include "disk-io.h"
fs/btrfs/disk-io.c +0 -2
@@ -5,8 +5,6 @@#include <linux/fs.h> #include <linux/blkdev.h> -#include <linux/scatterlist.h> -#include <linux/swap.h> #include <linux/radix-tree.h> #include <linux/writeback.h> #include <linux/buffer_head.h>
fs/btrfs/file.c +0 -3
@@ -5,14 +5,11 @@#include <linux/fs.h> #include <linux/pagemap.h> -#include <linux/highmem.h> #include <linux/time.h> #include <linux/init.h> #include <linux/string.h> #include <linux/backing-dev.h> -#include <linux/mpage.h> #include <linux/falloc.h> -#include <linux/swap.h> #include <linux/writeback.h> #include <linux/compat.h> #include <linux/slab.h>
fs/btrfs/inode-map.c +0 -1
@@ -3,7 +3,6 @@* Copyright (C) 2007 Oracle. All rights reserved. */ -#include <linux/delay.h> #include <linux/kthread.h> #include <linux/pagemap.h>
fs/btrfs/inode.c +0 -4
@@ -14,17 +14,13 @@#include <linux/init.h> #include <linux/string.h> #include <linux/backing-dev.h> -#include <linux/mpage.h> -#include <linux/swap.h> #include <linux/writeback.h> #include <linux/compat.h> -#include <linux/bit_spinlock.h> #include <linux/xattr.h> #include <linux/posix_acl.h> #include <linux/falloc.h> #include <linux/slab.h> #include <linux/ratelimit.h> -#include <linux/mount.h> #include <linux/btrfs.h> #include <linux/blkdev.h> #include <linux/posix_acl_xattr.h>
fs/btrfs/ioctl.c +0 -5
@@ -5,23 +5,18 @@#include <linux/kernel.h> #include <linux/bio.h> -#include <linux/buffer_head.h> #include <linux/file.h> #include <linux/fs.h> #include <linux/fsnotify.h> #include <linux/pagemap.h> #include <linux/highmem.h> #include <linux/time.h> -#include <linux/init.h> #include <linux/string.h> #include <linux/backing-dev.h> #include <linux/mount.h> -#include <linux/mpage.h> #include <linux/namei.h> -#include <linux/swap.h> #include <linux/writeback.h> #include <linux/compat.h> -#include <linux/bit_spinlock.h> #include <linux/security.h> #include <linux/xattr.h> #include <linux/mm.h>
fs/btrfs/ordered-data.c +0 -1
@@ -6,7 +6,6 @@#include <linux/slab.h> #include <linux/blkdev.h> #include <linux/writeback.h> -#include <linux/pagevec.h> #include "ctree.h" #include "transaction.h" #include "btrfs_inode.h"
fs/btrfs/raid56.c +0 -13
@@ -5,32 +5,19 @@*/ #include <linux/sched.h> -#include <linux/wait.h> #include <linux/bio.h> #include <linux/slab.h> -#include <linux/buffer_head.h> #include <linux/blkdev.h> -#include <linux/random.h> -#include <linux/iocontext.h> -#include <linux/capability.h> -#include <linux/ratelimit.h> -#include <linux/kthread.h> #include <linux/raid/pq.h> #include <linux/hash.h> #include <linux/list_sort.h> #include <linux/raid/xor.h> #include <linux/mm.h> -#include <asm/div64.h> #include "ctree.h" -#include "extent_map.h" #include "disk-io.h" -#include "transaction.h" -#include "print-tree.h" #include "volumes.h" #include "raid56.h" #include "async-thread.h" -#include "check-integrity.h" -#include "rcu-string.h" /* set when additional merges to this rbio are not allowed */ #define RBIO_RMW_LOCKED_BIT 1
fs/btrfs/reada.c +0 -1
@@ -7,7 +7,6 @@#include <linux/pagemap.h> #include <linux/writeback.h> #include <linux/blkdev.h> -#include <linux/rbtree.h> #include <linux/slab.h> #include <linux/workqueue.h> #include "ctree.h"
fs/btrfs/struct-funcs.c +0 -1
@@ -3,7 +3,6 @@* Copyright (C) 2007 Oracle. All rights reserved. */ -#include <linux/highmem.h> #include <asm/unaligned.h> #include "ctree.h"
fs/btrfs/super.c +0 -3
@@ -5,7 +5,6 @@#include <linux/blkdev.h> #include <linux/module.h> -#include <linux/buffer_head.h> #include <linux/fs.h> #include <linux/pagemap.h> #include <linux/highmem.h>
@@ -15,8 +14,6 @@#include <linux/string.h> #include <linux/backing-dev.h> #include <linux/mount.h> -#include <linux/mpage.h> -#include <linux/swap.h> #include <linux/writeback.h> #include <linux/statfs.h> #include <linux/compat.h>
fs/btrfs/sysfs.c +0 -2
@@ -7,10 +7,8 @@#include <linux/slab.h> #include <linux/spinlock.h> #include <linux/completion.h> -#include <linux/buffer_head.h> #include <linux/kobject.h> #include <linux/bug.h> -#include <linux/genhd.h> #include <linux/debugfs.h> #include "ctree.h"
fs/btrfs/volumes.c +0 -3
@@ -8,15 +8,12 @@#include <linux/slab.h> #include <linux/buffer_head.h> #include <linux/blkdev.h> -#include <linux/iocontext.h> -#include <linux/capability.h> #include <linux/ratelimit.h> #include <linux/kthread.h> #include <linux/raid/pq.h> #include <linux/semaphore.h> #include <linux/uuid.h> #include <linux/list_sort.h> -#include <asm/div64.h> #include "ctree.h" #include "extent_map.h" #include "disk-io.h"
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 5/14 btrfs: pass only eb to num_extent_pages
In reply to David SterbaAlmost all callers pass the start and len as 2 arguments but this is not necessary, all the information is provided by the eb. By reordering the calls to num_extent_pages, we don't need the local variables with start/len.
--- fs/btrfs/extent_io.c | 30 +++++++++++++++--------------- fs/btrfs/extent_io.h | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-)
fs/btrfs/extent_io.c +15 -15
@@ -2062,7 +2062,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, int mirror_num) {u64 start = eb->start; -unsigned long i, num_pages =num_extent_pages (eb->start, eb->len); +unsigned long i, num_pages =num_extent_pages (eb);int ret =0 ;if (sb_rdonly (fs_info->sb))
@@ -3591,7 +3591,7 @@ lock_extent_buffer_for_io(struct extent_buffer *eb,if (!ret)return ret; - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) {struct page *p = eb->pages[i];
@@ -3721,7 +3721,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,int ret =0 ;clear_bit (EXTENT_BUFFER_WRITE_ERR , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);atomic_set (&eb->io_pages, num_pages);/* set btree blocks beyond nritems with 0 to avoid stale content. */
@@ -4650,7 +4650,7 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb)BUG_ON (extent_buffer_under_io (eb)); - index =num_extent_pages (eb->start, eb->len); + index =num_extent_pages (eb);if (index ==0 )return ;
@@ -4743,7 +4743,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)unsigned long i;struct page *p;struct extent_buffer *new; -unsigned long num_pages =num_extent_pages (src->start, src->len); +unsigned long num_pages =num_extent_pages (src); new =__alloc_extent_buffer (src->fs_info, src->start, src->len);if (new ==NULL )
@@ -4775,12 +4775,11 @@ struct extent_buffer *__alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,unsigned long num_pages;unsigned long i; - num_pages =num_extent_pages (start, len); - eb =__alloc_extent_buffer (fs_info, start, len);if (!eb)return NULL ; + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { eb->pages[i] =alloc_page (GFP_NOFS );if (!eb->pages[i])
@@ -4844,7 +4843,7 @@ static void mark_extent_buffer_accessed(struct extent_buffer *eb,check_buffer_tree_ref (eb); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) {struct page *p = eb->pages[i];
@@ -4941,7 +4940,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start) {unsigned long len = fs_info->nodesize; -unsigned long num_pages =num_extent_pages (start, len); +unsigned long num_pages;unsigned long i;unsigned long index = start >>PAGE_SHIFT ;struct extent_buffer *eb;
@@ -4964,6 +4963,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,if (!eb)return ERR_PTR (-ENOMEM ); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++, index++) { p =find_or_create_page (mapping, index,GFP_NOFS |__GFP_NOFAIL);if (!p) {
@@ -5160,7 +5160,7 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb)unsigned long num_pages;struct page *page; - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];
@@ -5194,7 +5194,7 @@ int set_extent_buffer_dirty(struct extent_buffer *eb) was_dirty =test_and_set_bit (EXTENT_BUFFER_DIRTY , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);WARN_ON (atomic_read (&eb->refs) ==0 );WARN_ON (!test_bit (EXTENT_BUFFER_TREE_REF , &eb->bflags));
@@ -5210,7 +5210,7 @@ void clear_extent_buffer_uptodate(struct extent_buffer *eb)unsigned long num_pages;clear_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];if (page)
@@ -5225,7 +5225,7 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)unsigned long num_pages;set_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];SetPageUptodate (page);
@@ -5249,7 +5249,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,if (test_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags))return 0 ; - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];if (wait ==WAIT_NONE ) {
@@ -5577,7 +5577,7 @@ void copy_extent_buffer_full(struct extent_buffer *dst,ASSERT (dst->len == src->len); - num_pages =num_extent_pages (dst->start, dst->len); + num_pages =num_extent_pages (dst);for (i =0 ; i < num_pages; i++)copy_page (page_address (dst->pages[i]),page_address (src->pages[i]));
fs/btrfs/extent_io.h +3 -3
@@ -440,10 +440,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, int mirror_num);void wait_on_extent_buffer_writeback (struct extent_buffer *eb); -static inline unsigned long num_extent_pages (u64 start,u64 len) +static inline unsigned long num_extent_pages (const struct extent_buffer *eb) { -return ((start + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - - (start >>PAGE_SHIFT ); +return ((eb->start + eb->len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - + (eb->start >>PAGE_SHIFT ); }static inline void extent_buffer_get (struct extent_buffer *eb)
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 6/14 btrfs: switch types to int when counting eb pages
In reply to David SterbaThe loops iterating eb pages use unsigned long, that's an overkill as we know that there are at most 16 pages (64k / 4k), and 4 by default (with nodesize 16k).
--- fs/btrfs/extent_io.c | 44 ++++++++++++++++++++++---------------------- fs/btrfs/extent_io.h | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-)
fs/btrfs/extent_io.c +22 -22
@@ -2062,7 +2062,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, int mirror_num) {u64 start = eb->start; -unsigned long i, num_pages =num_extent_pages (eb); +int i, num_pages =num_extent_pages (eb);int ret =0 ;if (sb_rdonly (fs_info->sb))
@@ -3541,7 +3541,7 @@ lock_extent_buffer_for_io(struct extent_buffer *eb,struct btrfs_fs_info *fs_info, struct extent_page_data *epd) { - unsigned long i, num_pages; + int i, num_pages;int flush =0 ;int ret =0 ;
@@ -3715,7 +3715,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,struct extent_io_tree *tree = &BTRFS_I (fs_info->btree_inode)->io_tree;u64 offset = eb->start;u32 nritems; -unsigned long i, num_pages; +int i, num_pages;unsigned long start, end;unsigned int write_flags =wbc_to_write_flags (wbc) |REQ_META ;int ret =0 ;
@@ -4644,7 +4644,7 @@ int extent_buffer_under_io(struct extent_buffer *eb)*/ static void btrfs_release_extent_buffer_page (struct extent_buffer *eb) { -unsigned long index; +int index;struct page *page;int mapped = !test_bit (EXTENT_BUFFER_DUMMY , &eb->bflags);
@@ -4740,10 +4740,10 @@ __alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start,struct extent_buffer *btrfs_clone_extent_buffer (struct extent_buffer *src) { -unsigned long i; +int i;struct page *p;struct extent_buffer *new; -unsigned long num_pages =num_extent_pages (src); +int num_pages =num_extent_pages (src); new =__alloc_extent_buffer (src->fs_info, src->start, src->len);if (new ==NULL )
@@ -4772,8 +4772,8 @@ struct extent_buffer *__alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info, u64 start, unsigned long len) {struct extent_buffer *eb; -unsigned long num_pages; -unsigned long i; +int num_pages; +int i; eb =__alloc_extent_buffer (fs_info, start, len);if (!eb)
@@ -4839,7 +4839,7 @@ static void check_buffer_tree_ref(struct extent_buffer *eb)static void mark_extent_buffer_accessed (struct extent_buffer *eb,struct page *accessed) { -unsigned long num_pages, i; +int num_pages, i;check_buffer_tree_ref (eb);
@@ -4940,8 +4940,8 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start) {unsigned long len = fs_info->nodesize; -unsigned long num_pages; -unsigned long i; +int num_pages; +int i;unsigned long index = start >>PAGE_SHIFT ;struct extent_buffer *eb;struct extent_buffer *exists =NULL ;
@@ -5156,8 +5156,8 @@ void free_extent_buffer_stale(struct extent_buffer *eb)void clear_extent_buffer_dirty (struct extent_buffer *eb) { -unsigned long i; -unsigned long num_pages; +int i; +int num_pages;struct page *page; num_pages =num_extent_pages (eb);
@@ -5186,8 +5186,8 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb)int set_extent_buffer_dirty (struct extent_buffer *eb) { -unsigned long i; -unsigned long num_pages; +int i; +int num_pages;int was_dirty =0 ;check_buffer_tree_ref (eb);
@@ -5205,9 +5205,9 @@ int set_extent_buffer_dirty(struct extent_buffer *eb)void clear_extent_buffer_uptodate (struct extent_buffer *eb) { -unsigned long i; +int i;struct page *page; -unsigned long num_pages; +int num_pages;clear_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags); num_pages =num_extent_pages (eb);
@@ -5220,9 +5220,9 @@ void clear_extent_buffer_uptodate(struct extent_buffer *eb)void set_extent_buffer_uptodate (struct extent_buffer *eb) { -unsigned long i; +int i;struct page *page; -unsigned long num_pages; +int num_pages;set_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags); num_pages =num_extent_pages (eb);
@@ -5235,13 +5235,13 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)int read_extent_buffer_pages (struct extent_io_tree *tree,struct extent_buffer *eb,int wait,int mirror_num) { -unsigned long i; +int i;struct page *page;int err;int ret =0 ;int locked_pages =0 ;int all_uptodate =1 ; -unsigned long num_pages; +int num_pages;unsigned long num_reads =0 ;struct bio *bio =NULL ;unsigned long bio_flags =0 ;
@@ -5573,7 +5573,7 @@ void copy_extent_buffer_full(struct extent_buffer *dst, struct extent_buffer *src) {int i; -unsigned num_pages; +int num_pages;ASSERT (dst->len == src->len);
fs/btrfs/extent_io.h +1 -1
@@ -440,7 +440,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, int mirror_num);void wait_on_extent_buffer_writeback (struct extent_buffer *eb); -static inline unsigned long num_extent_pages (const struct extent_buffer *eb) +static inline int num_extent_pages (const struct extent_buffer *eb) {return ((eb->start + eb->len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - (eb->start >>PAGE_SHIFT );
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 7/14 btrfs: open-code bio_set_op_attrs
In reply to David SterbaThe helper is trivial and marked as deprecated.
--- fs/btrfs/check-integrity.c | 2 +- fs/btrfs/compression.c | 4 ++-- fs/btrfs/extent_io.c | 2 +- fs/btrfs/inode.c | 2 +- fs/btrfs/raid56.c | 10 +++++----- fs/btrfs/scrub.c | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-)
fs/btrfs/check-integrity.c +1 -1
@@ -1624,7 +1624,7 @@ static int btrfsic_read_block(struct btrfsic_state *state, bio =btrfs_io_bio_alloc (num_pages - i);bio_set_dev (bio, block_ctx->dev->bdev); bio->bi_iter.bi_sector = dev_bytenr >>9 ; -bio_set_op_attrs (bio,REQ_OP_READ ,0 ); + bio->bi_opf =REQ_OP_READ ;for (j = i; j < num_pages; j++) { ret = bio_add_page(bio, block_ctx->pagev[j],
fs/btrfs/compression.c +2 -2
@@ -609,7 +609,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, cb->len = bio->bi_iter.bi_size; comp_bio =btrfs_bio_alloc (bdev, cur_disk_byte); -bio_set_op_attrs (comp_bio,REQ_OP_READ ,0 ); + comp_bio->bi_opf =REQ_OP_READ ; comp_bio->bi_private = cb; comp_bio->bi_end_io = end_compressed_bio_read;refcount_set (&cb->pending_bios,1 );
@@ -656,7 +656,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, } comp_bio =btrfs_bio_alloc (bdev, cur_disk_byte); -bio_set_op_attrs (comp_bio,REQ_OP_READ ,0 ); + comp_bio->bi_opf =REQ_OP_READ ; comp_bio->bi_private = cb; comp_bio->bi_end_io = end_compressed_bio_read;
fs/btrfs/extent_io.c +1 -1
@@ -2401,7 +2401,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, start -page_offset (page), (int )phy_offset, failed_bio->bi_end_io, NULL); -bio_set_op_attrs (bio,REQ_OP_READ , read_mode); + bio->bi_opf =REQ_OP_READ | read_mode; btrfs_debug(btrfs_sb(inode->i_sb), "Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d",
fs/btrfs/inode.c +1 -1
@@ -7861,7 +7861,7 @@ static blk_status_t dio_read_error(struct inode *inode, struct bio *failed_bio, isector >>= inode->i_sb->s_blocksize_bits; bio =btrfs_create_repair_bio (inode, failed_bio, failrec, page, pgoff, isector, repair_endio, repair_arg); -bio_set_op_attrs (bio,REQ_OP_READ , read_mode); + bio->bi_opf =REQ_OP_READ | read_mode; btrfs_debug(BTRFS_I(inode)->root->fs_info, "repair DIO read error: submitting new dio read[%#x] to this_mirror=%d, in_validation=%d",
fs/btrfs/raid56.c +5 -5
@@ -1330,7 +1330,7 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio) bio->bi_private = rbio; bio->bi_end_io = raid_write_end_io; -bio_set_op_attrs (bio,REQ_OP_WRITE ,0 ); + bio->bi_opf =REQ_OP_WRITE ;submit_bio (bio); }
@@ -1586,7 +1586,7 @@ static int raid56_rmw_stripe(struct btrfs_raid_bio *rbio) bio->bi_private = rbio; bio->bi_end_io = raid_rmw_end_io; -bio_set_op_attrs (bio,REQ_OP_READ ,0 ); + bio->bi_opf =REQ_OP_READ ;btrfs_bio_wq_end_io (rbio->fs_info, bio,BTRFS_WQ_ENDIO_RAID56 );
@@ -2130,7 +2130,7 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio) bio->bi_private = rbio; bio->bi_end_io = raid_recover_end_io; -bio_set_op_attrs (bio,REQ_OP_READ ,0 ); + bio->bi_opf =REQ_OP_READ ;btrfs_bio_wq_end_io (rbio->fs_info, bio,BTRFS_WQ_ENDIO_RAID56 );
@@ -2502,7 +2502,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, bio->bi_private = rbio; bio->bi_end_io = raid_write_end_io; -bio_set_op_attrs (bio,REQ_OP_WRITE ,0 ); + bio->bi_opf =REQ_OP_WRITE ;submit_bio (bio); }
@@ -2684,7 +2684,7 @@ static void raid56_parity_scrub_stripe(struct btrfs_raid_bio *rbio) bio->bi_private = rbio; bio->bi_end_io = raid56_parity_scrub_end_io; -bio_set_op_attrs (bio,REQ_OP_READ ,0 ); + bio->bi_opf =REQ_OP_READ ;btrfs_bio_wq_end_io (rbio->fs_info, bio,BTRFS_WQ_ENDIO_RAID56 );
fs/btrfs/scrub.c +3 -3
@@ -1865,7 +1865,7 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, bio =btrfs_io_bio_alloc (1 );bio_set_dev (bio, page_bad->dev->bdev); bio->bi_iter.bi_sector = page_bad->physical >>9 ; -bio_set_op_attrs (bio,REQ_OP_WRITE ,0 ); + bio->bi_opf =REQ_OP_WRITE ; ret =bio_add_page (bio, page_good->page,PAGE_SIZE ,0 );if (PAGE_SIZE != ret) {
@@ -1960,7 +1960,7 @@ static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, bio->bi_end_io = scrub_wr_bio_end_io;bio_set_dev (bio, sbio->dev->bdev); bio->bi_iter.bi_sector = sbio->physical >>9 ; -bio_set_op_attrs (bio,REQ_OP_WRITE ,0 ); + bio->bi_opf =REQ_OP_WRITE ; sbio->status =0 ; } else if (sbio->physical + sbio->page_count * PAGE_SIZE != spage->physical_for_dev_replace ||
@@ -2360,7 +2360,7 @@ static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx, bio->bi_end_io = scrub_bio_end_io;bio_set_dev (bio, sbio->dev->bdev); bio->bi_iter.bi_sector = sbio->physical >>9 ; -bio_set_op_attrs (bio,REQ_OP_READ ,0 ); + bio->bi_opf =REQ_OP_READ ; sbio->status =0 ; } else if (sbio->physical + sbio->page_count * PAGE_SIZE != spage->physical ||
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 8/14 btrfs: raid56: add new helper for starting async work
In reply to David SterbaAdd helper that schedules a given function to run on the rmw workqueue. This will replace several standalone helpers.
--- fs/btrfs/raid56.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/raid56.c +6 -0
@@ -174,6 +174,12 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, int need_check);static void async_scrub_parity (struct btrfs_raid_bio *rbio); +static void start_async_work (struct btrfs_raid_bio *rbio,btrfs_func_t work_func) +{ +btrfs_init_work (&rbio->work, btrfs_rmw_helper, work_func,NULL ,NULL ); +btrfs_queue_work (rbio->fs_info->rmw_workers, &rbio->work); +} +/* * the stripe hash table is used for locking, and to collect * bios in hopes of making a full stripe
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 9/14 btrfs: raid56: use new helper for async_rmw_stripe
In reply to David Sterba--- fs/btrfs/raid56.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
fs/btrfs/raid56.c +2 -9
@@ -162,7 +162,6 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio); static noinline void finish_rmw(struct btrfs_raid_bio *rbio);static void rmw_work (struct btrfs_work *work);static void read_rebuild_work (struct btrfs_work *work); -static void async_rmw_stripe (struct btrfs_raid_bio *rbio);static void async_read_rebuild (struct btrfs_raid_bio *rbio);static int fail_bio_stripe (struct btrfs_raid_bio *rbio,struct bio *bio);static int fail_rbio_index (struct btrfs_raid_bio *rbio,int failed);
@@ -811,7 +810,7 @@ static noinline void unlock_stripe(struct btrfs_raid_bio *rbio)async_read_rebuild (next); }else if (next->operation ==BTRFS_RBIO_WRITE ) {steal_rbio (rbio, next); -async_rmw_stripe (next); +start_async_work (next, rmw_work); }else if (next->operation ==BTRFS_RBIO_PARITY_SCRUB ) {steal_rbio (rbio, next);async_scrub_parity (next);
@@ -1501,12 +1500,6 @@ static void raid_rmw_end_io(struct bio *bio)rbio_orig_end_io (rbio,BLK_STS_IOERR ); } -static void async_rmw_stripe (struct btrfs_raid_bio *rbio) -{ -btrfs_init_work (&rbio->work, btrfs_rmw_helper, rmw_work,NULL ,NULL ); -btrfs_queue_work (rbio->fs_info->rmw_workers, &rbio->work); -} -static void async_read_rebuild (struct btrfs_raid_bio *rbio) { btrfs_init_work(&rbio->work, btrfs_rmw_helper,
@@ -1645,7 +1638,7 @@ static int partial_stripe_write(struct btrfs_raid_bio *rbio) ret =lock_stripe_add (rbio);if (ret ==0 ) -async_rmw_stripe (rbio); +start_async_work (rbio, rmw_work);return 0 ; }
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 10/14 btrfs: raid56: use new helper for async_read_rebuild
In reply to David Sterba--- fs/btrfs/raid56.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
fs/btrfs/raid56.c +3 -12
@@ -162,7 +162,6 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio); static noinline void finish_rmw(struct btrfs_raid_bio *rbio);static void rmw_work (struct btrfs_work *work);static void read_rebuild_work (struct btrfs_work *work); -static void async_read_rebuild (struct btrfs_raid_bio *rbio);static int fail_bio_stripe (struct btrfs_raid_bio *rbio,struct bio *bio);static int fail_rbio_index (struct btrfs_raid_bio *rbio,int failed);static void __free_raid_bio (struct btrfs_raid_bio *rbio);
@@ -804,10 +803,10 @@ static noinline void unlock_stripe(struct btrfs_raid_bio *rbio)spin_unlock_irqrestore (&h->lock, flags);if (next->operation ==BTRFS_RBIO_READ_REBUILD ) -async_read_rebuild (next); +start_async_work (next, read_rebuild_work);else if (next->operation ==BTRFS_RBIO_REBUILD_MISSING ) {steal_rbio (rbio, next); -async_read_rebuild (next); +start_async_work (next, read_rebuild_work); }else if (next->operation ==BTRFS_RBIO_WRITE ) {steal_rbio (rbio, next);start_async_work (next, rmw_work);
@@ -1500,14 +1499,6 @@ static void raid_rmw_end_io(struct bio *bio)rbio_orig_end_io (rbio,BLK_STS_IOERR ); } -static void async_read_rebuild (struct btrfs_raid_bio *rbio) -{ -btrfs_init_work (&rbio->work, btrfs_rmw_helper, - read_rebuild_work,NULL ,NULL ); - -btrfs_queue_work (rbio->fs_info->rmw_workers, &rbio->work); -} -/* * the stripe must be locked by the caller. It will * unlock after all the writes are done
@@ -2765,5 +2756,5 @@ raid56_alloc_missing_rbio(struct btrfs_fs_info *fs_info, struct bio *bio,void raid56_submit_missing_rbio (struct btrfs_raid_bio *rbio) {if (!lock_stripe_add (rbio)) -async_read_rebuild (rbio); +start_async_work (rbio, read_rebuild_work); }
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 11/14 btrfs: raid56: use new helper for async_scrub_parity
In reply to David Sterba--- fs/btrfs/raid56.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
fs/btrfs/raid56.c +3 -11
@@ -170,7 +170,7 @@ static int alloc_rbio_pages(struct btrfs_raid_bio *rbio); static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,int need_check); -static void async_scrub_parity (struct btrfs_raid_bio *rbio); +static void scrub_parity_work (struct btrfs_work *work);static void start_async_work (struct btrfs_raid_bio *rbio,btrfs_func_t work_func) {
@@ -812,7 +812,7 @@ static noinline void unlock_stripe(struct btrfs_raid_bio *rbio)start_async_work (next, rmw_work); }else if (next->operation ==BTRFS_RBIO_PARITY_SCRUB ) {steal_rbio (rbio, next); -async_scrub_parity (next); +start_async_work (next, scrub_parity_work); } goto done_nolock;
@@ -2703,18 +2703,10 @@ static void scrub_parity_work(struct btrfs_work *work)raid56_parity_scrub_stripe (rbio); } -static void async_scrub_parity (struct btrfs_raid_bio *rbio) -{ -btrfs_init_work (&rbio->work, btrfs_rmw_helper, - scrub_parity_work,NULL ,NULL ); - -btrfs_queue_work (rbio->fs_info->rmw_workers, &rbio->work); -} -void raid56_parity_submit_scrub_rbio (struct btrfs_raid_bio *rbio) {if (!lock_stripe_add (rbio)) -async_scrub_parity (rbio); +start_async_work (rbio, scrub_parity_work); }/* The following code is used for dev replace of a missing RAID 5/6 device. */
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 12/14 btrfs: raid56: merge rbio_is_full helpers
In reply to David SterbaThere's only one call site of the unlocked helper so it can be folded into the caller.
--- fs/btrfs/raid56.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
fs/btrfs/raid56.c +6 -17
@@ -507,32 +507,21 @@ static void run_xor(void **pages, int src_cnt, ssize_t len) }/* -* returns true if the bio list inside this rbio -* covers an entire stripe (no rmw required). -* Must be called with the bio list lock held, or -* at a time when you know it is impossible to add -* new bios into the list +* Returns true if the bio list inside this rbio covers an entire stripe (no +* rmw required). */ -static int __rbio_is_full (struct btrfs_raid_bio *rbio) +static int rbio_is_full (struct btrfs_raid_bio *rbio) { +unsigned long flags;unsigned long size = rbio->bio_list_bytes;int ret =1 ; +spin_lock_irqsave (&rbio->bio_list_lock, flags);if (size != rbio->nr_data * rbio->stripe_len) ret =0 ; -BUG_ON (size > rbio->nr_data * rbio->stripe_len); -return ret; -} - -static int rbio_is_full (struct btrfs_raid_bio *rbio) -{ -unsigned long flags; -int ret; - -spin_lock_irqsave (&rbio->bio_list_lock, flags); - ret =__rbio_is_full (rbio);spin_unlock_irqrestore (&rbio->bio_list_lock, flags); +return ret; }
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 13/14 btrfs: raid56: don't lock stripe cache table when freeing
In reply to David SterbaThis is called either at the end of the mount or if the mount fails. In both cases, there's nothing running that can use the table so the lock is pointless.
--- fs/btrfs/raid56.c | 3 --- 1 file changed, 3 deletions(-)
fs/btrfs/raid56.c +0 -3
@@ -407,19 +407,16 @@ static void remove_rbio_from_cache(struct btrfs_raid_bio *rbio)static void btrfs_clear_rbio_cache (struct btrfs_fs_info *info) {struct btrfs_stripe_hash_table *table; -unsigned long flags;struct btrfs_raid_bio *rbio; table = info->stripe_hash_table; -spin_lock_irqsave (&table->cache_lock, flags);while (!list_empty (&table->stripe_cache)) { rbio =list_entry (table->stripe_cache.next, struct btrfs_raid_bio, stripe_cache);__remove_rbio_from_cache (rbio); } -spin_unlock_irqrestore (&table->cache_lock, flags); }/*
Signature · 1 line
2.17.1
David Sterba
maintainerPATCH 14/14 btrfs: raid56: catch errors from full_stripe_write
In reply to David SterbaAdd fall-back code to catch failure of full_stripe_write. Proper error handling from inside run_plug would need more code restructuring as it's called at arbitrary points by io scheduler.
--- fs/btrfs/raid56.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/btrfs/raid56.c +4 -1
@@ -1683,8 +1683,11 @@ static void run_plug(struct btrfs_plug_cb *plug)list_del_init (&cur->plug_list);if (rbio_is_full (cur)) { +int ret; +/* we have a full stripe, send it down */ -full_stripe_write (cur); + ret =full_stripe_write (cur); +BUG_ON (ret);continue ; }if (last) {
Signature · 1 line
2.17.1
Re: [PATCH 05/14] btrfs: pass only eb to num_extent_pages
In reply to David SterbaQuoted 160 lines · David Sterba
Almost all callers pass the start and len as 2 arguments but this is not necessary, all the information is provided by the eb. By reordering the calls to
num_extent_pages, we don't need the local variables with start/len.Reviewed-by Nikolay Borisov <[email protected]>Signed-off-by David Sterba <[email protected]>--- fs/btrfs/extent_io.c | 30 +++++++++++++++--------------- fs/btrfs/extent_io.h | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-)fs/btrfs/extent_io.c +15
-15@@ -2062,7 +2062,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, int mirror_num) {u64 start = eb->start; -unsigned long i, num_pages =num_extent_pages (eb->start, eb->len); +unsigned long i, num_pages =num_extent_pages (eb);int ret =0 ;if (sb_rdonly (fs_info->sb))@@ -3591,7 +3591,7 @@ lock_extent_buffer_for_io(struct extent_buffer *eb,if (!ret)return ret; - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) {struct page *p = eb->pages[i];@@ -3721,7 +3721,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,int ret =0 ;clear_bit (EXTENT_BUFFER_WRITE_ERR , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);atomic_set (&eb->io_pages, num_pages);/* set btree blocks beyond nritems with 0 to avoid stale content. */ @@ -4650,7 +4650,7 @@ static void btrfs_release_extent_buffer_page(struct extent_buffer *eb)BUG_ON (extent_buffer_under_io (eb)); - index =num_extent_pages (eb->start, eb->len); + index =num_extent_pages (eb);if (index ==0 )return ;@@ -4743,7 +4743,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)unsigned long i;struct page *p;struct extent_buffer *new; -unsigned long num_pages =num_extent_pages (src->start, src->len); +unsigned long num_pages =num_extent_pages (src); new =__alloc_extent_buffer (src->fs_info, src->start, src->len);if (new ==NULL )@@ -4775,12 +4775,11 @@ struct extent_buffer *__alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,unsigned long num_pages;unsigned long i; - num_pages =num_extent_pages (start, len); - eb =__alloc_extent_buffer (fs_info, start, len);if (!eb)return NULL ; + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { eb->pages[i] =alloc_page (GFP_NOFS );if (!eb->pages[i])@@ -4844,7 +4843,7 @@ static void mark_extent_buffer_accessed(struct extent_buffer *eb,check_buffer_tree_ref (eb); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) {struct page *p = eb->pages[i];@@ -4941,7 +4940,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start) {unsigned long len = fs_info->nodesize; -unsigned long num_pages =num_extent_pages (start, len); +unsigned long num_pages;unsigned long i;unsigned long index = start >>PAGE_SHIFT ;struct extent_buffer *eb;@@ -4964,6 +4963,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,if (!eb)return ERR_PTR (-ENOMEM ); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++, index++) { p =find_or_create_page (mapping, index,GFP_NOFS |__GFP_NOFAIL);if (!p) {@@ -5160,7 +5160,7 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb)unsigned long num_pages;struct page *page; - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];@@ -5194,7 +5194,7 @@ int set_extent_buffer_dirty(struct extent_buffer *eb) was_dirty =test_and_set_bit (EXTENT_BUFFER_DIRTY , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);WARN_ON (atomic_read (&eb->refs) ==0 );WARN_ON (!test_bit (EXTENT_BUFFER_TREE_REF , &eb->bflags));@@ -5210,7 +5210,7 @@ void clear_extent_buffer_uptodate(struct extent_buffer *eb)unsigned long num_pages;clear_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];if (page)@@ -5225,7 +5225,7 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)unsigned long num_pages;set_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags); - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];SetPageUptodate (page);@@ -5249,7 +5249,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,if (test_bit (EXTENT_BUFFER_UPTODATE , &eb->bflags))return 0 ; - num_pages =num_extent_pages (eb->start, eb->len); + num_pages =num_extent_pages (eb);for (i =0 ; i < num_pages; i++) { page = eb->pages[i];if (wait ==WAIT_NONE ) {@@ -5577,7 +5577,7 @@ void copy_extent_buffer_full(struct extent_buffer *dst,ASSERT (dst->len == src->len); - num_pages =num_extent_pages (dst->start, dst->len); + num_pages =num_extent_pages (dst);for (i =0 ; i < num_pages; i++)copy_page (page_address (dst->pages[i]),page_address (src->pages[i]));fs/btrfs/extent_io.h +0
-0
fs/btrfs/extent_io.h int read_extent_buffer_pages(struct extent_io_tree *tree, · line 446
Quoted 10 lines
fs/btrfs/extent_io.h +3
-3@@ -440,10 +440,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, int mirror_num);void wait_on_extent_buffer_writeback (struct extent_buffer *eb); -static inline unsigned long num_extent_pages (u64 start,u64 len) +static inline unsigned long num_extent_pages (const struct extent_buffer *eb) { -return ((start + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - - (start >>PAGE_SHIFT ); +return ((eb->start + eb->len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - + (eb->start >>PAGE_SHIFT );
This is a good opportunity to eliminate the open-coded round_up:
round_up(eb->start + eb->len, PAGE_SIZE)
Quoted 4 lines
fs/btrfs/extent_io.h +0
-0}static inline void extent_buffer_get (struct extent_buffer *eb)
Re: [PATCH 05/14] btrfs: pass only eb to num_extent_pages
Quoted 21 lines · Nikolay Borisov
Quoted 8 lines
fs/btrfs/extent_io.c +0
-0for (i =0 ; i < num_pages; i++)copy_page (page_address (dst->pages[i]),page_address (src->pages[i]));fs/btrfs/extent_io.h +0
-0fs/btrfs/extent_io.h int read_extent_buffer_pages(struct extent_io_tree *tree, · line 446
Quoted 10 lines
fs/btrfs/extent_io.h +3
-3@@ -440,10 +440,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, int mirror_num);void wait_on_extent_buffer_writeback (struct extent_buffer *eb); -static inline unsigned long num_extent_pages (u64 start,u64 len) +static inline unsigned long num_extent_pages (const struct extent_buffer *eb) { -return ((start + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - - (start >>PAGE_SHIFT ); +return ((eb->start + eb->len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - + (eb->start >>PAGE_SHIFT );This is a good opportunity to eliminate the open-coded
round_up:
Quoted 1 line
round_up(eb->start + eb->len, PAGE_SIZE)
Ok, I'll add this patch:
@@ -442,8 +442,8 @@ void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
static inline int num_extent_pages(const struct extent_buffer *eb) {
- return ((eb->start + eb->len + PAGE_SIZE - 1) >> PAGE_SHIFT) -
- (eb->start >> PAGE_SHIFT);
+ return (round_up(eb->start + eb->len, PAGE_SIZE) >> PAGE_SHIFT) -
+ (eb->start >> PAGE_SHIFT);
}
static inline void extent_buffer_get(struct extent_buffer *eb)
Re: [PATCH 05/14] btrfs: pass only eb to num_extent_pages
Quoted 27 lines · David Sterba
Quoted 21 lines · Nikolay Borisov
Quoted 8 lines
fs/btrfs/extent_io.c +0
-0for (i =0 ; i < num_pages; i++)copy_page (page_address (dst->pages[i]),page_address (src->pages[i]));fs/btrfs/extent_io.h +0
-0fs/btrfs/extent_io.h int read_extent_buffer_pages(struct extent_io_tree *tree, · line 446
Quoted 10 lines
fs/btrfs/extent_io.h +3
-3@@ -440,10 +440,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, int mirror_num);void wait_on_extent_buffer_writeback (struct extent_buffer *eb); -static inline unsigned long num_extent_pages (u64 start,u64 len) +static inline unsigned long num_extent_pages (const struct extent_buffer *eb) { -return ((start + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - - (start >>PAGE_SHIFT ); +return ((eb->start + eb->len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - + (eb->start >>PAGE_SHIFT );This is a good opportunity to eliminate the open-coded
round_up:Quoted 1 line
round_up(eb->start + eb->len, PAGE_SIZE)Ok, I'll add this patch:
fs/btrfs/extent_io.h void wait_on_extent_buffer_writeback(struct extent_buffer *eb); · line 447
Quoted 8 lines
fs/btrfs/extent_io.h +2
-2@@ -442,8 +442,8 @@ void wait_on_extent_buffer_writeback(struct extent_buffer *eb);static inline int num_extent_pages (const struct extent_buffer *eb) { -return ((eb->start + eb->len +PAGE_SIZE -1 ) >>PAGE_SHIFT ) - - (eb->start >>PAGE_SHIFT ); +return (round_up (eb->start + eb->len,PAGE_SIZE ) >>PAGE_SHIFT ) - + (eb->start >>PAGE_SHIFT ); }
LGTM
Quoted 7 lines
(quoted diff) +0
-1static inline void extent_buffer_get(struct extent_buffer *eb) --To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/14] btrfs: raid56: don't lock stripe cache table when freeing
In reply to David SterbaQuoted 3 lines · David Sterba
This is called either at the end of the mount or if the mount fails. In both cases, there's nothing running that can use the table so the lock is pointless.
And then lockdep says no. The umount path frees the table but there's some unfinished bio that wants to use the table from the interrupt context. And this is puzzling, there should be no IO in flight, all workers should be stopped.
btrfs/011:
[ 1339.169842] ================================
[ 1339.171891] WARNING: inconsistent lock state
[ 1339.173724] 4.17.0-rc7-default+ #168 Not tainted
[ 1339.175661] --------------------------------
[ 1339.177479] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
[ 1339.179758] umount/4029 [HC0[0]:SC0[0]:HE1:SE1] takes:
[ 1339.182008] 0000000096eee2cd (&(&cur->lock)->rlock){?.-.}, at: __remove_rbio_from_cache+0x5f/0x140 [btrfs]
[ 1339.183982] {IN-HARDIRQ-W} state was registered at:
[ 1339.184819] _raw_spin_lock_irqsave+0x43/0x52
[ 1339.185433] unlock_stripe+0x78/0x3d0 [btrfs]
[ 1339.186041] rbio_orig_end_io+0x41/0xd0 [btrfs]
[ 1339.186648] blk_update_request+0xd7/0x330
[ 1339.187205] blk_mq_end_request+0x18/0x70
[ 1339.187752] flush_smp_call_function_queue+0x83/0x120
[ 1339.188405] smp_call_function_single_interrupt+0x43/0x270
[ 1339.189094] call_function_single_interrupt+0xf/0x20
[ 1339.189733] native_safe_halt+0x2/0x10
[ 1339.190255] default_idle+0x1f/0x190
[ 1339.190759] do_idle+0x217/0x240
[ 1339.191229] cpu_startup_entry+0x6f/0x80
[ 1339.191768] start_secondary+0x192/0x1e0
[ 1339.192385] secondary_startup_64+0xa5/0xb0
[ 1339.193145] irq event stamp: 783817
[ 1339.193701] hardirqs last enabled at (783817): [<ffffffff8267234d>] _raw_spin_unlock_irqrestore+0x4d/0x60
[ 1339.194896] hardirqs last disabled at (783816): [<ffffffff82672a10>] _raw_spin_lock_irqsave+0x20/0x52
[ 1339.196010] softirqs last enabled at (777902): [<ffffffff82a00397>] __do_softirq+0x397/0x502
[ 1339.197435] softirqs last disabled at (777879): [<ffffffff82066311>] irq_exit+0xc1/0xd0
[ 1339.198797]
[ 1339.198797] other info that might help us debug this:
[ 1339.200011] Possible unsafe locking scenario:
[ 1339.200011]
[ 1339.201066] CPU0
[ 1339.201464] ----
[ 1339.201845] lock(&(&cur->lock)->rlock);
[ 1339.202372] <Interrupt>
[ 1339.202768] lock(&(&cur->lock)->rlock);
[ 1339.203313]
[ 1339.203313] *** DEADLOCK ***
[ 1339.203313]
[ 1339.204215] 1 lock held by umount/4029:
[ 1339.204727] #0: 000000007c3dd992 (&type->s_umount_key#26){++++}, at: deactivate_super+0x43/0x50
[ 1339.205822]
[ 1339.205822] stack backtrace:
[ 1339.206660] CPU: 2 PID: 4029 Comm: umount Not tainted 4.17.0-rc7-default+ #168
[ 1339.207875] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
[ 1339.209357] Call Trace:
[ 1339.209742] dump_stack+0x85/0xc0
[ 1339.210204] print_usage_bug.cold.57+0x1aa/0x1e4
[ 1339.210790] ? print_shortest_lock_dependencies+0x40/0x40
[ 1339.211680] mark_lock+0x530/0x630
[ 1339.212291] ? print_shortest_lock_dependencies+0x40/0x40
[ 1339.213180] __lock_acquire+0x549/0xf60
[ 1339.213855] ? flush_work+0x24a/0x280
[ 1339.214485] ? __lock_is_held+0x4f/0x90
[ 1339.215176] lock_acquire+0x9e/0x1d0
[ 1339.215850] ? __remove_rbio_from_cache+0x5f/0x140 [btrfs]
[ 1339.216755] _raw_spin_lock+0x2c/0x40
[ 1339.217303] ? __remove_rbio_from_cache+0x5f/0x140 [btrfs]
[ 1339.218005] __remove_rbio_from_cache+0x5f/0x140 [btrfs]
[ 1339.218687] btrfs_free_stripe_hash_table+0x2a/0x50 [btrfs]
[ 1339.219393] close_ctree+0x1d7/0x330 [btrfs]
[ 1339.219961] generic_shutdown_super+0x64/0x100
[ 1339.220659] kill_anon_super+0xe/0x20
[ 1339.221245] btrfs_kill_super+0x12/0xa0 [btrfs]
[ 1339.221840] deactivate_locked_super+0x29/0x60
[ 1339.222416] cleanup_mnt+0x3b/0x70
[ 1339.222892] task_work_run+0x9b/0xd0
[ 1339.223388] exit_to_usermode_loop+0x99/0xa0
[ 1339.223949] do_syscall_64+0x16c/0x170
[ 1339.224603] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1339.225457] RIP: 0033:0x7ffb9180d017
[ 1339.226063] RSP: 002b:00007fff9cb72a28 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
[ 1339.227289] RAX: 0000000000000000 RBX: 000055b804721970 RCX: 00007ffb9180d017
[ 1339.228373] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000055b804721b50
[ 1339.229451] RBP: 0000000000000000 R08: 000055b804721b70 R09: 00007fff9cb71290
[ 1339.230524] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffb91d291c4
[ 1339.231604] R13: 000055b804721b50 R14: 0000000000000000 R15: 00007fff9cb72c98