lkml.org 
[lkml]   [2006]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Ext2-devel] Re: [RFC][PATCH 0/3] ext3 percpu counter fixes to suppport for ext3 unsigned long type free blocks counter
On Apr 12, 2006  14:28 -0700, Mingming Cao wrote:
> where the check for unsigned long overflow is only turned on 32 bit
> platforms.
>
> > Or make the counter s64? so that it stays 64 bit on all arches?
> >
>
> Well, don't we have the problem : 64 bit counter add/dec/update is not
> always atomic on all 32 bit platforms? There are risk that we will get
> bogus global value.

My thought here is that the per-cpu counter could still be a 32-bit counter
and the global value could be a 64-bit value. That way, we don't need to
mess with 64-bit math in the common case, and we can still have a 64-bit
global value. The minor drawback would be that we can't have a per-cpu
delta of more than 2^31 at a time, but I don't think this is a worry here.

> > why not change the global per-cpu counter type to unsigned long (as we
> > discussed earlier), so we don't need the extra "ul" flags and interfaces,
> > and all arches get a standard unsigned long return type?
> > We could also
> > do away with percpu_read_positive then no? The applications for per-cpu
> > counters is going to be upcounters always methinks...

The "percpu_read_positive" usage is broken in any case, since it doesn't
correctly handle the case where there is no space in the filesystem at
all. The calling code (ext3_statfs) really needs to just call percpu_read()
and then return zero if this is negative.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

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

\
 
 \ /
  Last update: 2006-04-12 23:52    [W:0.320 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site