* [patch 5/11] btrfs: remove unneeded null check in btrfs_rename()
@ 2010-05-29 9:45 Dan Carpenter
2010-05-29 18:01 ` Mike Fedyk
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-05-29 9:45 UTC (permalink / raw)
To: linux-btrfs; +Cc: Yan Zheng, Josef Bacik, Al Viro, Chris Mason, kernel-janitors
"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,
* make sure the inode gets flushed if it is replacing
* something.
*/
- if (new_inode && new_inode->i_size &&
- old_inode && S_ISREG(old_inode->i_mode)) {
+ if (new_inode && new_inode->i_size && S_ISREG(old_inode->i_mode))
btrfs_add_ordered_operation(trans, root, old_inode);
- }
old_dir->i_ctime = old_dir->i_mtime = ctime;
new_dir->i_ctime = new_dir->i_mtime = ctime;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch 5/11] btrfs: remove unneeded null check in btrfs_rename()
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
2010-05-29 19:26 ` Al Viro
2010-05-31 7:25 ` Dan Carpenter
0 siblings, 2 replies; 4+ messages in thread
From: Mike Fedyk @ 2010-05-29 18:01 UTC (permalink / raw)
To: Dan Carpenter
Cc: linux-btrfs, Yan Zheng, Josef Bacik, Al Viro, Chris Mason,
kernel-janitors
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 5/11] btrfs: remove unneeded null check in btrfs_rename()
2010-05-29 18:01 ` Mike Fedyk
@ 2010-05-29 19:26 ` Al Viro
2010-05-31 7:25 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Al Viro @ 2010-05-29 19:26 UTC (permalink / raw)
To: Mike Fedyk
Cc: Dan Carpenter, linux-btrfs, Yan Zheng, Josef Bacik, Chris Mason,
kernel-janitors
On Sat, May 29, 2010 at 11:01:56AM -0700, Mike Fedyk wrote:
> 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.
_What_ features? Check for ->rename() argument not being negative is
done outside of btrfs.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 5/11] btrfs: remove unneeded null check in btrfs_rename()
2010-05-29 18:01 ` Mike Fedyk
2010-05-29 19:26 ` Al Viro
@ 2010-05-31 7:25 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-05-31 7:25 UTC (permalink / raw)
To: Mike Fedyk
Cc: linux-btrfs, Yan Zheng, Josef Bacik, Al Viro, Chris Mason,
kernel-janitors
On Sat, May 29, 2010 at 11:01:56AM -0700, Mike Fedyk wrote:
> On Sat, May 29, 2010 at 2:45 AM, Dan Carpenter <error27@gmail.com> wr=
ote:
> > "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_di=
r, struct dentry *old_dentry,
> > =A0 =A0 =A0 =A0 * make sure the inode gets flushed if it is replaci=
ng
> > =A0 =A0 =A0 =A0 * something.
> > =A0 =A0 =A0 =A0 */
> > - =A0 =A0 =A0 if (new_inode && new_inode->i_size &&
> > - =A0 =A0 =A0 =A0 =A0 old_inode && S_ISREG(old_inode->i_mode)) {
> > + =A0 =A0 =A0 if (new_inode && new_inode->i_size && S_ISREG(old_ino=
de->i_mode))
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0btrfs_add_ordered_operation(trans, r=
oot, old_inode);
> > - =A0 =A0 =A0 }
>=20
> 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.
Right right. I understand about extra checks and api changes. But in
this case that doesn't aply. There is no way this particular check hel=
ps
now or in the future, and it just wastes time when someone is auditing
for inconsistent null checking.
regards,
dan carpenter
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-31 7:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2010-05-29 19:26 ` Al Viro
2010-05-31 7:25 ` Dan Carpenter
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).