int commit_disks(struct final *fin, int (*process_progress)(float progress,ERR_PARAM), int check_only, ERR_PARAM) checks and modifies
partition structure on disks according to
struct final *fin.
It can be called in two modes: `check-only' and `modification' mode.
It only checks correctness of operations demanded by data stored
fin in `check-only' mode. It does not make any modification
on disks. In `modification' mode it also modifies partition structure
if there are no fatal conflicts in data stored in
fin. It also
modifies partition structure case that there are just warnings.
Note that modification of partition structure with warnings is dangerous and
you should always call
commit_disks in `check-only' mode first and
then in `modification' mode to prevent lost of data.
comit_disks is responsible for checking that there is enough
free space to successfully modified partition structure of the disks,
modified partitions are not mounted, there are no illegal operations
not supported by general converter etc. Thus the function is very complex
to ensure that all the conditions for successful conversion are satisfied.
commit_disks processes in several steps:
check_onlineof on-line conversion module to ensure that the support for on-line conversion is compiled into the kernel.
commit_partitionsin `check-only' mode to check that the partition structure is non-conflicting with restrictions special for the selected partition type.
struct partitionfor general converter now; it opens the device, fills in
struct partitionfor imported and exported partitions and deleted partitions are delcared as free space (general converter can store there its data).
nomoveis determined. This flag is one if the only modifications of partition structure are moves of some partitions.
nomoveis one filesystem info (
struct fs_info) is filled for all the imported and exported partitions. Then the validity of newly created filesystem is checked by calling
nomoveis one number of blocks available and needed for conversion is counted.
nomoveis zero the accelaration routine is called and the function then continues with partitioner step.
There are a pretty lot of local variables in function
This is due to the process of checking and modification of partitions
is very complex and a lot of structures are required to be stored and
maintain. Only the variables with special values are listed;
variables used only as an auxiliary ones in for-cycles or when
opening or closing device are not listed.
Number of partitions which are dirty; these are the partitions which were modified or newly created.
Array of `dirtness' flags for all partitions.
Number of partitions on which are stored files which will be used during conversion.
Array of `used files' flags for all partitions.
Number of completely deleted partitions.
Array of `deleted' flags for all partitions.
Number of disks on which some modifications are to be done.
Number of partitions which are to be renamed.
Array of original partitions' names.
Array of new partitions' names.
struct partition of modified partitions prepared
to be passed to the general converter.
struct partition of modified and newly created partitions
prepared to be passed to the general converter.
Number of free space blocks to be passed to the general converter.
struct space of free space blocks prepared to be passed
to the general converter.
Array containing partition information about imported modified partitions.
Array containing filesystem information about imported modified partitions.
Array containing filesystem information about exported modified partitions.
Array containing minimal sizes of new filesystems (whose on exported partitions).
Array containing minimal sizes of internal filesystem structures for new filesystems (whose on exported partitions).
Number of blocks available for conversion.
Number of blocks needed by internal filesystem structures during conversion.
Number of blocks needed to store all data contained in the files during conversion.
There are some special purpose functions called by function
commit during the checking and
conversion process. These functions implements simple technical manipulations with used data structures.
This function initialize
struct fs_info. The structured is filled with values corresponding
to empty filesystem.
This function increases the values stored in the structure passed as the first parameter by values stored in the second parameter structure.
This function returns number of blocks in the intersections of two partitions; if the partitions are disjoint zero is returned.
This function receives array
to free space areas on the disk. The first
from entries are declared as free by user.
This function checks that the entries are disjoint with partition located at
in case that they are not, array
space is appropriately modified.