diff mbox series

ubifs: remove unnecessary check in ubifs_log_start_commit

Message ID 1534821442-178518-1-git-send-email-liu.song11@zte.com.cn
State Superseded
Headers show
Series ubifs: remove unnecessary check in ubifs_log_start_commit | expand

Commit Message

Liu Song Aug. 21, 2018, 3:17 a.m. UTC
The value of c->lhead_offs cannot exceed max_len which much
smaller than c->leb_size. So the check will never be true.
Just remove it.

Signed-off-by: Liu Song <liu.song11@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
---
 fs/ubifs/log.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Richard Weinberger Aug. 21, 2018, 6:25 a.m. UTC | #1
Liu Song,

Am Dienstag, 21. August 2018, 05:17:22 CEST schrieb Liu Song:
> The value of c->lhead_offs cannot exceed max_len which much
> smaller than c->leb_size. So the check will never be true.
> Just remove it.

Please explain in more detail why this case is never ever possible.
Removing such code needs a good justification. 

In general I don't much like such changes for two reasons:
1. They don't fix a problem
2. They are likely to introduce very hard to debug new issues if they are wrong

Thanks,
//richard
diff mbox series

Patch

diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
index 7cffa120a750..5a338737223b 100644
--- a/fs/ubifs/log.c
+++ b/fs/ubifs/log.c
@@ -427,10 +427,6 @@  int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum)
 	*ltail_lnum = c->lhead_lnum;
 
 	c->lhead_offs += len;
-	if (c->lhead_offs == c->leb_size) {
-		c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
-		c->lhead_offs = 0;
-	}
 
 	remove_buds(c);