linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 10/17] fs/jffs2: remove unnecessary new_valid_dev check
       [not found] <1443446807-4838-1-git-send-email-bywxiaobai@163.com>
@ 2015-09-28 14:15 ` Yaowei Bai
  2015-09-28 23:20   ` Brian Norris
  2015-09-28 14:53 ` [PATCH 17/17] fs/ubifs: " Yaowei Bai
  2015-09-29 13:57 ` [PATCH] " Yaowei Bai
  2 siblings, 1 reply; 8+ messages in thread
From: Yaowei Bai @ 2015-09-28 14:15 UTC (permalink / raw)
  To: viro, dwmw2; +Cc: linux-mtd, linux-fsdevel, linux-kernel

As new_valid_dev always returns 1, so !new_valid_dev check is not
needed, remove it.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 fs/jffs2/dir.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 8118002..d211b8e 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -621,9 +621,6 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
 	uint32_t alloclen;
 	int ret;
 
-	if (!new_valid_dev(rdev))
-		return -EINVAL;
-
 	ri = jffs2_alloc_raw_inode();
 	if (!ri)
 		return -ENOMEM;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 17/17] fs/ubifs: remove unnecessary new_valid_dev check
       [not found] <1443446807-4838-1-git-send-email-bywxiaobai@163.com>
  2015-09-28 14:15 ` [PATCH 10/17] fs/jffs2: remove unnecessary new_valid_dev check Yaowei Bai
@ 2015-09-28 14:53 ` Yaowei Bai
  2015-09-28 19:20   ` Richard Weinberger
  2015-09-29 13:57 ` [PATCH] " Yaowei Bai
  2 siblings, 1 reply; 8+ messages in thread
From: Yaowei Bai @ 2015-09-28 14:53 UTC (permalink / raw)
  To: viro, dedekind1, adrian.hunter; +Cc: linux-mtd, linux-fsdevel, linux-kernel

As new_valid_dev always returns 1, so new_valid_dev check is not
needed, remove it.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 fs/ubifs/dir.c  | 3 ---
 fs/ubifs/misc.h | 9 ++-------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 5c27c66..1dd9267 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -787,9 +787,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
 
 	dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino);
 
-	if (!new_valid_dev(rdev))
-		return -EINVAL;
-
 	if (S_ISBLK(mode) || S_ISCHR(mode)) {
 		dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS);
 		if (!dev)
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
index ee7cb5e..0197ed6 100644
--- a/fs/ubifs/misc.h
+++ b/fs/ubifs/misc.h
@@ -155,13 +155,8 @@ static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf)
  */
 static inline int ubifs_encode_dev(union ubifs_dev_desc *dev, dev_t rdev)
 {
-	if (new_valid_dev(rdev)) {
-		dev->new = cpu_to_le32(new_encode_dev(rdev));
-		return sizeof(dev->new);
-	} else {
-		dev->huge = cpu_to_le64(huge_encode_dev(rdev));
-		return sizeof(dev->huge);
-	}
+	dev->huge = cpu_to_le64(huge_encode_dev(rdev));
+	return sizeof(dev->huge);
 }
 
 /**
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 17/17] fs/ubifs: remove unnecessary new_valid_dev check
  2015-09-28 14:53 ` [PATCH 17/17] fs/ubifs: " Yaowei Bai
@ 2015-09-28 19:20   ` Richard Weinberger
  2015-09-29 13:43     ` Yaowei Bai
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Weinberger @ 2015-09-28 19:20 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: Al Viro, Artem Bityutskiy, Adrian Hunter,
	linux-mtd@lists.infradead.org, linux-fsdevel, LKML

On Mon, Sep 28, 2015 at 4:53 PM, Yaowei Bai <bywxiaobai@163.com> wrote:
> As new_valid_dev always returns 1, so new_valid_dev check is not
> needed, remove it.
>
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
>  fs/ubifs/dir.c  | 3 ---
>  fs/ubifs/misc.h | 9 ++-------
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> index 5c27c66..1dd9267 100644
> --- a/fs/ubifs/dir.c
> +++ b/fs/ubifs/dir.c
> @@ -787,9 +787,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
>
>         dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino);
>
> -       if (!new_valid_dev(rdev))
> -               return -EINVAL;
> -
>         if (S_ISBLK(mode) || S_ISCHR(mode)) {
>                 dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS);
>                 if (!dev)
> diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
> index ee7cb5e..0197ed6 100644
> --- a/fs/ubifs/misc.h
> +++ b/fs/ubifs/misc.h
> @@ -155,13 +155,8 @@ static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf)
>   */
>  static inline int ubifs_encode_dev(union ubifs_dev_desc *dev, dev_t rdev)
>  {
> -       if (new_valid_dev(rdev)) {
> -               dev->new = cpu_to_le32(new_encode_dev(rdev));
> -               return sizeof(dev->new);
> -       } else {
> -               dev->huge = cpu_to_le64(huge_encode_dev(rdev));
> -               return sizeof(dev->huge);
> -       }
> +       dev->huge = cpu_to_le64(huge_encode_dev(rdev));
> +       return sizeof(dev->huge);

Please be careful.

dev->new = cpu_to_le32(new_encode_dev(rdev));
return sizeof(dev->huge);

...is the correct branch. You enabled the dead one.

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 10/17] fs/jffs2: remove unnecessary new_valid_dev check
  2015-09-28 14:15 ` [PATCH 10/17] fs/jffs2: remove unnecessary new_valid_dev check Yaowei Bai
@ 2015-09-28 23:20   ` Brian Norris
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Norris @ 2015-09-28 23:20 UTC (permalink / raw)
  To: Yaowei Bai; +Cc: viro, dwmw2, linux-fsdevel, linux-mtd, linux-kernel

