work.hh (fstransform-0.9.3-src) | : | work.hh (fstransform-0.9.4) | ||
---|---|---|---|---|
skipping to change at line 73 | skipping to change at line 73 | |||
ft_eta eta; | ft_eta eta; | |||
T work_total; | T work_total; | |||
/** cannot call copy constructor */ | /** cannot call copy constructor */ | |||
fr_work(const fr_work<T> &); | fr_work(const fr_work<T> &); | |||
/** cannot call assignment operator */ | /** cannot call assignment operator */ | |||
const fr_work<T> & operator=(const fr_work<T> &); | const fr_work<T> & operator=(const fr_work<T> &); | |||
enum { FC_SHOW_DEFAULT_LEVEL = FC_TRACE }; | ||||
/** print extents header to log */ | ||||
static void show(ft_log_level level = (ft_log_level)FC_SHOW_DEFAULT_LEVEL); | ||||
/** print extent contents to log */ | ||||
static void show(ft_size i, T physical, T logical, T length, ft_size user_da | ||||
ta, ft_log_level level = (ft_log_level)FC_SHOW_DEFAULT_LEVEL); | ||||
/** print extent contents to log */ | ||||
static FT_INLINE void show(ft_size i, const map_value_type & extent, ft_log_ | ||||
level level = (ft_log_level)FC_SHOW_DEFAULT_LEVEL) { | ||||
show(i, extent.first.physical, extent.second.logical, extent.second.leng | ||||
th, extent.second.user_data, level); | ||||
} | ||||
public: | ||||
/** print map contents to log */ | ||||
static void show(const char * label1, const char * label2, ft_uoff effective | ||||
_block_size, const fr_map<T> & map, ft_log_level level = (ft_log_level)FC_SHOW_D | ||||
EFAULT_LEVEL); | ||||
private: | ||||
/** | /** | |||
* call check(io) to ensure that io.dev_length() can be represented by T, | * call check(io) to ensure that io.dev_length() can be represented by T, | |||
* then checks that I/O is open. | * then checks that I/O is open. | |||
* if success, stores a reference to I/O object. | * if success, stores a reference to I/O object. | |||
*/ | */ | |||
int init(FT_IO_NS fr_io & io); | int init(FT_IO_NS fr_io & io); | |||
/** | /** | |||
* analysis phase of remapping algorithm, | * analysis phase of remapping algorithm, | |||
* must be executed before create_secondary_storage() and relocate() | * must be executed before create_secondary_storage() and relocate() | |||
skipping to change at line 112 | skipping to change at line 95 | |||
* compute LOOP-FILE extents map and DEVICE in-use extents map | * compute LOOP-FILE extents map and DEVICE in-use extents map | |||
* and stores them into this->loop_map and this->dev_map. | * and stores them into this->loop_map and this->dev_map. | |||
* | * | |||
* assumes that vectors are ordered by extent->logical, and modifies them | * assumes that vectors are ordered by extent->logical, and modifies them | |||
* in place: vector contents will be UNDEFINED when this method returns. | * in place: vector contents will be UNDEFINED when this method returns. | |||
* | * | |||
* implementation: to compute this->dev_map, performs in-place the union of specified | * implementation: to compute this->dev_map, performs in-place the union of specified | |||
* loop_file_extents and free_space_extents, then sorts in-place and complem ents such union. | * loop_file_extents and free_space_extents, then sorts in-place and complem ents such union. | |||
*/ | */ | |||
int analyze(fr_vector<ft_uoff> & loop_file_extents, | int analyze(fr_vector<ft_uoff> & loop_file_extents, | |||
fr_vector<ft_uoff> & free_space_extents); | fr_vector<ft_uoff> & free_space_extents, | |||
fr_vector<ft_uoff> & to_zero_extents); | ||||
/** | /** | |||
* fill io->primary_storage() with DEVICE extents to be actually used as PRI MARY-STORAGE | * fill io->primary_storage() with DEVICE extents to be actually used as PRI MARY-STORAGE | |||
* (already computed into storage_map by analyze()) | * (already computed into storage_map by analyze()) | |||
* | * | |||
* if only a fraction of available PRIMARY-STORAGE will be actually used, | * if only a fraction of available PRIMARY-STORAGE will be actually used, | |||
* exploit a fr_pool<T> to select the largest contiguous extents. | * exploit a fr_pool<T> to select the largest contiguous extents. | |||
* | * | |||
* updates storage_map to contain the PRIMARY-STORAGE extents actually used. | * updates storage_map to contain the PRIMARY-STORAGE extents actually used. | |||
*/ | */ | |||
skipping to change at line 214 | skipping to change at line 198 | |||
fr_work(); | fr_work(); | |||
/** destructor. calls cleanup() */ | /** destructor. calls cleanup() */ | |||
~fr_work(); | ~fr_work(); | |||
/** | /** | |||
* high-level do-everything method. calls in sequence run() and cleanup(). | * high-level do-everything method. calls in sequence run() and cleanup(). | |||
* return 0 if success, else error. | * return 0 if success, else error. | |||
*/ | */ | |||
static int main(fr_vector<ft_uoff> & loop_file_extents, | static int main(fr_vector<ft_uoff> & loop_file_extents, | |||
fr_vector<ft_uoff> & free_space_extents, FT_IO_NS fr_io & io | fr_vector<ft_uoff> & free_space_extents, | |||
); | fr_vector<ft_uoff> & to_zero_extents, | |||
FT_IO_NS fr_io & io); | ||||
/** | /** | |||
* check if LOOP-FILE and DEVICE in-use extents can be represented | * check if LOOP-FILE and DEVICE in-use extents can be represented | |||
* by fr_map<T>. takes into account the fact that all extents | * by fr_map<T>. takes into account the fact that all extents | |||
* physical, logical and length will be divided by effective block size | * physical, logical and length will be divided by effective block size | |||
* before storing them into fr_map<T>. | * before storing them into fr_map<T>. | |||
* | * | |||
* return 0 for check passes, else error (usually EFBIG) | * return 0 for check passes, else error (usually EFBIG) | |||
*/ | */ | |||
static int check(const FT_IO_NS fr_io & io); | static int check(const FT_IO_NS fr_io & io); | |||
/** | /** | |||
* main remapping algorithm. | * main remapping algorithm. | |||
* calls in sequence init(), analyze(), create_secondary_storage() and reloc ate() | * calls in sequence init(), analyze(), create_secondary_storage() and reloc ate() | |||
*/ | */ | |||
int run(fr_vector<ft_uoff> & loop_file_extents, | int run(fr_vector<ft_uoff> & loop_file_extents, | |||
fr_vector<ft_uoff> & free_space_extents, FT_IO_NS fr_io & io); | fr_vector<ft_uoff> & free_space_extents, | |||
fr_vector<ft_uoff> & to_zero_extents, | ||||
FT_IO_NS fr_io & io); | ||||
/** performs cleanup. called by destructor, you can also call it explicitly after (or instead of) run() */ | /** performs cleanup. called by destructor, you can also call it explicitly after (or instead of) run() */ | |||
void cleanup(); | void cleanup(); | |||
}; | }; | |||
FT_NAMESPACE_END | FT_NAMESPACE_END | |||
#ifdef FT_HAVE_EXTERN_TEMPLATE | #ifdef FT_HAVE_EXTERN_TEMPLATE | |||
# define FT_TEMPLATE_work_hh(ft_prefix, T) ft_prefix class FT_NS fr_work< T >; | # define FT_TEMPLATE_work_hh(ft_prefix, T) ft_prefix class FT_NS fr_work< T >; | |||
FT_TEMPLATE_DECLARE(FT_TEMPLATE_work_hh) | FT_TEMPLATE_DECLARE(FT_TEMPLATE_work_hh) | |||
End of changes. 4 change blocks. | ||||
26 lines changed or deleted | 8 lines changed or added |