tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.mkdir head: c11d902d3db0ab337cb8181e9aa73d5d162dc234 commit: 4ee670e76f2351b1199207abd74d7d8e35312541 [14/16] btrfs: simplify btrfs_iget() config: m68k-sun3_defconfig (attached as .config) compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 4ee670e76f2351b1199207abd74d7d8e35312541 # save the attached .config to linux build tree GCC_VERSION=7.2.0 make.cross ARCH=m68k All errors (new ones prefixed by >>): In file included from include/linux/highmem.h:5:0, from include/linux/bio.h:21, from fs/btrfs/inode.c:7: include/linux/fs.h: In function 'inode_fake_hash': include/linux/fs.h:695:9: error: void value not ignored as it ought to be return hlist_add_fake(&inode->i_hash); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/btrfs/inode.c: In function 'btrfs_read_locked_inode': >> fs/btrfs/inode.c:3775:1: error: label at end of compound statement make_bad: ^~~~~~~~ fs/btrfs/inode.c:3775:1: warning: label 'make_bad' defined but not used [-Wunused-label] vim +3775 fs/btrfs/inode.c 46a53cca8 Chris Mason 2009-04-27 3589 46a53cca8 Chris Mason 2009-04-27 3590 /* d352ac681 Chris Mason 2008-09-29 3591 * read an inode from the btree into the in-memory inode d352ac681 Chris Mason 2008-09-29 3592 */ 67710892e Filipe Manana 2016-06-06 3593 static int btrfs_read_locked_inode(struct inode *inode) 39279cc3d Chris Mason 2007-06-12 3594 { 0b246afa6 Jeff Mahoney 2016-06-22 3595 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); 39279cc3d Chris Mason 2007-06-12 3596 struct btrfs_path *path; 5f39d397d Chris Mason 2007-10-15 3597 struct extent_buffer *leaf; 39279cc3d Chris Mason 2007-06-12 3598 struct btrfs_inode_item *inode_item; 39279cc3d Chris Mason 2007-06-12 3599 struct btrfs_root *root = BTRFS_I(inode)->root; 39279cc3d Chris Mason 2007-06-12 3600 struct btrfs_key location; 67de11769 Miao Xie 2013-12-26 3601 unsigned long ptr; 46a53cca8 Chris Mason 2009-04-27 3602 int maybe_acls; 618e21d59 Josef Bacik 2007-07-11 3603 u32 rdev; 39279cc3d Chris Mason 2007-06-12 3604 int ret; 2f7e33d43 Miao Xie 2011-06-23 3605 bool filled = false; 63541927c Filipe David Borba Manana 2014-01-07 3606 int first_xattr_slot; 2f7e33d43 Miao Xie 2011-06-23 3607 2f7e33d43 Miao Xie 2011-06-23 3608 ret = btrfs_fill_inode(inode, &rdev); 2f7e33d43 Miao Xie 2011-06-23 3609 if (!ret) 2f7e33d43 Miao Xie 2011-06-23 3610 filled = true; 39279cc3d Chris Mason 2007-06-12 3611 39279cc3d Chris Mason 2007-06-12 3612 path = btrfs_alloc_path(); 4ee670e76 Al Viro 2018-06-30 3613 if (!path) 4ee670e76 Al Viro 2018-06-30 3614 return -ENOMEM; 1748f843a Mark Fasheh 2011-07-12 3615 39279cc3d Chris Mason 2007-06-12 3616 memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); dc17ff8f1 Chris Mason 2008-01-08 3617 39279cc3d Chris Mason 2007-06-12 3618 ret = btrfs_lookup_inode(NULL, root, path, &location, 0); 67710892e Filipe Manana 2016-06-06 3619 if (ret) { 4ee670e76 Al Viro 2018-06-30 3620 btrfs_free_path(path); 4ee670e76 Al Viro 2018-06-30 3621 return ret; 67710892e Filipe Manana 2016-06-06 3622 } 5f39d397d Chris Mason 2007-10-15 3623 5f39d397d Chris Mason 2007-10-15 3624 leaf = path->nodes[0]; 2f7e33d43 Miao Xie 2011-06-23 3625 2f7e33d43 Miao Xie 2011-06-23 3626 if (filled) 67de11769 Miao Xie 2013-12-26 3627 goto cache_index; 2f7e33d43 Miao Xie 2011-06-23 3628 5f39d397d Chris Mason 2007-10-15 3629 inode_item = btrfs_item_ptr(leaf, path->slots[0], 39279cc3d Chris Mason 2007-06-12 3630 struct btrfs_inode_item); 5f39d397d Chris Mason 2007-10-15 3631 inode->i_mode = btrfs_inode_mode(leaf, inode_item); bfe868486 Miklos Szeredi 2011-10-28 3632 set_nlink(inode, btrfs_inode_nlink(leaf, inode_item)); 2f2f43d3c Eric W. Biederman 2012-02-10 3633 i_uid_write(inode, btrfs_inode_uid(leaf, inode_item)); 2f2f43d3c Eric W. Biederman 2012-02-10 3634 i_gid_write(inode, btrfs_inode_gid(leaf, inode_item)); 6ef06d279 Nikolay Borisov 2017-02-20 3635 btrfs_i_size_write(BTRFS_I(inode), btrfs_inode_size(leaf, inode_item)); 5f39d397d Chris Mason 2007-10-15 3636 a937b9791 David Sterba 2014-12-12 3637 inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->atime); a937b9791 David Sterba 2014-12-12 3638 inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->atime); 5f39d397d Chris Mason 2007-10-15 3639 a937b9791 David Sterba 2014-12-12 3640 inode->i_mtime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->mtime); a937b9791 David Sterba 2014-12-12 3641 inode->i_mtime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->mtime); 5f39d397d Chris Mason 2007-10-15 3642 a937b9791 David Sterba 2014-12-12 3643 inode->i_ctime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->ctime); a937b9791 David Sterba 2014-12-12 3644 inode->i_ctime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->ctime); 5f39d397d Chris Mason 2007-10-15 3645 9cc97d646 chandan r 2012-07-04 3646 BTRFS_I(inode)->i_otime.tv_sec = 9cc97d646 chandan r 2012-07-04 3647 btrfs_timespec_sec(leaf, &inode_item->otime); 9cc97d646 chandan r 2012-07-04 3648 BTRFS_I(inode)->i_otime.tv_nsec = 9cc97d646 chandan r 2012-07-04 3649 btrfs_timespec_nsec(leaf, &inode_item->otime); 5f39d397d Chris Mason 2007-10-15 3650 a76a3cd40 Yan Zheng 2008-10-09 3651 inode_set_bytes(inode, btrfs_inode_nbytes(leaf, inode_item)); e02119d5a Chris Mason 2008-09-05 3652 BTRFS_I(inode)->generation = btrfs_inode_generation(leaf, inode_item); 5dc562c54 Josef Bacik 2012-08-17 3653 BTRFS_I(inode)->last_trans = btrfs_inode_transid(leaf, inode_item); 5dc562c54 Josef Bacik 2012-08-17 3654 c7f88c4e7 Jeff Layton 2017-12-11 3655 inode_set_iversion_queried(inode, c7f88c4e7 Jeff Layton 2017-12-11 3656 btrfs_inode_sequence(leaf, inode_item)); 6e17d30bf Yang Dongsheng 2015-04-09 3657 inode->i_generation = BTRFS_I(inode)->generation; 6e17d30bf Yang Dongsheng 2015-04-09 3658 inode->i_rdev = 0; 6e17d30bf Yang Dongsheng 2015-04-09 3659 rdev = btrfs_inode_rdev(leaf, inode_item); 6e17d30bf Yang Dongsheng 2015-04-09 3660 6e17d30bf Yang Dongsheng 2015-04-09 3661 BTRFS_I(inode)->index_cnt = (u64)-1; 6e17d30bf Yang Dongsheng 2015-04-09 3662 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item); 6e17d30bf Yang Dongsheng 2015-04-09 3663 6e17d30bf Yang Dongsheng 2015-04-09 3664 cache_index: 5dc562c54 Josef Bacik 2012-08-17 3665 /* 5dc562c54 Josef Bacik 2012-08-17 3666 * If we were modified in the current generation and evicted from memory 5dc562c54 Josef Bacik 2012-08-17 3667 * and then re-read we need to do a full sync since we don't have any 5dc562c54 Josef Bacik 2012-08-17 3668 * idea about which extents were modified before we were evicted from 5dc562c54 Josef Bacik 2012-08-17 3669 * cache. 6e17d30bf Yang Dongsheng 2015-04-09 3670 * 6e17d30bf Yang Dongsheng 2015-04-09 3671 * This is required for both inode re-read from disk and delayed inode 6e17d30bf Yang Dongsheng 2015-04-09 3672 * in delayed_nodes_tree. 5dc562c54 Josef Bacik 2012-08-17 3673 */ 0b246afa6 Jeff Mahoney 2016-06-22 3674 if (BTRFS_I(inode)->last_trans == fs_info->generation) 5dc562c54 Josef Bacik 2012-08-17 3675 set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, 5dc562c54 Josef Bacik 2012-08-17 3676 &BTRFS_I(inode)->runtime_flags); 5dc562c54 Josef Bacik 2012-08-17 3677 bde6c2420 Filipe Manana 2015-07-24 3678 /* bde6c2420 Filipe Manana 2015-07-24 3679 * We don't persist the id of the transaction where an unlink operation bde6c2420 Filipe Manana 2015-07-24 3680 * against the inode was last made. So here we assume the inode might bde6c2420 Filipe Manana 2015-07-24 3681 * have been evicted, and therefore the exact value of last_unlink_trans bde6c2420 Filipe Manana 2015-07-24 3682 * lost, and set it to last_trans to avoid metadata inconsistencies bde6c2420 Filipe Manana 2015-07-24 3683 * between the inode and its parent if the inode is fsync'ed and the log bde6c2420 Filipe Manana 2015-07-24 3684 * replayed. For example, in the scenario: bde6c2420 Filipe Manana 2015-07-24 3685 * bde6c2420 Filipe Manana 2015-07-24 3686 * touch mydir/foo bde6c2420 Filipe Manana 2015-07-24 3687 * ln mydir/foo mydir/bar bde6c2420 Filipe Manana 2015-07-24 3688 * sync bde6c2420 Filipe Manana 2015-07-24 3689 * unlink mydir/bar bde6c2420 Filipe Manana 2015-07-24 3690 * echo 2 > /proc/sys/vm/drop_caches # evicts inode bde6c2420 Filipe Manana 2015-07-24 3691 * xfs_io -c fsync mydir/foo bde6c2420 Filipe Manana 2015-07-24 3692 * <power failure> bde6c2420 Filipe Manana 2015-07-24 3693 * mount fs, triggers fsync log replay bde6c2420 Filipe Manana 2015-07-24 3694 * bde6c2420 Filipe Manana 2015-07-24 3695 * We must make sure that when we fsync our inode foo we also log its bde6c2420 Filipe Manana 2015-07-24 3696 * parent inode, otherwise after log replay the parent still has the bde6c2420 Filipe Manana 2015-07-24 3697 * dentry with the "bar" name but our inode foo has a link count of 1 bde6c2420 Filipe Manana 2015-07-24 3698 * and doesn't have an inode ref with the name "bar" anymore. bde6c2420 Filipe Manana 2015-07-24 3699 * bde6c2420 Filipe Manana 2015-07-24 3700 * Setting last_unlink_trans to last_trans is a pessimistic approach, 013276101 Nicholas D Steeves 2016-05-19 3701 * but it guarantees correctness at the expense of occasional full bde6c2420 Filipe Manana 2015-07-24 3702 * transaction commits on fsync if our inode is a directory, or if our bde6c2420 Filipe Manana 2015-07-24 3703 * inode is not a directory, logging its parent unnecessarily. bde6c2420 Filipe Manana 2015-07-24 3704 */ bde6c2420 Filipe Manana 2015-07-24 3705 BTRFS_I(inode)->last_unlink_trans = BTRFS_I(inode)->last_trans; bde6c2420 Filipe Manana 2015-07-24 3706 67de11769 Miao Xie 2013-12-26 3707 path->slots[0]++; 67de11769 Miao Xie 2013-12-26 3708 if (inode->i_nlink != 1 || 67de11769 Miao Xie 2013-12-26 3709 path->slots[0] >= btrfs_header_nritems(leaf)) 67de11769 Miao Xie 2013-12-26 3710 goto cache_acl; 67de11769 Miao Xie 2013-12-26 3711 67de11769 Miao Xie 2013-12-26 3712 btrfs_item_key_to_cpu(leaf, &location, path->slots[0]); 4a0cc7ca6 Nikolay Borisov 2017-01-10 3713 if (location.objectid != btrfs_ino(BTRFS_I(inode))) 67de11769 Miao Xie 2013-12-26 3714 goto cache_acl; 67de11769 Miao Xie 2013-12-26 3715 67de11769 Miao Xie 2013-12-26 3716 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); 67de11769 Miao Xie 2013-12-26 3717 if (location.type == BTRFS_INODE_REF_KEY) { 67de11769 Miao Xie 2013-12-26 3718 struct btrfs_inode_ref *ref; 67de11769 Miao Xie 2013-12-26 3719 67de11769 Miao Xie 2013-12-26 3720 ref = (struct btrfs_inode_ref *)ptr; 67de11769 Miao Xie 2013-12-26 3721 BTRFS_I(inode)->dir_index = btrfs_inode_ref_index(leaf, ref); 67de11769 Miao Xie 2013-12-26 3722 } else if (location.type == BTRFS_INODE_EXTREF_KEY) { 67de11769 Miao Xie 2013-12-26 3723 struct btrfs_inode_extref *extref; 67de11769 Miao Xie 2013-12-26 3724 67de11769 Miao Xie 2013-12-26 3725 extref = (struct btrfs_inode_extref *)ptr; 67de11769 Miao Xie 2013-12-26 3726 BTRFS_I(inode)->dir_index = btrfs_inode_extref_index(leaf, 67de11769 Miao Xie 2013-12-26 3727 extref); 67de11769 Miao Xie 2013-12-26 3728 } 2f7e33d43 Miao Xie 2011-06-23 3729 cache_acl: 46a53cca8 Chris Mason 2009-04-27 3730 /* 46a53cca8 Chris Mason 2009-04-27 3731 * try to precache a NULL acl entry for files that don't have 46a53cca8 Chris Mason 2009-04-27 3732 * any xattrs or acls 46a53cca8 Chris Mason 2009-04-27 3733 */ 33345d015 Li Zefan 2011-04-20 3734 maybe_acls = acls_after_inode_item(leaf, path->slots[0], 4a0cc7ca6 Nikolay Borisov 2017-01-10 3735 btrfs_ino(BTRFS_I(inode)), &first_xattr_slot); 63541927c Filipe David Borba Manana 2014-01-07 3736 if (first_xattr_slot != -1) { 63541927c Filipe David Borba Manana 2014-01-07 3737 path->slots[0] = first_xattr_slot; 63541927c Filipe David Borba Manana 2014-01-07 3738 ret = btrfs_load_inode_props(inode, path); 63541927c Filipe David Borba Manana 2014-01-07 3739 if (ret) 0b246afa6 Jeff Mahoney 2016-06-22 3740 btrfs_err(fs_info, 351fd3532 David Sterba 2014-05-15 3741 "error loading props for ino %llu (root %llu): %d", 4a0cc7ca6 Nikolay Borisov 2017-01-10 3742 btrfs_ino(BTRFS_I(inode)), 63541927c Filipe David Borba Manana 2014-01-07 3743 root->root_key.objectid, ret); 63541927c Filipe David Borba Manana 2014-01-07 3744 } 63541927c Filipe David Borba Manana 2014-01-07 3745 btrfs_free_path(path); 63541927c Filipe David Borba Manana 2014-01-07 3746 72c04902d Al Viro 2009-06-24 3747 if (!maybe_acls) 72c04902d Al Viro 2009-06-24 3748 cache_no_acl(inode); 46a53cca8 Chris Mason 2009-04-27 3749 39279cc3d Chris Mason 2007-06-12 3750 switch (inode->i_mode & S_IFMT) { 39279cc3d Chris Mason 2007-06-12 3751 case S_IFREG: 39279cc3d Chris Mason 2007-06-12 3752 inode->i_mapping->a_ops = &btrfs_aops; d1310b2e0 Chris Mason 2008-01-24 3753 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; 39279cc3d Chris Mason 2007-06-12 3754 inode->i_fop = &btrfs_file_operations; 39279cc3d Chris Mason 2007-06-12 3755 inode->i_op = &btrfs_file_inode_operations; 39279cc3d Chris Mason 2007-06-12 3756 break; 39279cc3d Chris Mason 2007-06-12 3757 case S_IFDIR: 39279cc3d Chris Mason 2007-06-12 3758 inode->i_fop = &btrfs_dir_file_operations; 39279cc3d Chris Mason 2007-06-12 3759 inode->i_op = &btrfs_dir_inode_operations; 39279cc3d Chris Mason 2007-06-12 3760 break; 39279cc3d Chris Mason 2007-06-12 3761 case S_IFLNK: 39279cc3d Chris Mason 2007-06-12 3762 inode->i_op = &btrfs_symlink_inode_operations; 21fc61c73 Al Viro 2015-11-17 3763 inode_nohighmem(inode); 39279cc3d Chris Mason 2007-06-12 3764 inode->i_mapping->a_ops = &btrfs_symlink_aops; 39279cc3d Chris Mason 2007-06-12 3765 break; 618e21d59 Josef Bacik 2007-07-11 3766 default: 0279b4cd8 Jim Owens 2009-02-04 3767 inode->i_op = &btrfs_special_inode_operations; 618e21d59 Josef Bacik 2007-07-11 3768 init_special_inode(inode, inode->i_mode, rdev); 618e21d59 Josef Bacik 2007-07-11 3769 break; 39279cc3d Chris Mason 2007-06-12 3770 } 6cbff00f4 Christoph Hellwig 2009-04-17 3771 7b6a221e5 David Sterba 2018-03-26 3772 btrfs_sync_inode_flags_to_i_flags(inode); 67710892e Filipe Manana 2016-06-06 3773 return 0; 39279cc3d Chris Mason 2007-06-12 3774 39279cc3d Chris Mason 2007-06-12 @3775 make_bad: 39279cc3d Chris Mason 2007-06-12 3776 } 39279cc3d Chris Mason 2007-06-12 3777 :::::: The code at line 3775 was first introduced by commit :::::: 39279cc3d2704cfbf9c35dcb5bdd392159ae4625 Btrfs: split up super.c :::::: TO: Chris Mason <chris.mason@xxxxxxxxxx> :::::: CC: David Woodhouse <dwmw2@xxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip