io_posix.hh (fstransform-0.9.3-src) | : | io_posix.hh (fstransform-0.9.4) | ||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
/** return device major/minor numbers, or 0 if not known */ | /** return device major/minor numbers, or 0 if not known */ | |||
FT_INLINE ft_dev dev_blkdev() const { return this_dev_blkdev; } | FT_INLINE ft_dev dev_blkdev() const { return this_dev_blkdev; } | |||
/** return true if this I/O has open descriptors/streams to LOOP-FILE and FR EE-SPACE */ | /** return true if this I/O has open descriptors/streams to LOOP-FILE and FR EE-SPACE */ | |||
bool is_open_extents() const; | bool is_open_extents() const; | |||
/* return (-)EOVERFLOW if request from/to + length overflow specified maximu m value */ | /* return (-)EOVERFLOW if request from/to + length overflow specified maximu m value */ | |||
static int validate(const char * type_name, ft_uoff type_max, fr_dir_posix d ir, ft_uoff from, ft_uoff to, ft_uoff length); | static int validate(const char * type_name, ft_uoff type_max, fr_dir_posix d ir, ft_uoff from, ft_uoff to, ft_uoff length); | |||
/** | /** | |||
* retrieve LOOP-FILE extents and FREE-SPACE extents and insert them into | * retrieve LOOP-FILE extents and any additional extents to be ZEROED | |||
* the vectors loop_file_extents and free_space_extents. | * and insert them into the vectors loop_file_extents, and to_zero_extents | |||
* the vectors will be ordered by extent ->logical. | * the vectors will be ordered by extent ->logical (for to_zero_extents, ->p | |||
hysical and ->logical will be the same). | ||||
* | * | |||
* return 0 for success, else error (and vectors contents will be UNDEFINED) . | * return 0 for success, else error (and vectors contents will be UNDEFINED) . | |||
* | * | |||
* if success, also returns in ret_effective_block_size_log2 the log2() | * if success, also update the parameter ret_effective_block_size_log2 to be | |||
the log2() | ||||
* of device effective block size (see read_extents() for detailed meaning o | ||||
f this parameter) | ||||
*/ | ||||
int read_extents_loop_file(fr_vector<ft_uoff> & loop_file_extents, | ||||
fr_vector<ft_uoff> & to_zero_extents, | ||||
ft_uoff & ret_block_size_bitmask); | ||||
/** | ||||
* retrieve FREE-SPACE extents and any additional extents to be ZEROED | ||||
* and insert them into the vectors free_space_extents, and to_zero_extents | ||||
* the vectors will be ordered by extent ->logical (for to_zero_extents, ->p | ||||
hysical and ->logical will be the same). | ||||
* | ||||
* return 0 for success, else error (and vectors contents will be UNDEFINED) | ||||
. | ||||
* | ||||
* if success, also update the parameter ret_effective_block_size_log2 to be | ||||
the log2() | ||||
* of device effective block size (see read_extents() for detailed meaning o | ||||
f this parameter) | ||||
*/ | ||||
int read_extents_free_space(const fr_vector<ft_uoff> & loop_file_extents, | ||||
fr_vector<ft_uoff> & free_space_extents, | ||||
fr_vector<ft_uoff> & to_zero_extents, | ||||
ft_uoff & ret_block_size_bitmask); | ||||
/** | ||||
* retrieve LOOP-FILE extents, FREE-SPACE extents and any additional extents | ||||
to be ZEROED | ||||
* and insert them into the vectors loop_file_extents, free_space_extents an | ||||
d to_zero_extents | ||||
* the vectors will be ordered by extent ->logical (for to_zero_extents, ->p | ||||
hysical and ->logical will be the same). | ||||
* | ||||
* return 0 for success, else error (and vectors contents will be UNDEFINED) | ||||
. | ||||
* | ||||
* if success, also update the parameter ret_effective_block_size_log2 to be | ||||
the log2() | ||||
* of device effective block size. | * of device effective block size. | |||
* the device effective block size is defined as follows: | * the device effective block size is defined as follows: | |||
* it is the largest power of 2 that exactly divides all physical, | * it is the largest power of 2 that exactly divides all physical, | |||
* logical and lengths in all returned extents (both for LOOP-FILE | * logical and lengths in all returned extents (both for LOOP-FILE | |||
* and for FREE-SPACE) and that also exactly exactly divides device length. | * and for FREE-SPACE) and that also exactly exactly divides device length. | |||
* | * | |||
* the trick fr_io_posix uses to implement this method | * the trick fr_io_posix uses to implement this method | |||
* is to fill the device's free space with a ZERO-FILE, | * is to fill the device's free space with a ZERO-FILE, | |||
* and actually retrieve the extents used by ZERO-FILE. | * and actually retrieve the extents used by ZERO-FILE. | |||
*/ | */ | |||
virtual int read_extents(fr_vector<ft_uoff> & loop_file_extents, | virtual int read_extents(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, | ||||
ft_uoff & ret_block_size_bitmask); | ft_uoff & ret_block_size_bitmask); | |||
/** | /** | |||
* replace a part of the mmapped() storage_mmap area with specified storage_ extent, | * replace a part of the mmapped() storage_mmap area with specified storage_ extent, | |||
* and store mmapped() address into storage_extent.user_data(). | * and store mmapped() address into storage_extent.user_data(). | |||
* return 0 if success, else error. | * return 0 if success, else error. | |||
* | * | |||
* note: fd shoud be this->fd[FC_DEVICE] for primary storage, | * note: fd shoud be this->fd[FC_DEVICE] for primary storage, | |||
* or this->fd[FC_SECONDARY_STORAGE] for secondary storage | * or this->fd[FC_SECONDARY_STORAGE] for secondary storage | |||
*/ | */ | |||
int replace_storage_mmap(int fd, const char * label, fr_extent<ft_uoff> & st orage_extent, | int replace_storage_mmap(int fd, const char * label, fr_extent<ft_uoff> & st orage_extent, | |||
ft_size extent_index, ft_size & mem_offset); | ft_size extent_index, ft_size & mem_offset); | |||
/** | /** | |||
* create and open SECONDARY-STORAGE in job.job_dir() + '.storage.bin' | * create and open SECONDARY-STORAGE in job.job_dir() + '.storage.bin' | |||
* and fill it with 'secondary_len' bytes of zeros. do not mmap() it. | * and fill it with 'secondary_len' bytes of zeros. do not mmap() it. | |||
* return 0 if success, else error | * return 0 if success, else error | |||
*/ | */ | |||
int create_secondary_storage(ft_size secondary_len); | int create_secondary_storage(ft_size secondary_len); | |||
/** | /** | |||
* actually copy a list of fragments from DEVICE to STORAGE, or from STORAGE or DEVICE, or from DEVICE to DEVICE. | * actually copy a list of fragments from DEVICE to STORAGE, or from STORAGE or DEVICE, or from DEVICE to DEVICE. | |||
skipping to change at line 177 | skipping to change at line 207 | |||
virtual int zero_bytes(fr_to to, ft_uoff offset, ft_uoff length); | virtual int zero_bytes(fr_to to, ft_uoff offset, ft_uoff length); | |||
public: | public: | |||
/** constructor */ | /** constructor */ | |||
fr_io_posix(fr_persist & persist); | fr_io_posix(fr_persist & persist); | |||
/** destructor. calls close() */ | /** destructor. calls close() */ | |||
virtual ~fr_io_posix(); | virtual ~fr_io_posix(); | |||
/** check for consistency and open DEVICE, LOOP-FILE and ZERO-FILE */ | /** check for consistency and open DEVICE, LOOP-FILE and ZERO-FILE */ | |||
int open(const fr_args & args); | virtual int open(const fr_args & args); | |||
/** return true if this fr_io_posix is currently (and correctly) open */ | /** return true if this fr_io_posix is currently (and correctly) open */ | |||
virtual bool is_open() const; | virtual bool is_open() const; | |||
/** close this I/O, including file descriptors to DEVICE, LOOP-FILE, ZERO-FI LE and SECONDARY-STORAGE */ | /** close this I/O, including file descriptors to DEVICE, LOOP-FILE, ZERO-FI LE and SECONDARY-STORAGE */ | |||
virtual void close(); | virtual void close(); | |||
/** | /** | |||
* close the file descriptors for LOOP-FILE and ZERO-FILE | * close the file descriptors for LOOP-FILE and ZERO-FILE | |||
*/ | */ | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 48 lines changed or added |