[Devel] [PATCH RHEL7 COMMIT] ploop: Add .complete_merge method

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 28 12:37:43 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.85.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.85.5
------>
commit 7e86c9f893d30e6e44dc1913c04e2121f5f66ae5
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Mar 28 12:37:40 2019 +0300

    ploop: Add .complete_merge method
    
    It will be used to reallocated holes bitmap
    after merge.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Discard with zeroing of ploop1 indexes support
    
    https://jira.sw.ru/browse/PSBM-92367
    https://pmc.acronis.com/browse/VSTOR-19972
    
    Kirill Tkhai (10):
          ploop: Export map defines to separate header file
          ploop: Make submit_alloc() return int value
          ploop: Introduce ploop_submit_alloc() helper
          ploop: Prohibit discard ioctls
          ploop: Prohibit PLOOP_IOC_UPDATE_INDEX on singular list
          ploop: Introduce data_off_in_clusters() helper
          ploop: Add .complete_merge method
          ploop: Zero indexes on discard
          ploop: Fallocate cluster in cached_submit() during hole reuse
          ploop: Populate and maintain holes bitmap
---
 drivers/block/ploop/dev.c           | 17 ++++++++++++-----
 drivers/block/ploop/io_direct_map.c |  2 ++
 include/linux/ploop/ploop.h         |  1 +
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 57920a93129a..618d22bf02ec 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3762,18 +3762,25 @@ static void ploop_update_fmt_version(struct ploop_device * plo)
 	}
 }
 
-static void ploop_merge_cleanup(struct ploop_device * plo,
-				struct ploop_map * map,
-				struct ploop_delta * delta, int err)
+static void ploop_merge_complete(struct ploop_device * plo,
+				 struct ploop_map * map,
+				 struct ploop_delta * delta, int err)
 {
+	struct ploop_delta *top_delta;
+
 	ploop_quiesce(plo);
 	mutex_lock(&plo->sysfs_mutex);
 	list_del(&delta->list);
 
 	if (err)
 		list_add(&delta->list, &plo->map.delta_list);
-	else
+	else {
+		top_delta = ploop_top_delta(plo);
+		if (top_delta->ops->complete_merge)
+			/* FIXME: How should we handle error here? */
+			top_delta->ops->complete_merge(top_delta);
 		ploop_update_fmt_version(plo);
+	}
 
 	plo->trans_map = NULL;
 	plo->maintenance_type = PLOOP_MNTN_OFF;
@@ -3873,7 +3880,7 @@ static int ploop_merge(struct ploop_device * plo)
 		err = -EIO;
 	}
 
-	ploop_merge_cleanup(plo, map, delta, err);
+	ploop_merge_complete(plo, map, delta, err);
 
 	if (!err) {
 		kobject_del(&delta->kobj);
diff --git a/drivers/block/ploop/io_direct_map.c b/drivers/block/ploop/io_direct_map.c
index bc65e60e72a3..7934bc8ecfb1 100644
--- a/drivers/block/ploop/io_direct_map.c
+++ b/drivers/block/ploop/io_direct_map.c
@@ -620,6 +620,8 @@ static int fallocate_cluster(struct ploop_io *io, struct inode *inode,
 	}
 
 	ret = file->f_op->fallocate(file, FALLOC_FL_KEEP_SIZE, start_off, len);
+	if (!ret)
+		ret = io->ops->sync(io);
 out:
 	return ret;
 }
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index 73141c536f65..a730c2de7873 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -283,6 +283,7 @@ struct ploop_delta_ops
 	int		(*complete_snapshot)(struct ploop_delta *, struct ploop_snapdata *);
 	int		(*prepare_merge)(struct ploop_delta *, struct ploop_snapdata *);
 	int		(*start_merge)(struct ploop_delta *, struct ploop_snapdata *);
+	int		(*complete_merge)(struct ploop_delta *);
 	int		(*truncate)(struct ploop_delta *, struct file *, __u32 alloc_head);
 	int		(*prepare_grow)(struct ploop_delta *, u64 *new_size, int *reloc);
 	int		(*complete_grow)(struct ploop_delta *, u64 new_size);



More information about the Devel mailing list