[RHEL8,COMMIT] ploop: Save info about ploop->deltas[0] (base image) is raw

Submitted by Konstantin Khorenko on Dec. 10, 2019, 3:12 p.m.

Details

Message ID 201912101512.xBAFC43C023747@finist_co8.work.ct
State New
Series "ploop: Save info about ploop->deltas[0] (base image) is raw"
Headers show

Commit Message

Konstantin Khorenko Dec. 10, 2019, 3:12 p.m.
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.6
------>
commit 1e2ff61520614a72d734cc9a36f9e025b096cb4b
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Tue Dec 10 18:12:04 2019 +0300

    ploop: Save info about ploop->deltas[0] (base image) is raw
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/md/dm-ploop-cmd.c | 6 ++++--
 drivers/md/dm-ploop.h     | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 651f8a78972d..c57d2187c634 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -500,6 +500,7 @@  static void process_add_delta_cmd(struct ploop *ploop, struct ploop_cmd *cmd)
 	map_index_t *bat_entries, *delta_bat_entries;
 	unsigned int i, level, dst_cluster;
 	u8 *bat_levels;
+	bool is_raw;
 
 	if (unlikely(ploop->force_link_inflight_bios)) {
 		cmd->retval = -EBUSY;
@@ -511,6 +512,7 @@  static void process_add_delta_cmd(struct ploop *ploop, struct ploop_cmd *cmd)
 	bat_entries = ploop->bat_entries;
 	bat_levels = ploop->bat_levels;
 	delta_bat_entries = (map_index_t *)cmd->add_delta.hdr + PLOOP_MAP_OFFSET;
+	is_raw = cmd->add_delta.deltas[level].is_raw;
 
 	write_lock_irq(&ploop->bat_rwlock);
 
@@ -518,7 +520,7 @@  static void process_add_delta_cmd(struct ploop *ploop, struct ploop_cmd *cmd)
 	for (i = 0; i < ploop->nr_bat_entries; i++) {
 		if (cluster_is_in_top_delta(ploop, i))
 			continue;
-		if (!cmd->add_delta.is_raw)
+		if (!is_raw)
 			dst_cluster = delta_bat_entries[i];
 		else
 			dst_cluster = i < cmd->add_delta.raw_clusters ? i : BAT_ENTRY_NONE;
@@ -597,13 +599,13 @@  int ploop_add_delta(struct ploop *ploop, const char *arg)
 	size = level * sizeof(*deltas);
 	memcpy(deltas, ploop->deltas, size);
 	deltas[level].file = file;
+	deltas[level].is_raw = is_raw;
 	/*
 	 * BAT update in general is driven by the kwork
 	 * (see comment in process_one_deferred_bio()),
 	 * so we delegate the cmd to it.
 	 */
 	cmd.add_delta.deltas = deltas;
-	cmd.add_delta.is_raw = is_raw;
 	cmd.type = PLOOP_CMD_ADD_DELTA;
 	cmd.ploop = ploop;
 
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 4934959eb7a5..7c6dfccfb3f5 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -33,6 +33,7 @@  struct ploop_pvd_header {
 
 struct ploop_delta {
 	struct file *file;
+	bool is_raw;
 };
 
 struct ploop_cmd {
@@ -70,7 +71,6 @@  struct ploop_cmd {
 			struct ploop_delta *deltas;
 			void *hdr; /* hdr and bat_entries consequentially */
 			unsigned int raw_clusters;
-			bool is_raw;
 		} add_delta;
 		struct {
 #define NR_MERGE_BIOS			64