[Devel] [PATCH RHEL7 COMMIT] ploop: rename extent maps management funtions

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jan 11 06:14:33 PST 2016


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.20
------>
commit e874b67c2d89b333633fb143cf92b35493623421
Author: Alexey V. Vissarionov <gremlin at gremlin.ru>
Date:   Mon Jan 11 18:13:03 2016 +0400

    ploop: rename extent maps management funtions
    
    Functions extent_map_init(), extent_map_exit() and alloc_extent_map()
    from drivers/block/ploop/io_direct_map.c had conflicting names versus
    fs/btrfs/extent_map.c when kernel is built with CONFIG_BTRFS_FS.
    
    Said that, they are renamed to ploop_*
    
    Signed-off-by: Alexey V. Vissarionov <gremlin at gremlin.ru>
    Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 drivers/block/ploop/io_direct.c     | 38 ++++++++++++++++----------------
 drivers/block/ploop/io_direct_map.c | 44 ++++++++++++++++++-------------------
 drivers/block/ploop/io_direct_map.h |  6 ++---
 3 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 0183b0f..cfd7882 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -141,7 +141,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 
 		if (em->start <= sec)
 			sec = em->end;
-		extent_put(em);
+		ploop_extent_put(em);
 
 		while (sec < end) {
 			em = extent_lookup_create(io, sec, end - sec);
@@ -151,7 +151,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 				goto write_unint_fail;
 
 			sec = em->end;
-			extent_put(em);
+			ploop_extent_put(em);
 		}
 
 		goto write_unint;
@@ -187,7 +187,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 		}
 
 		if (sec >= em->end) {
-			extent_put(em);
+			ploop_extent_put(em);
 			em = extent_lookup_create(io, sec, size);
 			if (IS_ERR(em))
 				goto out_em_err;
@@ -230,7 +230,7 @@ flush_bio:
 		size -= copy >> 9;
 		sec += copy >> 9;
 	}
