[Cluster-devel] [PATCH] libgfs2: Improve rgblocks2bitblocks()

Bob Peterson rpeterso at redhat.com
Fri Nov 18 20:52:41 UTC 2011


----- Original Message -----
| This patch reworks the rgblocks2bitblocks function which was
| inefficient, difficult to read and generally unwieldy.
| 
| As this is core code from the days of yore and fsck.gfs2 depends on
| it,
| I made sure to test the new function extensively, comparing its
| outputs
| with the original function over a large range of values for rgblocks
| (up
| to 195312500) and valid block sizes between 512 and 4096.
| 
| All call points have been updated and, as a nice side effect, the run
| time of the function is greatly reduced.
| 
| Signed-off-by: Andrew Price <anprice at redhat.com>
| +	while (blks_rgrp + blks_meta * bitblocks < ((rgblocks - bitblocks)

Hi,

The patch looks good. There's only thing I'd do differently:
I know the implied arithmetic operator order is correct, but
I still prefer to see parens around statements like the above
just for clarity. e.g.

+	while (blks_rgrp + (blks_meta * bitblocks) < ((rgblocks - bitblocks)

I guess that's more of a style thing.

Regards,

Bob Peterson
Red Hat File Systems




More information about the Cluster-devel mailing list