ubifs: compress lines for immediate return
Subsystems (2)
PATCH v2 1/1 ubifs: compress lines for immediate return
From: Masahiro Yamada <[email protected]>
Cleanup the following code construct:
ret = expression;
if (ret)
return ret;
return 0;
into a simple form:
return expression;
From: Masahiro Yamada <[email protected]> posted on the U-Boot mailinglist.
---
Changes in v2:
- add comment from Richard Weinberger:
rephrase commit message
add Masahiros "Signed-off-by" tag.
fs/ubifs/budget.c | 7 ++----- fs/ubifs/gc.c | 6 ++---- fs/ubifs/lpt_commit.c | 5 +---- 3 files changed, 5 insertions(+), 13 deletions(-)
fs/ubifs/budget.c +2 -5
@@ -77,7 +77,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write)*/ static int run_gc (struct ubifs_info *c) { -int err, lnum; +int lnum;/* Make some free space by garbage-collecting dirty space */ down_read (&c->commit_sem);
@@ -88,10 +88,7 @@ static int run_gc(struct ubifs_info *c)/* GC freed one LEB, return it to lprops */ dbg_budg ("GC freed LEB %d" , lnum); - err =ubifs_return_leb (c, lnum); -if (err) -return err; -return 0 ; + return = ubifs_return_leb(c, lnum); }/**
fs/ubifs/gc.c +2 -4
@@ -297,10 +297,8 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err =dbg_check_data_nodes_order (c, &sleb->nodes);if (err)return err; - err =dbg_check_nondata_nodes_order (c, nondata); -if (err) -return err; -return 0 ; + +return dbg_check_nondata_nodes_order (c, nondata); }/**
fs/ubifs/lpt_commit.c +1 -4
@@ -313,10 +313,7 @@ static int layout_cnodes(struct ubifs_info *c) alen =ALIGN (offs, c->min_io_size);upd_ltab (c, lnum, c->leb_size - alen, alen - offs);dbg_chk_lpt_sz (c,4 , alen - offs); - err =dbg_chk_lpt_sz (c,3 , alen); -if (err) -return err; -return 0 ; +return dbg_chk_lpt_sz (c,3 , alen); no_space: ubifs_err(c, "LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d",
Signature · 1 line
2.5.5
Hi Heiko, Richard,
2016-09-05 15:54 GMT+09:00 Heiko Schocher <[email protected]>:
Quoted 8 lines
From: Masahiro Yamada <[email protected]>
Cleanup the following code construct:
ret = expression;
if (ret)return ret;return 0;
Quoted 8 lines
into a simple form:
return expression;From: Masahiro Yamada <[email protected]> posted on the U-Boot mailinglist.
Signed-off-by Masahiro Yamada <[email protected]>Signed-off-by Heiko Schocher <[email protected]>
I am the author of the original patch in the U-Boot ML.
Please notice it has not passed the review in U-Boot ML yet. Actually, I got some feedback against this patch.
See
http://patchwork.ozlabs.org/patch/665199/
Stephan Warren suggested that
we should not break code uniformity.
After I considered it and took a closer look,
I decided that we should not do these changes.
This patch breaks the code uniformity.
See blow:
Quoted 6 lines
/**
fs/ubifs/gc.c +0
-0
fs/ubifs/gc.c static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, · line 302
Quoted 10 lines
fs/ubifs/gc.c +2
-4@@ -297,10 +297,8 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err =dbg_check_data_nodes_order (c, &sleb->nodes);if (err)return err; - err =dbg_check_nondata_nodes_order (c, nondata); -if (err) -return err; -return 0 ; + +return dbg_check_nondata_nodes_order (c, nondata); }
Original code has uniformity here.
err = dbg_check_data_nodes_order(c, &sleb->nodes); if (err)
return err;
err = dbg_check_nondata_nodes_order(c, nondata);
if (err)
return err;Quoted 6 lines
fs/ubifs/gc.c +0
-0/** fs/ubifs/lpt_commit.c +0
-0
fs/ubifs/lpt_commit.c static int layout_cnodes(struct ubifs_info *c) · line 317
Quoted 9 lines
fs/ubifs/lpt_commit.c +1
-4@@ -313,10 +313,7 @@ static int layout_cnodes(struct ubifs_info *c) alen =ALIGN (offs, c->min_io_size);upd_ltab (c, lnum, c->leb_size - alen, alen - offs);dbg_chk_lpt_sz (c,4 , alen - offs); - err =dbg_chk_lpt_sz (c,3 , alen); -if (err) -return err; -return 0 ; +return dbg_chk_lpt_sz (c,3 , alen);
We have dbg_chk_lpt_sz() call just above (its return value is ignored)
So, returning the value of the last dbg_chk_lpt_sz() call seems a bit weird. So, I do not want to touch this.
Heiko,
If you want to post this patch, it is up to you. But, in that case, could you drop my Author and Signed-off-by, then send it as your patch, please?
I do not feel comfortable with my authorship
for what I decided to not do.
I will retract my original patch from the U-Boot ML, too.
Signature · 2 lines
Best Regards Masahiro Yamada
Hello Masahiro,
Am 05.09.2016 um 14:44 schrieb Masahiro Yamada:
Quoted 105 lines
Hi Heiko, Richard,
2016-09-05 15:54 GMT+09:00 Heiko Schocher <[email protected]>:
Quoted 8 lines
From: Masahiro Yamada <[email protected]>
Cleanup the following code construct:
ret = expression;
if (ret)return ret;return 0;
Quoted 8 lines
into a simple form:
return expression;From: Masahiro Yamada <[email protected]> posted on the U-Boot mailinglist.
Signed-off-by Masahiro Yamada <[email protected]>Signed-off-by Heiko Schocher <[email protected]>I am the author of the original patch in the U-Boot ML.
Please notice it has not passed the review in U-Boot ML yet. Actually, I got some feedback against this patch.
See
http://patchwork.ozlabs.org/patch/665199/Stephan Warren suggested that
we should not break code uniformity.After I considered it and took a closer look,
I decided that we should not do these changes.This patch breaks the code uniformity.
See blow:Quoted 6 lines
/**
fs/ubifs/gc.c +0
-0fs/ubifs/gc.c static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, · line 302
Quoted 10 lines
fs/ubifs/gc.c +2
-4@@ -297,10 +297,8 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err =dbg_check_data_nodes_order (c, &sleb->nodes);if (err)return err; - err =dbg_check_nondata_nodes_order (c, nondata); -if (err) -return err; -return 0 ; + +return dbg_check_nondata_nodes_order (c, nondata); }Original code has uniformity here.
err =
dbg_check_data_nodes_order(c, &sleb->nodes); if (err)return err; err = dbg_check_nondata_nodes_order(c, nondata); if (err) return err;Quoted 6 lines
fs/ubifs/gc.c +0
-0/** fs/ubifs/lpt_commit.c +0
-0fs/ubifs/lpt_commit.c static int layout_cnodes(struct ubifs_info *c) · line 317
Quoted 9 lines
fs/ubifs/lpt_commit.c +1
-4@@ -313,10 +313,7 @@ static int layout_cnodes(struct ubifs_info *c) alen =ALIGN (offs, c->min_io_size);upd_ltab (c, lnum, c->leb_size - alen, alen - offs);dbg_chk_lpt_sz (c,4 , alen - offs); - err =dbg_chk_lpt_sz (c,3 , alen); -if (err) -return err; -return 0 ; +return dbg_chk_lpt_sz (c,3 , alen);We have
dbg_chk_lpt_sz()call just above (its return value is ignored)So, returning the value of the last
dbg_chk_lpt_sz()call seems a bit weird. So, I do not want to touch this.Heiko,
If you want to post this patch, it is up to you. But, in that case, could you drop my Author and Signed-off-by, then send it as your patch, please?
Quoted 5 lines
I do not feel comfortable with my authorship
for what I decided to not do.I will retract my original patch from the U-Boot ML, too.
Oh, then I was a little to fast ... sorry.
@Richard: Should we just forget this patch?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 14 lines · Heiko Schocher
fs/ubifs/budget.c +1
-1@@ -77,7 +77,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write)*/ static int run_gc (struct ubifs_info *c) { -int err, lnum; +int lnum;/* Make some free space by garbage-collecting dirty space */ down_read (&c->commit_sem);
fs/ubifs/budget.c static int run_gc(struct ubifs_info *c) · line 93
Quoted 10 lines
fs/ubifs/budget.c +1
-4@@ -88,10 +88,7 @@ static int run_gc(struct ubifs_info *c)/* GC freed one LEB, return it to lprops */ dbg_budg ("GC freed LEB %d" , lnum); - err =ubifs_return_leb (c, lnum); -if (err) -return err; -return 0 ; + return = ubifs_return_leb(c, lnum); }
Apart from the other issues discussed below and in v1, I don't believe that this _ever_ compiled successfully.
2016-09-05 22:18 GMT+09:00 David Oberhollenzer
<[email protected]>:
Quoted 16 lines · Heiko Schocher
Quoted 15 lines
fs/ubifs/budget.c +1
-1@@ -77,7 +77,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write)*/ static int run_gc (struct ubifs_info *c) { -int err, lnum; +int lnum;/* Make some free space by garbage-collecting dirty space */ down_read (&c->commit_sem);@@ -88,10 +88,7 @@ static int run_gc(struct ubifs_info *c)
Quoted 13 lines
fs/ubifs/budget.c static int run_gc(struct ubifs_info *c) · line 93
Quoted 9 lines
fs/ubifs/budget.c +1
-4/* GC freed one LEB, return it to lprops */ dbg_budg ("GC freed LEB %d" , lnum); - err =ubifs_return_leb (c, lnum); -if (err) -return err; -return 0 ; + return = ubifs_return_leb(c, lnum); }Apart from the other issues discussed below and in v1, I don't believe that this _ever_ compiled successfully.
Just in case:
It was not me who added '=' after 'return'. (I usually run build-test before sending my patches.)
Signature · 2 lines
Best Regards Masahiro Yamada
Richard Weinberger
maintainerQuoted 1 line · Heiko Schocher
@Richard: Should we just forget this patch?
Let's drop it for now.
It caused already a way more churn than a trivial style cleanup patch should...
Thanks,
//richard
Hello Richard,
Am 05.09.2016 um 15:32 schrieb Richard Weinberger:
Quoted 6 lines · Heiko Schocher
Quoted 1 line
@Richard: Should we just forget this patch?
Let's drop it for now.
It caused already a way more churn than a trivial style cleanup patch should...
Yes! It was a too fast shoot ... sorry for the noise!
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Heiko-Schocher/ubifs-compress-lines-for-immediate-return/20160905-145802 config: i386-randconfig-x0-09110426 (attached as .config) compiler: gcc-6…
Hi Masahiro,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Heiko-Schocher/ubifs-compress-lines-for-immediate-return/20160905-145802
config: i386-randconfig-x0-09110426 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All errors (new ones prefixed by >>):
fs/ubifs/budget.c: In function 'run_gc':
>> fs/ubifs/budget.c:91:9: error: expected expression before '=' token
return = ubifs_return_leb(c, lnum);
^
fs/ubifs/budget.c:92:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^vim +91 fs/ubifs/budget.c
85 up_read(&c->commit_sem);
86 if (lnum < 0)
87 return lnum;
88
89 /* GC freed one LEB, return it to lprops */
90 dbg_budg("GC freed LEB %d", lnum);
> 91 return = ubifs_return_leb(c, lnum);
92 }
93
94 /**---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation