linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Kevin Cernekee <cernekee@gmail.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/2] mtd: nand: renumber conflicting BBT flags
Date: Mon, 04 Apr 2011 10:52:06 +0300	[thread overview]
Message-ID: <1301903526.2760.38.camel@localhost> (raw)
In-Reply-To: <4D96D875.9000809@gmail.com>

On Sat, 2011-04-02 at 01:04 -0700, Brian Norris wrote:
> Hello,
> 
> On 3/31/2011 5:58 AM, Artem Bityutskiy wrote:
> > Hmm, it seems that the issue is that flags which belong to the same
> > "space" should be in a single file. AFAICS, we have 2 spaces:
> > 
> > 1. Chip flags
> > 2. BBT flags
> > 
> > They are 2 different things. But some of the flags are shared. And this
> > is quite subtle thing.
> > 
> > What I think we should do instead is to avoid sharing the same symbolic
> > constant between 2 different spaces. Is this possible?
> 
> I'm not quite sure. Many of the "shared" options go into the
> nand_chip.options field only so that they can later be copied to a
> nand_bbt_descr.options field. I think this is only out of convenience so
> that we can detect chip-based BBT options like 'scan 2nd page' before we
> have actually allocated and assigned our bbt descriptors. For these
> flags, we can use a new field in nand_chip, like a
> "nand_chip.bbm_options". Then, many shared flags would really become
> "early BBT flags" that could safely be copied over without conflict.

I think it might even be better to kill the options field and instead
introduce bit-fields like:

unsigned int bbt_scan_byte_1and6:1
unsigned int bbt_scan_2nd_page:1
... and so on for all possible flags ...

And of course put sensible comments.

The only caveat is that this is a bit error-prone because users of these
bit-fields may mistakenly decide they are atomic and have nasty race
condition when changing them simultaneously from different threads. But
it does not look like this is of our concern in MTD case.

What do you think?

> Does this make any sense or are there holes in my idea here? I can try
> an RFC patch soon if that would help.

Yes, that makes sense for me for sure. Please, send the patch!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  reply	other threads:[~2011-04-04  7:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19  4:53 [PATCH 1/2] mtd: nand: renumber conflicting BBT flags Brian Norris
2011-03-19  4:53 ` [PATCH 2/2] mtd: nand: dynamic allocation of flash-based BBT structs Brian Norris
2011-03-31 12:58 ` [PATCH 1/2] mtd: nand: renumber conflicting BBT flags Artem Bityutskiy
2011-04-02  8:04   ` Brian Norris
2011-04-04  7:52     ` Artem Bityutskiy [this message]
2011-04-20  7:13       ` [RFC] mtd: nand: separate chip options / bbt_options Brian Norris
2011-04-22  8:02         ` Artem Bityutskiy
2011-05-25 18:15           ` Brian Norris
2011-05-26  8:04             ` Sebastian Andrzej Siewior
2011-05-31 17:25               ` Brian Norris
2011-04-04  7:58 ` [PATCH 1/2] mtd: nand: renumber conflicting BBT flags Artem Bityutskiy

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=1301903526.2760.38.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=cernekee@gmail.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --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 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).