[Ocfs2-tools-devel] [PATCH] libocfs2: Add ocfs2_feature_foreach()

Tao Ma tao.ma at oracle.com
Fri Jul 25 07:47:18 PDT 2008



Joel Becker wrote:
> The ocfs2_parse_feature() function will include dependent features when
> used.  For example, if you ask it to parse "unwritten", it will return a
> feature set that includes both unwritten extents and sparse files,
> because unwritten extents depends on sparse files.  The same is true in
> reverse.  If you ask it "nosparse", it will return a reverse set that
> includes sparse files and every thing that depends on it.
> 
> However, the caller has no way of knowing which feature needs to be
> added or removed first.  A naively ordered program might try to add
> unwritten extents before sparse files.  That will fail.
> 
> We introduce ocfs2_feature_foreach() and
> ocfs2_feature_reverse_foreach().  These functions take a feature set and
> iterate over it, calling a supplied callback once per feature.  The
> former function does it in "set" order, the latter obviously in "clear"
> or reverse order.
> 
> This depends on the previous patch "Clearing features should clear their
> dependencies".
> 
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
This patch is really cool.
Signed-off-by: Tao Ma <tao.ma at oracle.com>



More information about the Ocfs2-tools-devel mailing list