Re: [PATCH 9/9] random: simplify accounting code

2013-12-07 Thread Theodore Ts'o
On Fri, Dec 06, 2013 at 01:25:04PM -0500, Greg Price wrote: > > Sure, that'd be reasonable. I didn't do that mainly because I wanted > to preserve existing behavior wherever possible in these cleanups, to > make them easy to read and review. I'll make that change and apply this patch, thanks.

Re: [PATCH 9/9] random: simplify accounting code

2013-12-06 Thread Greg Price
On Thu, Dec 05, 2013 at 08:13:47PM -0500, Theodore Ts'o wrote: > On Wed, Nov 13, 2013 at 03:08:41AM -0500, Greg Price wrote: > > + if (ibytes && cmpxchg(&r->entropy_count, orig, entropy_count) != orig) > > + goto retry; > > I wonder if we would be better dropping the test for ibytes he

Re: [PATCH 9/9] random: simplify accounting code

2013-12-06 Thread Theodore Ts'o
On Wed, Nov 13, 2013 at 03:08:41AM -0500, Greg Price wrote: > + entropy_count = max_t(int, 0, > + entropy_count - (ibytes << (ENTROPY_SHIFT + 3))); > + if (ibytes && cmpxchg(&r->entropy_count, orig, entropy_count) != orig) > + goto retry; I wonder if w

[PATCH 9/9] random: simplify accounting code

2013-11-13 Thread Greg Price
With this we handle "reserved" in just one place. As a bonus the code becomes less nested, and the "wakeup_write" flag variable becomes unnecessary. The variable "flags" was already unused. This code behaves identically to the previous version except in two pathological cases that don't occur.