[Devel] [PATCH RHEL9 COMMIT] dm-ploop: Remove unused code

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 16 17:48:30 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.28
------>
commit 9c1c1ac3cec5c971fcc7968d7a309a3e7950926b
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Nov 16 17:48:30 2021 +0300

    dm-ploop: Remove unused code
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-bat.c | 89 -----------------------------------------------
 1 file changed, 89 deletions(-)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index 44cbce6f6b40..c84cc939d8c6 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -148,95 +148,6 @@ bool try_update_bat_entry(struct ploop *ploop, u32 clu, u8 level, u32 dst_clu)
 	return false;
 }
 
-#if 0
-/*
- * Clear all clusters, which are referred to in BAT, from holes_bitmap.
- * Set bat_levels[] to top delta's level. Mark unmapped clusters as
- * BAT_ENTRY_NONE.
- */
-static int parse_bat_entries(struct ploop *ploop, map_index_t *bat_entries,
-			     u8 *bat_levels, unsigned int nr,
-			     unsigned int page_id, u8 nr_deltas)
-{
-	int i = 0;
-
-	if (page_id == 0)
-		i = PLOOP_MAP_OFFSET;
-
-	for (; i < nr; i++) {
-		if (bat_entries[i] == BAT_ENTRY_NONE)
-			return -EINVAL;
-		if (bat_entries[i]) {
-			bat_levels[i] = nr_deltas - 1; /* See top_level() */
-			/* Cluster may refer out holes_bitmap after shrinking */
-			if (bat_entries[i] < ploop->hb_nr)
-				ploop_hole_clear_bit(bat_entries[i], ploop);
-		} else {
-			bat_entries[i] = BAT_ENTRY_NONE;
-		}
-	}
-
-	return 0;
-}
-
-/*
- * Read from disk and fill bat_entries. Note, that on enter here, clu #0
- * is already read from disk (with header) -- just parse bio pages content.
- */
-int ploop_read_bat(struct ploop *ploop, struct bio *bio, u8 nr_deltas)
-{
-	unsigned int id, entries_per_page, nr_copy, nr_all, page, i = 0;
-	map_index_t *from, *to, clu = 0;
-	struct md_page *md;
-	int ret = 0;
-
-	entries_per_page = PAGE_SIZE / sizeof(map_index_t);
-	nr_all = ploop->nr_bat_entries + PLOOP_MAP_OFFSET;
-
-	do {
-		for (page = 0; page < nr_pages_in_cluster(ploop); page++) {
-			id = i * sizeof(map_index_t) / PAGE_SIZE;
-			md = md_page_find(ploop, id);
-			if (WARN_ON_ONCE(!md)) {
-				ret = -ENOENT;
-				goto out;
-			}
-
-			nr_copy = entries_per_page;
-			if (i + nr_copy > nr_all)
-				nr_copy = nr_all - i;
-
-			to = kmap(md->page);
-			from = kmap(bio->bi_io_vec[page].bv_page);
-			memcpy(to, from, nr_copy * sizeof(map_index_t));
-			kunmap(bio->bi_io_vec[page].bv_page);
-			if (unlikely(nr_copy < BAT_ENTRIES_PER_PAGE)) {
-				memset(to + nr_copy, 0, sizeof(map_index_t) *
-				       (BAT_ENTRIES_PER_PAGE - nr_copy));
-			}
-
-			ret = parse_bat_entries(ploop, to, md->bat_levels,
-						nr_copy, id, nr_deltas);
-			kunmap(md->page);
-			if (ret)
-				goto out;
-
-			i += nr_copy;
-			if (i >= nr_all)
-				goto out;
-		}
-
-		ret = ploop_read_cluster_sync(ploop, bio, ++clu);
-		if (ret)
-			goto out;
-
-	} while (1);
-
-out:
-	return ret;
-}
-#endif
-
 /* Alloc holes_bitmap and set bits of free clusters */
 static int ploop_setup_holes_bitmap(struct ploop *ploop, u32 bat_clusters)
 {


More information about the Devel mailing list