From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Mike Frysinger <vapier@gentoo.org>,
Richard Weinberger <richard.weinberger@gmail.com>,
Michael Opdenacker <michael.opdenacker@free-electrons.com>,
linux-mtd@lists.infradead.org,
Piergiorgio Beruto <piergiorgio.beruto@gmail.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>, Willy Tarreau <w@1wt.eu>
Subject: Re: [PATCH v6 1/3] ubi: Introduce block devices for UBI volumes
Date: Tue, 18 Feb 2014 17:32:27 -0300 [thread overview]
Message-ID: <20140218203226.GC13799@localhost> (raw)
In-Reply-To: <1392650551.21319.22.camel@sauron.fi.intel.com>
On Mon, Feb 17, 2014 at 05:22:31PM +0200, Artem Bityutskiy wrote:
> On Sun, 2014-02-16 at 17:03 -0300, Ezequiel Garcia wrote:
> > +static int ubiblock_read(struct ubiblock *dev, char *buffer, int pos, int len)
> > +{
> > + int leb, offset, ret;
> > + int bytes_left = len;
> > + int to_read = len;
>
> "pos" sounds like byte offset, which cannot be true because 'int' would
> be too short type for it.
>
[..]
> > +
> > + pos = blk_rq_pos(req) << 9;
>
> So 'pos' is actually the 512-byte sector number? Would you please better
> name then, something self-documenting like 'sec' or 'sector' ?
>
No, 'pos' is the byte offset. See the << 9, which is the custom
translation from 512-byte sector into byte offset.
I'm completely sure which type to use, size_t ? loff_t ? off_t ?
> > +
> > + /*
> > + * Let's prevent the device from being removed while we're doing I/O
> > + * work. Notice that this means we serialize all the I/O operations,
> > + * but it's probably of no impact given the NAND core serializes
> > + * flash acceses anywafy.
> > + */
> > + mutex_lock(&dev->vol_mutex);
> > + ret = ubiblock_read(dev, req->buffer, pos, len);
> > + mutex_unlock(&dev->vol_mutex);
>
> Would you please a better name for 'vol_mutex'. Just makes me confused
> because this is what we use in UBI to lock the entire volume. And here
> it is different mutex. Let's express the code in clearer terms and use
> something like just 'device_lock' or something which would suggest that
> this is locks the entire ubiblock device.
>
Sure, no problem.
Thanks for the review!
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-02-18 20:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-16 20:03 [PATCH v6 0/3] ubi: Add block interface Ezequiel Garcia
2014-02-16 20:03 ` [PATCH v6 1/3] ubi: Introduce block devices for UBI volumes Ezequiel Garcia
2014-02-17 10:45 ` Artem Bityutskiy
2014-02-17 11:27 ` Ezequiel Garcia
2014-02-17 11:34 ` Willy Tarreau
2014-02-25 15:30 ` Ezequiel Garcia
2014-02-17 15:10 ` Artem Bityutskiy
2014-02-17 15:49 ` Ezequiel Garcia
2014-02-17 15:22 ` Artem Bityutskiy
2014-02-18 20:32 ` Ezequiel Garcia [this message]
2014-02-16 20:04 ` [PATCH v6 2/3] ubi-utils: Add ubiblkvol tool Ezequiel Garcia
2014-02-18 7:54 ` Artem Bityutskiy
2014-02-18 20:20 ` Ezequiel Garcia
2014-02-16 20:04 ` [PATCH v6 3/3] UBI: Add block interface documentation Ezequiel Garcia
2014-02-17 10:19 ` [PATCH v6 0/3] ubi: Add block interface Artem Bityutskiy
2014-02-17 10:48 ` Ezequiel Garcia
2014-02-17 10:53 ` Artem Bityutskiy
2014-02-17 11:11 ` Ezequiel Garcia
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=20140218203226.GC13799@localhost \
--to=ezequiel.garcia@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael.opdenacker@free-electrons.com \
--cc=piergiorgio.beruto@gmail.com \
--cc=richard.weinberger@gmail.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=vapier@gentoo.org \
--cc=w@1wt.eu \
/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.