From: Richard Weinberger <richard@nod.at>
To: liu.song11@zte.com.cn
Cc: dedekind1@gmail.com, adrian.hunter@intel.com,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
jiang.biao2@zte.com.cn, zhong.weidong@zte.com.cn
Subject: Re: [PATCH] ubifs: remove unnecessary check in ubifs_log_start_commit
Date: Tue, 21 Aug 2018 09:41:57 +0200 [thread overview]
Message-ID: <2441223.E8OYYOjAtB@blindfold> (raw)
In-Reply-To: <201808211457448170622@zte.com.cn>
Am Dienstag, 21. August 2018, 08:57:44 CEST schrieb liu.song11@zte.com.cn:
> Hi Richard,
>
> In ubifs_log_start_commit, the value of c->lhead_offs is zero or set to zero by code bellow
> 409 /* Switch to the next log LEB */
> 410 if (c->lhead_offs) {
> 411 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
> 412 ubifs_assert(c->lhead_lnum != c->ltail_lnum);
> 413 c->lhead_offs = 0;
> 414 }
>
> The value of 'len' can not exceed 'max_len' which assigned value by code bellow
> 370 max_len = UBIFS_CS_NODE_SZ + c->jhead_cnt * UBIFS_REF_NODE_SZ;
>
> So, the value of c->lhead_offs cannot exceed 'max_len'
> 429 c->lhead_offs += len;
> 430 if (c->lhead_offs == c->leb_size) {
> 431 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
> 432 c->lhead_offs = 0;
> 433 }
>
> Usually, the size of PEB is between 64KB and 256KB, and in UBIFS, the value of
> c->lhead_offs far less than UBIFS_BLOCK_SIZE which equal to 4096. So I think
> the value of c->lhead_offs far less than c->leb_size, the check in line 430 seem
> never to be true.
Okay, now it makes sense.
But what has this do to with UBIFS_BLOCK_SIZE?
Anyway, your patch description needs to be more detailed.
What you explained to me right now needs to go in the commit message.
Then people can understand why the check is not needed.
For the sake of paranoia and debug-ability, please also add a
ubifs_assert(c->lhead_offs < c->leb_size);.
Thanks,
//richard
next parent reply other threads:[~2018-08-21 7:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201808211457448170622@zte.com.cn>
2018-08-21 7:41 ` Richard Weinberger [this message]
2018-08-21 3:17 [PATCH] ubifs: remove unnecessary check in ubifs_log_start_commit Liu Song
2018-08-21 6:25 ` Richard Weinberger
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=2441223.E8OYYOjAtB@blindfold \
--to=richard@nod.at \
--cc=adrian.hunter@intel.com \
--cc=dedekind1@gmail.com \
--cc=jiang.biao2@zte.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=liu.song11@zte.com.cn \
--cc=zhong.weidong@zte.com.cn \
/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).