Directory Hints that control file creation
A new utility has been provided that allows users to easily set hints on directories that control creation of files in that directory. The new utility is
ofs_setdirhint [options] <directory-name> ...
- -h or --help - print this message
- -v or --verbose - print informative messages
- -V or --Version - print Version info
- -i or --interactive - ask before setting hints
- -d or --debug - print debugging info
- -r or --recursive - recurse directories and their contents
These are directory hints (each takes an argument):
- -D or --dist_name - string name of distribution
- -p or --dist_params - string list K:V+K:V ...
- -n or --num_dfiles - int number of dfiles
- -l or --layout - int layout number or layout name
- -L or --server_list - string : list of server numbers
The arguments to option -n is an integer, all other arguments take a string (-l can take an integer or a string). The arguments are as follows:
- -D a string taking the name of the distribution (which must be compiled in) example: -D "simple_stripe"
- -p a list of one or more distribution parameters (depends on the distribution) listed as key:val pairs and delimited by a '+' example: -p "strip_size:65536"
- -n an integer which indicates the number of dfiles to use (may be overridden by distribution or layout) example: -n 8
- -l an integer indicating one of the built-in layouts (from 1..N) or the layout name taken from (none, random, round, list, local) example: -l list
- -L a string of integers delimited by colons ':' the first indicates how many more are in the list (the num_dfiles) and the rest are from (0..N-1) based on the order they appear in the configuration file's data handles section example: -L "4:2:4:6:8"
ofs_setdirhint sets one or more extended attributes on a directory which are referred to whenever a file is created in that directory in order to override default parameters. The distribution controls how data is distributed among dfiles and many have one or more parameters. The default distribution is "simple_stripe" which implements striping with one parameter the "strip_size" which indicates the number of bytes written to one dfile as a block before going to the next dfile and has a default of 65536. This should not be confused with "stripe size" which is the product of strip_size and num_dfiles. The layout controls the selection of servers that will contain a dfile. By default all servers will have one dfile, but other layouts are possible. The default layout is ROUND_ROBIN which uses a random number to select the first server, and then continues sequentially. The RANDOM layout randomly selects all servers. The NONE layout uses exactly one server, and the LOCAL layout uses only a server running on the current node (if there is one). The LIST layout allows the specification of the exact servers and their ordering through the use of list.
The hints set by ofs_setdirhint are regular extended attributes and can be read, written, and removed through the usual interfaces including utilities such as pvfs2-xattr, setfattr, and getfattr. ofs_setdirhint is intended only for setting directory hint extended attributes.
Attribute names are:
All of which have strings for their values (when the hint has an integer argument it is represented as a string).
ofs_setdirhint --layout list --server_list "2:1:3" my_dir
This forces files created in the "my_dir" directory to have 2 dfiles using the (numbered from zero) 2nd and 4th server listed in the config file.