On Mon, Sep 28, 2015 at 10:15:38PM +0800, Yaowei Bai wrote:
> As new_valid_dev always returns 1, so !new_valid_dev check is not
> needed, remove it.
> 
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>

Pushed to l2-mtd.git

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 17/17] fs/ubifs: remove unnecessary new_valid_dev check
  2015-09-28 19:20   ` Richard Weinberger
@ 2015-09-29 13:43     ` Yaowei Bai
  0 siblings, 0 replies; 8+ messages in thread
From: Yaowei Bai @ 2015-09-29 13:43 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Al Viro, Artem Bityutskiy, Adrian Hunter,
	linux-mtd@lists.infradead.org, linux-fsdevel, LKML

On Mon, Sep 28, 2015 at 09:20:32PM +0200, Richard Weinberger wrote:
> On Mon, Sep 28, 2015 at 4:53 PM, Yaowei Bai <bywxiaobai@163.com> wrote:
> > As new_valid_dev always returns 1, so new_valid_dev check is not
> > needed, remove it.
> >
> > Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> > ---
> >  fs/ubifs/dir.c  | 3 ---
> >  fs/ubifs/misc.h | 9 ++-------
> >  2 files changed, 2 insertions(+), 10 deletions(-)
> >
> > diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> > index 5c27c66..1dd9267 100644
> > --- a/fs/ubifs/dir.c
> > +++ b/fs/ubifs/dir.c
> > @@ -787,9 +787,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
> >
> >         dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino);
> >
> > -       if (!new_valid_dev(rdev))
> > -               return -EINVAL;
> > -
> >         if (S_ISBLK(mode) || S_ISCHR(mode)) {
> >                 dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS);
> >                 if (!dev)
> > diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
> > index ee7cb5e..0197ed6 100644
> > --- a/fs/ubifs/misc.h
> > +++ b/fs/ubifs/misc.h
> > @@ -155,13 +155,8 @@ static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf)
> >   */
> >  static inline int ubifs_encode_dev(union ubifs_dev_desc *dev, dev_t rdev)
> >  {
> > -       if (new_valid_dev(rdev)) {
> > -               dev->new = cpu_to_le32(new_encode_dev(rdev));
> > -               return sizeof(dev->new);
> > -       } else {
> > -               dev->huge = cpu_to_le64(huge_encode_dev(rdev));
> > -               return sizeof(dev->huge);
> > -       }
> > +       dev->huge = cpu_to_le64(huge_encode_dev(rdev));
> > +       return sizeof(dev->huge);
> 
> Please be careful.
> 
> dev->new = cpu_to_le32(new_encode_dev(rdev));
> return sizeof(dev->huge);
> 
> ...is the correct branch. You enabled the dead one.

Sorry about that, will resend fixing it. Thanks.

> 
> -- 
> Thanks,
> //richard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] fs/ubifs: remove unnecessary new_valid_dev check
       [not found] <1443446807-4838-1-git-send-email-bywxiaobai@163.com>
  2015-09-28 14:15 ` [PATCH 10/17] fs/jffs2: remove unnecessary new_valid_dev check Yaowei Bai
  2015-09-28 14:53 ` [PATCH 17/17] fs/ubifs: " Yaowei Bai
@ 2015-09-29 13:57 ` Yaowei Bai
  2015-09-30  8:11   ` Richard Weinberger
  2 siblings, 1 reply; 8+ messages in thread
From: Yaowei Bai @ 2015-09-29 13:57 UTC (permalink / raw)
  To: viro, dedekind1, adrian.hunter; +Cc: linux-mtd, linux-fsdevel, linux-kernel

As currently new_valid_dev always returns 1, so new_valid_dev check is not
needed, remove it.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 fs/ubifs/dir.c  | 3 ---
 fs/ubifs/misc.h | 9 ++-------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 5c27c66..1dd9267 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -787,9 +787,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
 
 	dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino);
 
