Re: [Ext2-devel] [PATCH 2/2] ext2/3: Support2^32-1blocks(e2fsprogs)

From: Laurent Vivier
Date: Wed Mar 29 2006 - 04:10:58 EST


Le mar 28/03/2006 Ã 20:01, Mingming Cao a Ãcrit :
> On Tue, 2006-03-28 at 09:15 +0200, Laurent Vivier wrote:
> > Le mar 28/03/2006 Ã 00:58, Ravikiran G Thirumalai a Ãcrit :
> > > On Mon, Mar 27, 2006 at 01:10:49PM -0800, Andrew Morton wrote:
> > > > Mingming Cao <cmm@xxxxxxxxxx> wrote:
> > > > >
> > > > > I am wondering if we have (or plan to have) "long long " type of percpu
> > > > > counters? Andrew, Kiran, do you know?
> > > > >
> > > > > It seems right now the percpu counters are used mostly by ext2/3 for
> > > > > filesystem free blocks accounting. Right now the counter is "long" type,
> > > > > which is not enough if we want to extend the filesystem limit from 2**31
> > > > > to 2**32 on 32 bit machine.
> > > > >
> > > > > The patch from Takashi copies the whole percpu_count.h and create a new
> > > > > percpu_llcounter.h to support longlong type percpu counters. I am
> > > > > wondering is there any better way for this?
> > > > >
> > > >
> > > > I can't immediately think of anything smarter.
> > > >
> > > > One could of course implement a 64-bit percpu counter by simply
> > > > concatenating two 32-bit counters. That would be a little less efficient,
> > > > but would introduce less source code and would mean that we don't need to
> > > > keep two different implemetations in sync. But one would need to do a bit
> > > > of implementation, see how bad it looks.
> > >
> > > Since long long is 64 bits on both 32bit and 64 bit arches, we can just
> > > change percpu_counter type to long long (or s64) and just have one
> > > implementation of percpu_counter?
> > > But reads and writes on 64 bit counters may not be atomic on all 32 bit arches.
> > > So the implementation might have to be reviewed for that.
> >
> > As 64bit per cpu counter is used only by ext3 and needed only on 64bit
> > architecture and when CONFIG_LBD is set, perhaps we can have only one
> > implementation, 32bit in the case of 32bit arch and 64bit in the case of
> > 64bit arch + LBD, as I did in my 64bit patches for ext3 ?
> >
>
> The current percpu counter on 32 bit machine is "long", a signed value.
> It's a problem for ext3 on 32 bit arch also, as the total number of free
> blocks in ext3 is a type of u32. Isn't it? Did I miss something?

You're right, Mingming.

But I think instead of thinking to change "long" by "long long" we
should think about changing "long" by "unsigned long" in the per-cpu
counter structure.

Is there someone knowing why this counter is signed ?

Laurent
--
Laurent Vivier
Bull, Architect of an Open World (TM)
http://www.bullopensource.org/ext4

Attachment: signature.asc
Description: Ceci est une partie de message=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e=2E?=