[Devel] [PATCH RH9 v2 0/8] allow to seek holes in block devices

2023-08-16 Thread Andrey Zhadchenko
We need to be able to know if and where the image is sparse during backups. Implement blockdev and dm infrastructure, add an ability to find holes for dm-qcow2, dm-ploop, dm-push-backup After this patches llseek with SEEK_HOLES and SEEK_DATA can be used with block devices Feature: dm: implement SE

[Devel] [PATCH RH9 v2 8/8] dm/dm-ploop: add llseek_hole

2023-08-16 Thread Andrey Zhadchenko
Implement find_hole() for dm-ploop target. Iterate over clusters until we find hole or data by using ploop_bat_entries() which will do all our work Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- drivers/md

[Devel] [PATCH RH9 v2 2/8] dm: add llseek_hole infrastructure

2023-08-16 Thread Andrey Zhadchenko
Add new function to target_type, so any dm devices may realize it Implement intermediate llseek_hole() on device-mapper layer, do some simple checks. Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- v2: fix

[Devel] [PATCH RH9 v2 5/8] dm/dm-qcow2: add llseek_hole

2023-08-16 Thread Andrey Zhadchenko
Implement llseek_hole() for dm-qcow2 target. Iterate over ranges with cluster granularity until hole or data is found. To reduce code duplication, we should use already existing parse_metadata() We can pretend that seek request is read request for metadata purposes and than interpret parsing result

[Devel] [PATCH RH9 v2 6/8] dm/dm-ploop: reinforce some defines

2023-08-16 Thread Andrey Zhadchenko
Add braces around arguments so callers can use equations while calling these macros. Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- drivers/md/dm-ploop.h | 8 1 file changed, 4 insertions(+), 4 de

[Devel] [PATCH RH9 v2 7/8] dm/dm-ploop: allow to check if cluster is locked

2023-08-16 Thread Andrey Zhadchenko
When looking for SEEK_HOLE, we would like to check if cluster is locked without valid pio Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- drivers/md/dm-ploop-map.c | 2 +- 1 file changed, 1 insertion(+), 1

[Devel] [PATCH RH9 v2 4/8] dm/dm-qcow2: add calc_front_qio_bytes() helper

2023-08-16 Thread Andrey Zhadchenko
Move code that calculates qio front bytes type and amount into a new helper. It will be used later for llseek_hole() Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- drivers/md/dm-qcow2-map.c | 46 ++

[Devel] [PATCH RH9 v2 3/8] dm/push_backup: add llseek_hole proxy

2023-08-16 Thread Andrey Zhadchenko
push_backup dm module llseek_hole() should just call the same function from it's origin bdev Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- drivers/md/dm-push-backup.c | 12 1 file changed, 12

[Devel] [PATCH RH9 v2 1/8] block/fops: add llseek_hole to blockdevops

2023-08-16 Thread Andrey Zhadchenko
Add new function for block_device_operations, which will be used for SEEK_HOLE and SEEK_DATA llseek calls Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop https://jira.vzint.dev/browse/PSBM-145746 Signed-off-by: Andrey Zhadchenko --- v2: fix critical bug: do not (SEEK_HOLE | SEEK_DATA)