public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: xiaochuan-xu <xiaochuan-xu@cqu.edu.cn>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 2/4] UBI WL-Subsys: Improvement in prot tree
Date: Tue, 09 Dec 2008 14:58:00 +0200	[thread overview]
Message-ID: <1228827480.13686.182.camel@sauron> (raw)
In-Reply-To: <1228823094.2753.14.camel@localhost.localdomain>

On Tue, 2008-12-09 at 19:44 +0800, xiaochuan-xu wrote:
> +/*
> + * It's impossible that the first field of rb_node structure is equal to 0x2
> + * and 0x3, so Ox2 is used to check whether the physical eraseblock is in one
> + * of prot lists or not. 0x3 is used for prot list head's mark.
> + */
> +#define PROT_LIST_NODE 0x2
> +#define PROT_LIST_HEAD 0x3

This is hacky a bit. AFAIK, rb-tree code does have optimizations which
use the lowest bits of pointers, so I am not sure 2 and 3 are completely
impossible. 

But I think this is anyway not needed at all. The only reason you need
this is to quickly find out if the entry is in the protection list or
not, right? And from the code I see the only user of this is the
'paranoid_check_in_prot_lists()' function. But this is just a debugging
function, which is normally compiled out. You do not have to optimize it
at all. Just let it walk the list and check.

So, please, let's get rid of these constants.

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

  parent reply	other threads:[~2008-12-09 13:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1228823094.2753.14.camel@localhost.localdomain>
2008-12-09 11:44 ` [PATCH 2/4] UBI WL-Subsys: Improvement in prot tree xiaochuan-xu
2008-12-09 12:58 ` Artem Bityutskiy [this message]
     [not found]   ` <1228877464.3225.14.camel@localhost.localdomain>
2008-12-10  2:51     ` xiaochuan-xu

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=1228827480.13686.182.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=xiaochuan-xu@cqu.edu.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