-	extent_put(em);
+	ploop_extent_put(em);
 
 	bio_num = 0;
 	while (bl.head) {
@@ -272,7 +272,7 @@ write_unint:
 	goto out;
 
 write_unint_fail:
-	extent_put(em);
+	ploop_extent_put(em);
 	err = -EIO;
 	ploop_msg_once(io->plo, "A part of cluster is in uninitialized extent.");
 	goto out;
@@ -566,7 +566,7 @@ dio_submit_pad(struct ploop_io *io, struct ploop_request * preq,
 		}
 
 		if (sec >= em->end) {
-			extent_put(em);
+			ploop_extent_put(em);
 			em = extent_lookup_create(io, sec, end_sec - sec);
 			if (IS_ERR(em))
 				goto out_em_err;
@@ -600,7 +600,7 @@ flush_bio:
 		BUG_ON(plen == 0);
 		sec += plen;
 	}
-	extent_put(em);
+	ploop_extent_put(em);
 
 	while (bl.head) {
 		unsigned long rw;
@@ -1029,7 +1029,7 @@ dio_sync_io(struct ploop_io * io, int rw, struct page * page,
 
 		if (!em || sec >= em->end) {
 			if (em)
-				extent_put(em);
+				ploop_extent_put(em);
 			em = extent_lookup_create(io, sec, len>>9);
 			if (IS_ERR(em))
 				goto out_em_err;
@@ -1062,7 +1062,7 @@ flush_bio:
 	}
 
 	if (em)
-		extent_put(em);
+		ploop_extent_put(em);
 
 	while (bl.head) {
 		struct bio * b = bl.head;
@@ -1150,7 +1150,7 @@ dio_sync_iovec(struct ploop_io * io, int rw, struct page ** pvec,
 
 		if (!em || sec >= em->end) {
 			if (em)
-				extent_put(em);
+				ploop_extent_put(em);
 			em = extent_lookup_create(io, sec, len>>9);
 			if (IS_ERR(em))
 				goto out_em_err;
@@ -1186,7 +1186,7 @@ flush_bio:
 	}
 
 	if (em)
-		extent_put(em);
+		ploop_extent_put(em);
 
 	while (bl.head) {
 		struct bio * b = bl.head;
@@ -1383,7 +1383,7 @@ dio_io_page(struct ploop_io * io, unsigned long rw,
 
 		if (!em || sec >= em->end) {
 			if (em)
-				extent_put(em);
+				ploop_extent_put(em);
 			em = extent_lookup_create(io, sec, len>>9);
 			if (IS_ERR(em))
 				goto out_em_err;
@@ -1416,7 +1416,7 @@ flush_bio:
 	}
 
 	if (em)
-		extent_put(em);
+		ploop_extent_put(em);
 
 	bio_num = 0;
 	while (bl.head) {
@@ -1508,7 +1508,7 @@ dio_fastmap(struct ploop_io * io, struct bio * orig_bio,
 
 	if (isec + (orig_bio->bi_size>>9) > em->end) {
 		io->plo->st.fast_neg_shortem++;
-		extent_put(em);
+		ploop_extent_put(em);
 		return 1;
 	}
 
@@ -1518,7 +1518,7 @@ dio_fastmap(struct ploop_io * io, struct bio * orig_bio,
 	       orig_bio->bi_vcnt * sizeof(struct bio_vec));
 
 	bio->bi_sector = dio_isec_to_phys(em, isec);
-	extent_put(em);
+	ploop_extent_put(em);
 
 	bio->bi_bdev = io->files.bdev;
 	bio->bi_rw = orig_bio->bi_rw;
@@ -1566,7 +1566,7 @@ dio_disable_merge(struct ploop_io * io, sector_t isector, unsigned int len)
 	if (em) {
 		if (isector + len > em->end)
 			ret = 1;
-		extent_put(em);
+		ploop_extent_put(em);
 	}
 	return ret;
 }
@@ -1898,11 +1898,11 @@ static int __init pio_direct_mod_init(void)
 	if (min_extent_map_entries == 0)
 		min_extent_map_entries = 64;
 
-	err = extent_map_init();
+	err = ploop_extent_map_init();
 	if (!err) {
 		err = ploop_register_io(&ploop_io_ops_direct);
 		if (err)
-			extent_map_exit();
+			ploop_extent_map_exit();
 	}
 
 	return err;
@@ -1911,7 +1911,7 @@ static int __init pio_direct_mod_init(void)
 static void __exit pio_direct_mod_exit(void)
 {
 	ploop_unregister_io(&ploop_io_ops_direct);
-	extent_map_exit();
+	ploop_extent_map_exit();
 	BUG_ON(atomic_long_read(&ploop_io_images_size));
 }
 
diff --git a/drivers/block/ploop/io_direct_map.c b/drivers/block/ploop/io_direct_map.c
index 977adc2..1146133 100644
--- a/drivers/block/ploop/io_direct_map.c
+++ b/drivers/block/ploop/io_direct_map.c
@@ -220,7 +220,7 @@ int ploop_dio_upgrade(struct ploop_io * io)
 
 static struct kmem_cache *extent_map_cache;
 
-int __init extent_map_init(void)
+int __init ploop_extent_map_init(void)
 {
 	extent_map_cache = kmem_cache_create("ploop_itree",
 						sizeof(struct extent_map), 0,
@@ -234,7 +234,7 @@ int __init extent_map_init(void)
 	return 0;
 }
 
-void extent_map_exit(void)
+void ploop_extent_map_exit(void)
 {
 	if (extent_map_cache)
 		kmem_cache_destroy(extent_map_cache);
@@ -248,7 +248,7 @@ static void extent_map_tree_init(struct extent_map_tree *tree)
 	rwlock_init(&tree->lock);
 }
 
-struct extent_map *alloc_extent_map(gfp_t mask)
+struct extent_map *ploop_alloc_extent_map(gfp_t mask)
 {
 	struct extent_map *em;
 
@@ -261,7 +261,7 @@ struct extent_map *alloc_extent_map(gfp_t mask)
 	return em;
 }
 
-void extent_put(struct extent_map *em)
+void ploop_extent_put(struct extent_map *em)
 {
 	if (!em)
 		return;
@@ -435,7 +435,7 @@ static int add_extent_mapping(struct extent_map_tree *tree,
 			rb_erase(rb, &tree->map);
 			list_del_init(&tmp->lru_link);
 			tree->map_size--;
-			extent_put(tmp);
+			ploop_extent_put(tmp);
 		} else {
 			list_add_tail(&em->lru_link, &tree->lru_list);
 			tree->map_size++;
@@ -456,7 +456,7 @@ static int add_extent_mapping(struct extent_map_tree *tree,
 				list_del_init(&victim_em->lru_link);
 				tree->map_size--;
 				rb_erase(&victim_em->rb_node, &tree->map);
-				extent_put(victim_em);
+				ploop_extent_put(victim_em);
 			}
 		}
 	} while (rb);
@@ -474,7 +474,7 @@ static int add_extent_mapping(struct extent_map_tree *tree,
 				rb_erase(&merge->rb_node, &tree->map);
 				list_del_init(&merge->lru_link);
 				tree->map_size--;
-				extent_put(merge);
+				ploop_extent_put(merge);
 			}
 		}
 	}
@@ -488,7 +488,7 @@ static int add_extent_mapping(struct extent_map_tree *tree,
 			rb_erase(&merge->rb_node, &tree->map);
 			list_del_init(&merge->lru_link);
 			tree->map_size--;
-			extent_put(merge);
+			ploop_extent_put(merge);
 		}
 	}
 
@@ -600,11 +600,11 @@ again:
 		} else if (!create) {
 			return em;
 		}
-		extent_put(em);
+		ploop_extent_put(em);
 	}
 	BUG_ON(gfp_mask & GFP_ATOMIC);
 
-	em = alloc_extent_map(gfp_mask);
+	em = ploop_alloc_extent_map(gfp_mask);
 	if (!em)
 		return ERR_PTR(-ENOMEM);
 
@@ -619,7 +619,7 @@ again:
 	 */
 	ret = tree->_get_extent(inode, start, len, &nstart, &result, create);
 	if (ret < 0) {
-		extent_put(em);
+		ploop_extent_put(em);
 		return ERR_PTR(ret);
 	}
 
@@ -629,7 +629,7 @@ again:
 
 	ret = add_extent_mapping(tree, em);
 	if (ret == -EEXIST) {
-		extent_put(em);
+		ploop_extent_put(em);
 		goto again;
 	}
 	return em;
@@ -661,7 +661,7 @@ again:
 		} else {
 			return em;
 		}
-		extent_put(em);
+		ploop_extent_put(em);
 	}
 
 	BUG_ON(gfp_mask & GFP_ATOMIC);
@@ -669,7 +669,7 @@ again:
 	if (!inode->i_op->fiemap)
 		return ERR_PTR(-EINVAL);
 
-	em = alloc_extent_map(gfp_mask);
+	em = ploop_alloc_extent_map(gfp_mask);
 	if (!em)
 		return ERR_PTR(-ENOMEM);
 
@@ -704,7 +704,7 @@ again:
 	set_fs(old_fs);
 
 	if (ret) {
-		extent_put(em);
+		ploop_extent_put(em);
 		return ERR_PTR(ret);
 	}
 
@@ -714,7 +714,7 @@ again:
 				       " (mapped=%d i_size=%llu off=%llu)",
 				       fieinfo.fi_extents_mapped,
 				       i_size_read(inode), start_off);
-		extent_put(em);
+		ploop_extent_put(em);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -728,7 +728,7 @@ again:
 
 		ret = add_extent_mapping(tree, em);
 		if (ret == -EEXIST) {
-			extent_put(em);
+			ploop_extent_put(em);
 			goto again;
 		}
 	}
