[Devel] [PATCH RHEL8 COMMIT] ploop: Add argument to ploop_read_delta_metadata()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 2 22:43:33 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.6.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.el8
------>
commit 3a7d7dfed846e4a3610f0a82bacdba42e3677181
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jul 2 22:43:33 2021 +0300

    ploop: Add argument to ploop_read_delta_metadata()
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ==========================
    Parallel async BAT pages submission and improvements
    
    [1-15]:
    https://jira.sw.ru/browse/PSBM-124550
    
    [16-22]:
    following improvements
    
    Kirill Tkhai (22):
          ploop: Remove absolet comment
          ploop: Add md and piwb cross pointers
          ploop: Add @md argument to locate_new_cluster_and_attach_pio()
          ploop: Refactoring in process_one_discard_pio()
          ploop: Pass type argument to ploop_prepare_bat_update()
          ploop: Move md is busy check to delay_if_md_busy()
          ploop: Introduce batch list for md pages writeback
          ploop: Check for md dirty instead of md piwb
          ploop: Reread piwb after ploop_prepare_bat_update()
          ploop: Change argument in ploop_prepare_bat_update()
          ploop: Return md from ploop_prepare_reloc_index_wb()
          ploop: Change arguments and rename ploop_reset_bat_update()
          ploop: Allow parallel wb of md pages
          ploop: Async md writeback
          ploop: Rename ploop_submit_index_wb_sync()
          ploop: Resubmit pios from main kwork
          ploop: Rename process_delta_wb()
          ploop: Do fsync after bat page write
          ploop: Do not iterate excess clusters in notify_delta_merged()
          ploop: Use kvec in ploop_delta_check_header()
          ploop: Add argument to ploop_read_delta_metadata()
          ploop: Underline clu and page is u32
---
 drivers/md/dm-ploop-bat.c | 7 ++++---
 drivers/md/dm-ploop-cmd.c | 4 +---
 drivers/md/dm-ploop.h     | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index ae6b4628d813..53a51871b0b2 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -356,7 +356,7 @@ int convert_bat_entries(u32 *bat_entries, u32 count)
 }
 
 int ploop_read_delta_metadata(struct ploop *ploop, struct file *file,
-			      void **d_hdr)
+			      void **d_hdr, u32 *delta_nr_be_ret)
 {
 	u32 size, delta_nr_be, *delta_bat_entries;
 	struct iov_iter iter;
@@ -391,6 +391,7 @@ int ploop_read_delta_metadata(struct ploop *ploop, struct file *file,
 	delta_bat_entries = *d_hdr + PLOOP_MAP_OFFSET * sizeof(map_index_t);
 	ret = convert_bat_entries(delta_bat_entries, delta_nr_be);
 
+	*delta_nr_be_ret = delta_nr_be;
 out_vfree:
 	if (ret) {
 		vfree(*d_hdr);
@@ -505,10 +506,10 @@ int ploop_add_delta(struct ploop *ploop, u32 level, struct file *file, bool is_r
 		goto out;
 
 	if (!is_raw) {
-		ret = ploop_read_delta_metadata(ploop, file, (void *)&hdr);
+		ret = ploop_read_delta_metadata(ploop, file, (void *)&hdr,
+						&size_in_clus);
 		if (ret)
 			goto out;
-		size_in_clus = le32_to_cpu(hdr->m_Size);
 	} else {
 		size_in_clus = POS_TO_CLU(ploop, file_size);
 	}
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 0bfd759347a8..d1ed50ed4772 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -786,12 +786,10 @@ static int ploop_delta_clusters_merged(struct ploop *ploop, u8 level,
 	/* Reread BAT of deltas[@level + 1] (or [@level - 1]) */
 	file = ploop->deltas[level + forward ? 1 : -1].file;
 
-	ret = ploop_read_delta_metadata(ploop, file, (void *)&d_hdr);
+	ret = ploop_read_delta_metadata(ploop, file, (void *)&d_hdr, &size_in_clus);
 	if (ret)
 		goto out;
 
-	size_in_clus = le32_to_cpu(d_hdr->m_Size);
-
 	ret = ploop_suspend_submitting_pios(ploop);
 	if (ret)
 		goto out;
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 4471c3ecb5df..8bb075b72e3f 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -552,7 +552,7 @@ extern void pio_prepare_offsets(struct ploop *, struct pio *, unsigned int);
 
 extern int ploop_setup_metadata(struct ploop *ploop, struct page *page);
 extern int ploop_read_delta_metadata(struct ploop *ploop, struct file *file,
-				     void **d_hdr);
+				     void **d_hdr, u32 *delta_nr_be);
 extern void ploop_index_wb_init(struct ploop_index_wb *piwb, struct ploop *ploop);
 extern void ploop_call_rw_iter(struct file *file, loff_t pos, unsigned rw,
 			       struct iov_iter *iter, struct pio *pio);


More information about the Devel mailing list