mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [patch 1/2 -mm] flex_array: introduce DEFINE_FLEX_ARRAY
Date: Wed, 02 Sep 2009 10:26:42 -0700	[thread overview]
Message-ID: <1251912402.12395.634.camel@nimitz> (raw)
In-Reply-To: <alpine.DEB.1.00.0909012013180.13377@chino.kir.corp.google.com>

On Tue, 2009-09-01 at 20:14 -0700, David Rientjes wrote:
> @@ -152,7 +136,8 @@ static unsigned int index_inside_part(struct
> flex_array *fa,
>  {
>         unsigned int part_offset;
> 
> -       part_offset = element_nr % __elements_per_part(fa->element_size);
> +       part_offset = element_nr %
> +                               FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size);
>         return part_offset * fa->element_size;
>  }

This all looks pretty good.  The only issue is that the macro name
lengths have gotten a bit out of hand.  

For instance.  This:

#define FLEX_ARRAY_ELEMENTS_PER_PART(size)                             \
       (FLEX_ARRAY_PART_SIZE / size)

ends up being longer in practice than just open-coding the operation:

	FLEX_ARRAY_ELEMENTS_PER_PART(fa->element_size)                      

vs.

	(FLEX_ARRAY_PART_SIZE / fa->element_size)

and the length also ends up making for a couple of pretty ugly line
wraps.

Otherwise, this is fine with me.

Acked-by: Dave Hansen <dave@linux.vnet.ibm.com>

-- Dave


  parent reply	other threads:[~2009-09-02 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02  3:14 David Rientjes
2009-09-02  3:14 ` [patch 2/2 -mm] flex_array: add missing kerneldoc annotations David Rientjes
2009-09-02 17:26 ` Dave Hansen [this message]
2009-09-02 18:51   ` [patch 1/2 -mm] flex_array: introduce DEFINE_FLEX_ARRAY David Rientjes

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=1251912402.12395.634.camel@nimitz \
    --to=dave@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /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

all inboxes | Powered by JetHome®