@@ -782,7 +782,7 @@ struct extent_map *map_extent_get_block(struct ploop_io *io,
 			break;
 
 		last = em->end;
-		extent_put(em);
+		ploop_extent_put(em);
 		em = __map_extent(io, mapping, last, len, create,
 				  gfp_mask, get_block);
 		if (IS_ERR(em) || !em)
@@ -795,7 +795,7 @@ struct extent_map *map_extent_get_block(struct ploop_io *io,
 	if (!em || IS_ERR(em) || em->start > start ||
 	    start + len > em->end) {
 		if (em && !IS_ERR(em))
-			extent_put(em);
+			ploop_extent_put(em);
 		em = __map_extent(io, mapping, start, len, create,
 				  gfp_mask, get_block);
 	}
@@ -824,7 +824,7 @@ static int drop_extent_map(struct extent_map_tree *tree)
 		rb_erase(node, &tree->map);
 		list_del_init(&em->lru_link);
 		tree->map_size--;
-		extent_put(em);
+		ploop_extent_put(em);
 	}
 	write_unlock_irq(&tree->lock);
 	return 0;
@@ -838,10 +838,10 @@ void trim_extent_mappings(struct extent_map_tree *tree, sector_t start)
 		remove_extent_mapping(tree, em);
 		WARN_ON(atomic_read(&em->refs) != 2);
 		/* once for us */
-		extent_put(em);
+		ploop_extent_put(em);
 		/* No concurrent lookups due to ploop_quiesce(). See WARN_ON above */
 		/* once for the tree */
-		extent_put(em);
+		ploop_extent_put(em);
 	}
 }
 
diff --git a/drivers/block/ploop/io_direct_map.h b/drivers/block/ploop/io_direct_map.h
index fa0face..4be1c5c 100644
--- a/drivers/block/ploop/io_direct_map.h
+++ b/drivers/block/ploop/io_direct_map.h
@@ -42,7 +42,7 @@ struct extent_map *extent_lookup_create(struct ploop_io *io,
 					sector_t start, sector_t len);
 struct extent_map *extent_lookup(struct extent_map_tree *tree,
 				 sector_t start);
-void extent_put(struct extent_map *em);
+void ploop_extent_put(struct extent_map *em);
 
 struct extent_map *map_extent_get_block(struct ploop_io *io,
 					struct address_space *mapping,
@@ -55,7 +55,7 @@ struct extent_map_tree * ploop_dio_open(struct ploop_io * io, int rdonly);
 void ploop_dio_downgrade(struct address_space * mapping);
 int ploop_dio_upgrade(struct ploop_io * io);
 
-int __init extent_map_init(void);
-void extent_map_exit(void);
+int __init ploop_extent_map_init(void);
+void ploop_extent_map_exit(void);
 
 #endif


More information about the Devel mailing list