Re: [PATCH 1/2] ext3 percpu counter fixes to suppport for morethan 2**31 ext3 free blocks counter

From: Mingming Cao
Date: Mon Apr 24 2006 - 13:48:43 EST


On Fri, 2006-04-21 at 15:09 -0700, Andrew Morton wrote:
> Mingming Cao <cmm@xxxxxxxxxx> wrote:
> >
> > The following patches are to fix the percpu counter issue support more
> > than 2**31 blocks for ext3, i.e. allow the ext3 free block accounting
> > works with more than 8TB storage.
> >
> > [PATCH 1] - Generic perpcu longlong type counter support: global counter
> > type changed from long to long long. The local counter is still remains
> > 32 bit (long type), so we could avoid doing 64 bit update in most cases.
> > Fixed the percpu_counter_read_positive() to handle the 0 value counter
> > correctly;Add support to initialize the global counter to a value that
> > are greater than 2**32.
>
> I think it would be saner to explicitly specify the size of the field.
> That means using s32 and s64 throughout this code.
>

Agree. Will use s64 in this code. As s32 has the same issue with what we
have(unsigned long) on 32 bit machine today: it is not enough for ext3
to support more than 2**31 free blocks, and also obviously not enough
for 64 bit ext3 that Laurent is working on.

> That'll actually save space on 64-bit machines, where we're presently doing
> alloc_percpu(long) when all we need is alloc_percpu(s32).
>
> We'd need to review all users of this interface to make sure that they
> handle the changed sizes appropriately, too.

I looked at the all users of percpu counter that are currently in
mainline(2.6.17-rc1) and in mm tree(2.6.17-rc1-mm2), they are:

1. ext2 free blocks/inodes/dirs
(int type, to be changed to unsinged long)
2. ext3 free blocks/inodes/dirs
(int type, changing to unsigned long or unsigned long long)
3. nr_files
(currently int type)
4. decnet_memory allocated
(was atomic_t type in mainline, changed to percpu counter type in mm)
5. tcp_memory allocated
(was atomic_t type, changed to percpu counter type in mm tree)

I could be wrong, but I think there will be no effect to change the size
of the global counter from "long" to s64 for above percpu counter users,
except gives the counter more room to grow. Kiran, what do you think?
Did I miss any other users of the perpcu counters?

Mingming

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/