[Devel] [PATCH RH8 05/11] ploop: Cache delta file size

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 21 11:46:28 MSK 2021


Also introduce a variable, which will show preallocations
in next patches.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-bat.c |    2 ++
 drivers/md/dm-ploop.h     |    2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index ffdd82cbc98e..10126ce12473 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -542,6 +542,8 @@ int ploop_add_delta(struct ploop *ploop, u32 level, struct file *file, bool is_r
 	apply_delta_mappings(ploop, deltas, level, (void *)hdr, size_in_clus);
 
 	deltas[level].file = file;
+	deltas[level].file_size = file_size;
+	deltas[level].file_preallocated_area_start = file_size;
 	deltas[level].size_in_clus = size_in_clus;
 	deltas[level].is_raw = is_raw;
 	ret = 0;
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 06dec66a7d62..5e73bed446a5 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -34,6 +34,8 @@ struct ploop_pvd_header {
 
 struct ploop_delta {
 	struct file *file;
+	loff_t file_size;
+	loff_t file_preallocated_area_start;
 	u32 size_in_clus;
 	bool is_raw;
 };




More information about the Devel mailing list