![]() |
Class Set Definition File Syntax |
match volume header
match alternate volume header
match journal
match journal information block
match catalog file
match attributes file
match startup file
match extents file
match allocation file
match bad block file
match files where match-expr
Defines the conditions under which a class will match. If more than one match specification is given for a class, a match of any one of the specifications will cause the class to match.
match may be followed either by the name of a volume data structure, or alternatively by the phrase “files where”, followed by a match expression. We recommend that you avoid the form with the volume data structure names, as it is really intended for use in the built-in class set definitions.
Match expressions are compiled into a form that iDefrag can interpret quickly to keep extent classification fast; most expressions compile and execute quickly, but a few impose a compile time or match-time penalty (there is a table later in this description that lists potentially problematic constructs).
A match-expr or match expression is a Boolean expression consisting of comparisons of properties and values, logical operators and a few other predicates. Currently supported properties are
The operators are for the most part straightforward, with the possible exception of the ~= and ~!= operators (the “match” operators), which aside from their obvious use matching regular expressions against string properties can be used to match bitmasks against numeric properties. For instance, 0b1010 ~= 0b0010 is true, whilst 0b1010 ~= 0b0001 and 0b1010 ~!= 0b1000 are both false. (Note that having constants on both sides of an expression is not actually supported by iDefrag; the example is for illustrative purposes only.) A summary of the available operators is given below, in order of precedence:
iDefrag also supports four predicate expressions, namely:
Certain types of match expression have a substantial effect on performance, either during compilation of the match engine, or at match time when iDefrag is attempting to match file extents with classes. Expressions with unusual performance characteristics are summarized below:
Expression | Performance implications | |
---|---|---|
file is within "folder"
file isn't within "folder" |
At compile time, iDefrag must search folder and all subdirectories to determine a list of catalog IDs for all subfolders. This can be expensive for deep hierarchies (like /usr ).
Once compiled, however, these expressions are evaluated very quickly. |
|
containing folder ~= <regexp>
containing folder ~!= <regexp> name ~= <regexp> name ~!= <regexp> |
Regular expression matching must be performed at match time. | |
name ~= <regexp>
name ~!= <regexp> name >= <string> name > <string> name <= <string> name < <string> |
If <regexp> or <string> starts with a ‘/’ character, it is assumed that it will match a full path. If so, iDefrag must find the full name of each file at match file time for each fragment.
This is very expensive; if you are going to use it, we recommend that you restrict its use to cases where it is really necessary, and try to make use of the lazy and and or operators to avoid evaluation whenever possible. (Note that this problem does not exist for the = and != operators, which are compiled into a more efficient form.) |
|
containing folder ~= <regexp>
containing folder ~!= <regexp> containing folder >= <string> containing folder > <string> containing folder <= <string> containing folder < <string> |
Forces iDefrag to find the full path of each file at match file time.
This is very expensive; if you are going to use it, we recommend that you restrict its use to cases where it is really necessary, and try to make use of the lazy and and or operators to avoid evaluation whenever possible. (Note that this problem does not exist for the = and != operators, which are compiled into a more efficient form.) |
class "BSD" {
match files where file is within "/usr" or file is within "/bin"
match files where file is within "/etc"
color "#ffe000"
}
class "Big" {
match files where size > 1048576
color "#ff00ff"
}