Ján Tomko 3f702f5ab1 virStorageFileResize: fallocate the whole capacity
We have been trying to implement the ALLOCATE flag to mean
"the volume should be fully allocated after the resize".

Since commit b0579ed9 we do not allocate from the existing
capacity, but from the existing allocation value.
However this value is a total of all the allocated bytes,
not an offset.

For a sparsely allocated file:
$ perl -e 'print "x"x8192;' > vol1
$ fallocate -p -o 0 -l 4096 vol1
$ virsh vol-info vol1 default
Capacity:       8.00 KiB
Allocation:     4.00 KiB

Treating allocation as an offset would result in an incompletely
allocated file:
$ virsh vol-resize vol1 --pool default 16384 --allocate
Capacity:       16.00 KiB
Allocation:     12.00 KiB

Call fallocate from zero on the whole requested capacity to fully
allocate the file. After that, the volume is fully allocated
after the resize:
$ virsh vol-resize vol1 --pool default 16384 --allocate
$ virsh vol-info vol1 default
Capacity:       16.00 KiB
Allocation:     16.00 KiB
2017-09-27 14:40:44 +02:00
..
2016-06-16 06:17:58 -04:00
2017-08-08 12:19:17 +02:00
2017-08-08 12:19:17 +02:00
2017-05-02 17:27:13 +01:00
2016-11-23 12:08:15 -05:00
2016-02-11 11:35:02 +01:00
2016-06-16 13:09:19 -04:00
2017-01-25 09:18:49 +01:00
2017-05-26 20:00:51 +04:00
2017-07-26 15:31:25 +02:00
2017-07-26 15:31:25 +02:00
2017-01-04 12:47:01 +01:00
2017-05-16 16:48:30 +02:00
2017-06-12 19:11:30 -04:00
2016-08-02 14:20:31 +02:00
2016-08-02 14:20:31 +02:00
2017-04-27 14:13:19 +02:00
2016-10-13 17:58:56 +08:00
2016-03-18 09:43:45 +01:00
2016-07-28 08:27:13 -04:00
2017-03-22 09:01:32 +01:00
2016-11-23 12:08:15 -05:00
2016-12-15 09:25:16 +01:00