[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120522131059.415a881c.akpm@linux-foundation.org>
Date: Tue, 22 May 2012 13:10:59 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Tomasz Stanislawski <t.stanislaws@...sung.com>
Cc: paul.gortmaker@...driver.com,
'박경민'
<kyungmin.park@...sung.com>, amwang@...hat.com,
dri-devel@...ts.freedesktop.org,
"'???/Mobile S/W Platform Lab.(???)/E3(??)/????'"
<inki.dae@...sung.com>, prashanth.g@...sung.com,
Marek Szyprowski <m.szyprowski@...sung.com>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Rob Clark <rob@...com>, Dave Airlie <airlied@...hat.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andy Whitcroft <apw@...dowen.org>,
Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH v3] scatterlist: add sg_alloc_table_from_pages function
On Mon, 21 May 2012 16:01:50 +0200
Tomasz Stanislawski <t.stanislaws@...sung.com> wrote:
> >> +int sg_alloc_table_from_pages(struct sg_table *sgt,
> >> + struct page **pages, unsigned int n_pages,
> >> + unsigned long offset, unsigned long size,
> >> + gfp_t gfp_mask)
> >
> > I guess a 32-bit n_pages is OK. A 16TB IO seems enough ;)
> >
>
> Do you think that 'unsigned long' for offset is too big?
>
> Ad n_pages. Assuming that Moore's law holds it will take
> circa 25 years before the limit of 16 TB is reached :) for
> high-end scatterlist operations.
> Or I can change the type of n_pages to 'unsigned long' now at
> no cost :).
By then it will be Someone Else's Problem ;)
> >> +{
> >> + unsigned int chunks;
> >> + unsigned int i;
> >
> > erk, please choose a different name for this. When a C programmer sees
> > "i", he very much assumes it has type "int". Making it unsigned causes
> > surprise.
> >
> > And don't rename it to "u"! Let's give it a nice meaningful name. pageno?
> >
>
> The problem is that 'i' is a natural name for a loop counter.
It's also the natural name for an integer. If a C programmer sees "i",
he thinks "int". It's a Fortran thing ;)
> AFAIK, in the kernel code developers try to avoid Hungarian notation.
> A name of a variable should reflect its purpose, not its type.
> I can change the name of 'i' to 'pageno' and 'j' to 'pageno2' (?)
> but I think it will make the code less reliable.
Well, one could do something radical such as using "p".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists