From: Artem Bityutskiy <dedekind@infradead.org>
To: Kyungmin Park <kyungmin.park@samsung.com>
Cc: linux-mtd@lists.infradead.org, ext-adrian.hunter@nokia.com
Subject: Re: [PATCH] UBI: Use the bit operation with min_io_size
Date: Thu, 22 May 2008 13:31:10 +0300 [thread overview]
Message-ID: <1211452270.31023.31.camel@sauron> (raw)
In-Reply-To: <20080522013218.GA26360@party>
Hi Kyungmin,
you patch looks OK to me and I'll apply it, but with few changes
(see below).
On Thu, 2008-05-22 at 10:32 +0900, Kyungmin Park wrote:
> It already checks the min io size is the power of 2 at io_init.
>
> /* Make sure minimal I/O unit is power of 2 */
I will add a comment here that we do not have any fundamental reason
to require this. It is just an optimization which makes it possible
to avoid costly division operations.
> + n = req->alignment & (ubi->min_io_size - 1);
Probably we could introduce an ubi->min_io_mask variable even. But
this is anyway a subject of a separate change.
> - ubi_assert(len % ubi->min_io_size == 0);
> + ubi_assert(len & (ubi->min_io_size - 1) == 0);
Bitwise & has smaller priority than ==, so I think this should be
ubi_assert((len & (ubi->min_io_size - 1)) == 0); or better
ubi_assert(!(len & (ubi->min_io_size - 1)));
> - ubi_assert(length % ubi->min_io_size == 0);
> + ubi_assert(length & (ubi->min_io_size - 1) == 0);
Similar.
Thank you!
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
prev parent reply other threads:[~2008-05-22 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-22 1:32 [PATCH] UBI: Use the bit operation with min_io_size Kyungmin Park
2008-05-22 10:31 ` Artem Bityutskiy [this message]
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=1211452270.31023.31.camel@sauron \
--to=dedekind@infradead.org \
--cc=ext-adrian.hunter@nokia.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-mtd@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.