lkml.org 
[lkml]   [2018]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 08/16] btrfs: btrfs_iget() never returns an is_bad_inode() inode.
    Date
    From: Al Viro <viro@zeniv.linux.org.uk>

    just get rid of pointless checks

    Cc: Chris Mason <clm@fb.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    ---
    fs/btrfs/free-space-cache.c | 4 ----
    fs/btrfs/relocation.c | 7 ++-----
    fs/btrfs/tree-log.c | 6 +-----
    3 files changed, 3 insertions(+), 14 deletions(-)

    diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
    index d5f80cb300be..79f03b3bbbd4 100644
    --- a/fs/btrfs/free-space-cache.c
    +++ b/fs/btrfs/free-space-cache.c
    @@ -71,10 +71,6 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
    inode = btrfs_iget(fs_info->sb, &location, root, NULL);
    if (IS_ERR(inode))
    return inode;
    - if (is_bad_inode(inode)) {
    - iput(inode);
    - return ERR_PTR(-ENOENT);
    - }

    mapping_set_gfp_mask(inode->i_mapping,
    mapping_gfp_constraint(inode->i_mapping,
    diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
    index 879b76fa881a..f6e8dc134e44 100644
    --- a/fs/btrfs/relocation.c
    +++ b/fs/btrfs/relocation.c
    @@ -3563,11 +3563,8 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info,
    key.offset = 0;

    inode = btrfs_iget(fs_info->sb, &key, root, NULL);
    - if (IS_ERR(inode) || is_bad_inode(inode)) {
    - if (!IS_ERR(inode))
    - iput(inode);
    + if (IS_ERR(inode))
    return -ENOENT;
    - }

    truncate:
    ret = btrfs_check_trunc_cache_free_space(fs_info,
    @@ -4284,7 +4281,7 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info,
    key.type = BTRFS_INODE_ITEM_KEY;
    key.offset = 0;
    inode = btrfs_iget(fs_info->sb, &key, root, NULL);
    - BUG_ON(IS_ERR(inode) || is_bad_inode(inode));
    + BUG_ON(IS_ERR(inode));
    BTRFS_I(inode)->index_cnt = group->key.objectid;

    err = btrfs_orphan_add(trans, BTRFS_I(inode));
    diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
    index f8220ec02036..fcfbe1d8584a 100644
    --- a/fs/btrfs/tree-log.c
    +++ b/fs/btrfs/tree-log.c
    @@ -545,12 +545,8 @@ static noinline struct inode *read_one_inode(struct btrfs_root *root,
    key.type = BTRFS_INODE_ITEM_KEY;
    key.offset = 0;
    inode = btrfs_iget(root->fs_info->sb, &key, root, NULL);
    - if (IS_ERR(inode)) {
    + if (IS_ERR(inode))
    inode = NULL;
    - } else if (is_bad_inode(inode)) {
    - iput(inode);
    - inode = NULL;
    - }
    return inode;
    }

    --
    2.11.0
    \
     
     \ /
      Last update: 2018-07-30 00:06    [W:2.257 / U:1.204 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site