[dm-devel] [PATCH 4/4] brd: remove unused brd_zero_page

Mikulas Patocka mpatocka at redhat.com
Wed Oct 26 20:27:57 UTC 2016


Remove the function brd_zero_page. This function was used to zero a page
when the discard request came in.

The discard request is used for performance or space optimization, it
makes no sense to zero pages on discard request, as it neither improves
performance nor saves memory.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 drivers/block/brd.c |   23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

Index: linux-2.6/drivers/block/brd.c
===================================================================
--- linux-2.6.orig/drivers/block/brd.c
+++ linux-2.6/drivers/block/brd.c
@@ -156,19 +156,6 @@ static void brd_free_page(struct brd_dev
 		call_rcu(&page->rcu_head, brd_free_page_rcu);
 }
 
-static void brd_zero_page(struct brd_device *brd, sector_t sector)
-{
-	struct page *page;
-
-	rcu_read_lock();
-
-	page = brd_lookup_page(brd, sector);
-	if (page)
-		clear_highpage(page);
-
-	rcu_read_unlock();
-}
-
 /*
  * Free all backing store pages and radix tree. This must only be called when
  * there are no other users of the device.
@@ -234,15 +221,7 @@ static void discard_from_brd(struct brd_
 	sector += boundary;
 	n_sectors -= boundary;
 	while (n_sectors >= PAGE_SIZE >> SECTOR_SHIFT) {
-		/*
-		 * Don't want to actually discard pages here because
-		 * re-allocating the pages can result in writeback
-		 * deadlocks under heavy load.
-		 */
-		if (1)
-			brd_free_page(brd, sector);
-		else
-			brd_zero_page(brd, sector);
+		brd_free_page(brd, sector);
 		sector += PAGE_SIZE >> SECTOR_SHIFT;
 		n_sectors -= PAGE_SIZE >> SECTOR_SHIFT;
 	}




More information about the dm-devel mailing list