From: Chris Mason Date: Tue, 13 Dec 2016 17:14:42 +0000 (-0800) Subject: Merge branch 'for-chris-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/fdmana... X-Git-Tag: v5.15~11938^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f52a2c512a55500349aa261e469d099ede0f256;p=platform%2Fkernel%2Flinux-starfive.git Merge branch 'for-chris-4.10' of git://git./linux/kernel/git/fdmanana/linux into for-linus-4.10 Patches queued up by Filipe: The most important change is still the fix for the extent tree corruption that happens due to balance when qgroups are enabled (a regression introduced in 4.7 by a fix for a regression from the last qgroups rework). This has been hitting SLE and openSUSE users and QA very badly, where transactions keep getting aborted when running delayed references leaving the root filesystem in RO mode and nearly unusable. There are fixes here that allow us to run xfstests again with the integrity checker enabled, which has been impossible since 4.8 (apparently I'm the only one running xfstests with the integrity checker enabled, which is useful to validate dirtied leafs, like checking if there are keys out of order, etc). The rest are just some trivial fixes, most of them tagged for stable, and two cleanups. Signed-off-by: Chris Mason --- 5f52a2c512a55500349aa261e469d099ede0f256 diff --cc fs/btrfs/delayed-ref.h index dba9784,a72fbe7..50947b5 --- a/fs/btrfs/delayed-ref.h +++ b/fs/btrfs/delayed-ref.h @@@ -34,20 -34,8 +34,14 @@@ * ref_head. Must clean this mess up later. */ struct btrfs_delayed_ref_node { - /* - * ref_head use rb tree, stored in ref_root->href. - * indexed by bytenr - */ - struct rb_node rb_node; - /*data/tree ref use list, stored in ref_head->ref_list. */ struct list_head list; + /* + * If action is BTRFS_ADD_DELAYED_REF, also link this node to + * ref_head->ref_add_list, then we do not need to iterate the + * whole ref_head->ref_list to find BTRFS_ADD_DELAYED_REF nodes. + */ + struct list_head add_list; /* the starting bytenr of the extent */ u64 bytenr; diff --cc fs/btrfs/disk-io.c index 848d5e1,1cd3257..066d9b9 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@@ -584,9 -595,12 +596,12 @@@ static noinline int check_leaf(struct b return 0; } + if (nritems == 0) + return 0; + /* Check the 0 item */ if (btrfs_item_offset_nr(leaf, 0) + btrfs_item_size_nr(leaf, 0) != - BTRFS_LEAF_DATA_SIZE(root)) { + BTRFS_LEAF_DATA_SIZE(fs_info)) { CORRUPT("invalid item offset size pair", leaf, root, 0); return -EIO; } diff --cc fs/btrfs/file.c index 140271b,4129de5..448f57d --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@@ -2372,7 -2347,7 +2372,7 @@@ static int btrfs_punch_hole(struct inod u64 tail_len; u64 orig_start = offset; u64 cur_offset; - u64 min_size = btrfs_calc_trunc_metadata_size(fs_info, 1); - u64 min_size = btrfs_calc_trans_metadata_size(root, 1); ++ u64 min_size = btrfs_calc_trans_metadata_size(fs_info, 1); u64 drop_end; int ret = 0; int err = 0; @@@ -2519,7 -2494,7 +2519,7 @@@ ret = -ENOMEM; goto out_free; } - rsv->size = btrfs_calc_trunc_metadata_size(fs_info, 1); - rsv->size = btrfs_calc_trans_metadata_size(root, 1); ++ rsv->size = btrfs_calc_trans_metadata_size(fs_info, 1); rsv->failfast = 1; /* diff --cc fs/btrfs/relocation.c index 5d222c8,e1bc12f..3797110 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@@ -2403,12 -2370,8 +2404,9 @@@ void free_reloc_roots(struct list_head static noinline_for_stack void merge_reloc_roots(struct reloc_control *rc) { + struct btrfs_fs_info *fs_info = rc->extent_root->fs_info; struct btrfs_root *root; struct btrfs_root *reloc_root; - u64 last_snap; - u64 otransid; - u64 objectid; LIST_HEAD(reloc_roots); int found = 0; int ret = 0; diff --cc fs/btrfs/tree-log.c index f732418,7f3a080..f10bf52 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@@ -5224,7 -5204,9 +5223,8 @@@ process_leaf if (di_key.type == BTRFS_ROOT_ITEM_KEY) continue; + btrfs_release_path(path); - di_inode = btrfs_iget(root->fs_info->sb, &di_key, - root, NULL); + di_inode = btrfs_iget(fs_info->sb, &di_key, root, NULL); if (IS_ERR(di_inode)) { ret = PTR_ERR(di_inode); goto next_dir_inode;