-	if (!new_valid_dev(rdev))
-		return -EINVAL;
-
 	if (S_ISBLK(mode) || S_ISCHR(mode)) {
 		dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS);
 		if (!dev)
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
index ee7cb5e..8ece6ca 100644
--- a/fs/ubifs/misc.h
+++ b/fs/ubifs/misc.h
@@ -155,13 +155,8 @@ static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf)
  */
 static inline int ubifs_encode_dev(union ubifs_dev_desc *dev, dev_t rdev)
 {
-	if (new_valid_dev(rdev)) {
-		dev->new = cpu_to_le32(new_encode_dev(rdev));
-		return sizeof(dev->new);
-	} else {
-		dev->huge = cpu_to_le64(huge_encode_dev(rdev));
-		return sizeof(dev->huge);
-	}
+	dev->new = cpu_to_le32(new_encode_dev(rdev));
+	return sizeof(dev->new);
 }
 
 /**
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs/ubifs: remove unnecessary new_valid_dev check
  2015-09-29 13:57 ` [PATCH] " Yaowei Bai
@ 2015-09-30  8:11   ` Richard Weinberger
  2015-10-01 13:35     ` Artem Bityutskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Weinberger @ 2015-09-30  8:11 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: Al Viro, Artem Bityutskiy, Adrian Hunter,
	linux-mtd@lists.infradead.org, linux-fsdevel, LKML

On Tue, Sep 29, 2015 at 3:57 PM, Yaowei Bai <bywxiaobai@163.com> wrote:
> As currently new_valid_dev always returns 1, so new_valid_dev check is not
> needed, remove it.
>
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
>  fs/ubifs/dir.c  | 3 ---
>  fs/ubifs/misc.h | 9 ++-------
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> index 5c27c66..1dd9267 100644
> --- a/fs/ubifs/dir.c
> +++ b/fs/ubifs/dir.c
> @@ -787,9 +787,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
>
>         dbg_gen("dent '%pd' in dir ino %lu", dentry, dir->i_ino);
>
> -       if (!new_valid_dev(rdev))
> -               return -EINVAL;
> -
>         if (S_ISBLK(mode) || S_ISCHR(mode)) {
>                 dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS);
>                 if (!dev)
> diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h
> index ee7cb5e..8ece6ca 100644
> --- a/fs/ubifs/misc.h
> +++ b/fs/ubifs/misc.h
> @@ -155,13 +155,8 @@ static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf)
>   */
>  static inline int ubifs_encode_dev(union ubifs_dev_desc *dev, dev_t rdev)
>  {
> -       if (new_valid_dev(rdev)) {
> -               dev->new = cpu_to_le32(new_encode_dev(rdev));
> -               return sizeof(dev->new);
> -       } else {
> -               dev->huge = cpu_to_le64(huge_encode_dev(rdev));
> -               return sizeof(dev->huge);
> -       }
> +       dev->new = cpu_to_le32(new_encode_dev(rdev));
> +       return sizeof(dev->new);
>  }

Reviewed-by: Richard Weinberger <richard@nod.at>

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs/ubifs: remove unnecessary new_valid_dev check
  2015-09-30  8:11   ` Richard Weinberger
@ 2015-10-01 13:35     ` Artem Bityutskiy
  0 siblings, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2015-10-01 13:35 UTC (permalink / raw)
  To: Richard Weinberger, Yaowei Bai
  Cc: Al Viro, Adrian Hunter, linux-mtd@lists.infradead.org,
	linux-fsdevel, LKML

On Wed, 2015-09-30 at 10:11 +0200, Richard Weinberger wrote:
> >  {
> > -       if (new_valid_dev(rdev)) {
> > -               dev->new = cpu_to_le32(new_encode_dev(rdev));
> > -               return sizeof(dev->new);
> > -       } else {
> > -               dev->huge = cpu_to_le64(huge_encode_dev(rdev));
> > -               return sizeof(dev->huge);
> > -       }
> > +       dev->new = cpu_to_le32(new_encode_dev(rdev));
> > +       return sizeof(dev->new);
> >  }
> 
> Reviewed-by: Richard Weinberger <richard@nod.at>

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-01 13:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1443446807-4838-1-git-send-email-bywxiaobai@163.com>
2015-09-28 14:15 ` [PATCH 10/17] fs/jffs2: remove unnecessary new_valid_dev check Yaowei Bai
2015-09-28 23:20   ` Brian Norris
2015-09-28 14:53 ` [PATCH 17/17] fs/ubifs: " Yaowei Bai
2015-09-28 19:20   ` Richard Weinberger
2015-09-29 13:43     ` Yaowei Bai
2015-09-29 13:57 ` [PATCH] " Yaowei Bai
2015-09-30  8:11   ` Richard Weinberger
2015-10-01 13:35     ` Artem Bityutskiy

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).