linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Fedyk <mfedyk@mikefedyk.com>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-btrfs@vger.kernel.org, Yan Zheng <zheng.yan@oracle.com>,
	Josef Bacik <josef@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>,
	Chris Mason <chris.mason@oracle.com>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch 5/11] btrfs: remove unneeded null check in btrfs_rename()
Date: Sat, 29 May 2010 11:01:56 -0700	[thread overview]
Message-ID: <AANLkTikLkpTgkOGi8M8VL_rZRLyzbJKoKW9RiNMJenMi@mail.gmail.com> (raw)
In-Reply-To: <20100529094508.GF5483@bicker>

On Sat, May 29, 2010 at 2:45 AM, Dan Carpenter <error27@gmail.com> wrot=
e:
> "old_inode" cannot be null here, because we dereference it
> unconditionally throughout the function.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index fa6ccc1..0bc29be 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -6487,10 +6487,8 @@ static int btrfs_rename(struct inode *old_dir,=
 struct dentry *old_dentry,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * make sure the inode gets flushed if it =
is replacing
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * something.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
> - =C2=A0 =C2=A0 =C2=A0 if (new_inode && new_inode->i_size &&
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 old_inode && S_ISREG(old_inode->=
i_mode)) {
> + =C2=A0 =C2=A0 =C2=A0 if (new_inode && new_inode->i_size && S_ISREG(=
old_inode->i_mode))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0btrfs_add_orde=
red_operation(trans, root, old_inode);
> - =C2=A0 =C2=A0 =C2=A0 }

I think code like this is here because there are still a lot of
features that are being added to btrfs and it's easier to have the
additional checks than continually adding and removing them as the
code changes.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-05-29 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29  9:45 [patch 5/11] btrfs: remove unneeded null check in btrfs_rename() Dan Carpenter
2010-05-29 18:01 ` Mike Fedyk [this message]
2010-05-29 19:26   ` Al Viro
2010-05-31  7:25   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikLkpTgkOGi8M8VL_rZRLyzbJKoKW9RiNMJenMi@mail.gmail.com \
    --to=mfedyk@mikefedyk.com \
    --cc=chris.mason@oracle.com \
    --cc=error27@gmail.com \
    --cc=josef@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zheng.yan@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).