@@ -3547,7 +3547,6 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
35473547 struct extent_buffer * leaf ;
35483548 struct btrfs_key key , found_key ;
35493549 struct btrfs_trans_handle * trans ;
3550- struct inode * inode ;
35513550 u64 last_objectid = 0 ;
35523551 int ret = 0 , nr_unlink = 0 ;
35533552
@@ -3566,6 +3565,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
35663565 key .offset = (u64 )- 1 ;
35673566
35683567 while (1 ) {
3568+ struct btrfs_inode * inode ;
3569+
35693570 ret = btrfs_search_slot (NULL , root , & key , path , 0 , 0 );
35703571 if (ret < 0 )
35713572 goto out ;
@@ -3689,10 +3690,10 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
36893690 * deleted but wasn't. The inode number may have been reused,
36903691 * but either way, we can delete the orphan item.
36913692 */
3692- if (!inode || inode -> i_nlink ) {
3693+ if (!inode || inode -> vfs_inode . i_nlink ) {
36933694 if (inode ) {
3694- ret = btrfs_drop_verity_items (BTRFS_I ( inode ) );
3695- iput (inode );
3695+ ret = btrfs_drop_verity_items (inode );
3696+ iput (& inode -> vfs_inode );
36963697 inode = NULL ;
36973698 if (ret )
36983699 goto out ;
@@ -3715,7 +3716,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
37153716 nr_unlink ++ ;
37163717
37173718 /* this will do delete_inode and everything for us */
3718- iput (inode );
3719+ iput (& inode -> vfs_inode );
37193720 }
37203721 /* release the path since we're done with it */
37213722 btrfs_release_path (path );
@@ -5665,7 +5666,7 @@ struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
56655666/*
56665667 * Get an inode object given its inode number and corresponding root.
56675668 */
5668- struct inode * btrfs_iget (u64 ino , struct btrfs_root * root )
5669+ struct btrfs_inode * btrfs_iget (u64 ino , struct btrfs_root * root )
56695670{
56705671 struct btrfs_inode * inode ;
56715672 struct btrfs_path * path ;
@@ -5676,7 +5677,7 @@ struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
56765677 return ERR_PTR (- ENOMEM );
56775678
56785679 if (!(inode -> vfs_inode .i_state & I_NEW ))
5679- return & inode -> vfs_inode ;
5680+ return inode ;
56805681
56815682 path = btrfs_alloc_path ();
56825683 if (!path )
@@ -5688,7 +5689,7 @@ struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
56885689 return ERR_PTR (ret );
56895690
56905691 unlock_new_inode (& inode -> vfs_inode );
5691- return & inode -> vfs_inode ;
5692+ return inode ;
56925693}
56935694
56945695static struct btrfs_inode * new_simple_dir (struct inode * dir ,
@@ -5748,7 +5749,7 @@ static inline u8 btrfs_inode_type(const struct btrfs_inode *inode)
57485749struct inode * btrfs_lookup_dentry (struct inode * dir , struct dentry * dentry )
57495750{
57505751 struct btrfs_fs_info * fs_info = inode_to_fs_info (dir );
5751- struct inode * inode ;
5752+ struct btrfs_inode * inode ;
57525753 struct btrfs_root * root = BTRFS_I (dir )-> root ;
57535754 struct btrfs_root * sub_root = root ;
57545755 struct btrfs_key location = { 0 };
@@ -5765,49 +5766,48 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
57655766 if (location .type == BTRFS_INODE_ITEM_KEY ) {
57665767 inode = btrfs_iget (location .objectid , root );
57675768 if (IS_ERR (inode ))
5768- return inode ;
5769+ return ERR_CAST ( inode ) ;
57695770
57705771 /* Do extra check against inode mode with di_type */
5771- if (btrfs_inode_type (BTRFS_I ( inode ) ) != di_type ) {
5772+ if (btrfs_inode_type (inode ) != di_type ) {
57725773 btrfs_crit (fs_info ,
57735774"inode mode mismatch with dir: inode mode=0%o btrfs type=%u dir type=%u" ,
5774- inode -> i_mode , btrfs_inode_type (BTRFS_I ( inode ) ),
5775+ inode -> vfs_inode . i_mode , btrfs_inode_type (inode ),
57755776 di_type );
5776- iput (inode );
5777+ iput (& inode -> vfs_inode );
57775778 return ERR_PTR (- EUCLEAN );
57785779 }
5779- return inode ;
5780+ return & inode -> vfs_inode ;
57805781 }
57815782
57825783 ret = fixup_tree_root_location (fs_info , BTRFS_I (dir ), dentry ,
57835784 & location , & sub_root );
57845785 if (ret < 0 ) {
5785- if (ret != - ENOENT ) {
5786+ if (ret != - ENOENT )
57865787 inode = ERR_PTR (ret );
5787- } else {
5788- struct btrfs_inode * b_inode ;
5789-
5790- b_inode = new_simple_dir (dir , & location , root );
5791- inode = & b_inode -> vfs_inode ;
5792- }
5788+ else
5789+ inode = new_simple_dir (dir , & location , root );
57935790 } else {
57945791 inode = btrfs_iget (location .objectid , sub_root );
57955792 btrfs_put_root (sub_root );
57965793
57975794 if (IS_ERR (inode ))
5798- return inode ;
5795+ return ERR_CAST ( inode ) ;
57995796
58005797 down_read (& fs_info -> cleanup_work_sem );
5801- if (!sb_rdonly (inode -> i_sb ))
5798+ if (!sb_rdonly (inode -> vfs_inode . i_sb ))
58025799 ret = btrfs_orphan_cleanup (sub_root );
58035800 up_read (& fs_info -> cleanup_work_sem );
58045801 if (ret ) {
5805- iput (inode );
5802+ iput (& inode -> vfs_inode );
58065803 inode = ERR_PTR (ret );
58075804 }
58085805 }
58095806
5810- return inode ;
5807+ if (IS_ERR (inode ))
5808+ return ERR_CAST (inode );
5809+
5810+ return & inode -> vfs_inode ;
58115811}
58125812
58135813static int btrfs_dentry_delete (const struct dentry * dentry )
@@ -6460,7 +6460,7 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
64606460 path = NULL ;
64616461
64626462 if (args -> subvol ) {
6463- struct inode * parent ;
6463+ struct btrfs_inode * parent ;
64646464
64656465 /*
64666466 * Subvolumes inherit properties from their parent subvolume,
@@ -6471,8 +6471,8 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
64716471 ret = PTR_ERR (parent );
64726472 } else {
64736473 ret = btrfs_inode_inherit_props (trans , BTRFS_I (inode ),
6474- BTRFS_I ( parent ) );
6475- iput (parent );
6474+ parent );
6475+ iput (& parent -> vfs_inode );
64766476 }
64776477 } else {
64786478 ret = btrfs_inode_inherit_props (trans , BTRFS_I (inode ),
0 commit comments