[PATCH v5 3/8] btrfs: Factor out enumeration of chunks to a separate function

2011-04-10 Thread Hugo Mills
The main balance function has two loops which are functionally identical in their looping mechanism, but which perform a different operation on the chunks they loop over. To avoid repeating code more than necessary, factor this loop out into a separate iterator function which takes a function

Re: [PATCH v5 3/8] btrfs: Factor out enumeration of chunks to a separate function

2011-04-10 Thread David Sterba
On Sun, Apr 10, 2011 at 10:06:06PM +0100, Hugo Mills wrote: diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index cf019af..20c2772 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2029,6 +2029,97 @@ static u64 div_factor(u64 num, int factor) +static void