Skip to contentSkip to conversation

Btrfs: remove dead code for unplugging pages.

RFC PATCH In review jim owens 1 participant 1 message Jan 4, 2010 Btrfs file system

lore
Share & tools
lore

jim owens

author
#0 lore raw

RFC PATCH 5/12 Btrfs: remove dead code for unplugging pages.

The code in btrfs_unplug_io_fn() to selectively unplug just the stripes affected by a page had been previously disabled. The unneeded code for unplug_page in __btrfs_map_block made changes for btrfs directio more difficult so I'm removing all of it.

---
 fs/btrfs/disk-io.c |   62 ++---------------------------------------------
 fs/btrfs/volumes.c |   67 +++++++++++++--------------------------------------
 fs/btrfs/volumes.h |    2 -
 3 files changed, 20 insertions(+), 111 deletions(-)
fs/btrfs/disk-io.c +3 -59
index 009e3bd..72c08fa 100644
@@ -1289,10 +1289,10 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
 }
 
 /*
- * this unplugs every device on the box, and it is only used when page
- * is null
+ * this unplugs every device on the box, and yes that is ugly
+ * but there are currently no low cost alternatives
  */
-static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
+static void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
 {
 	struct btrfs_device *device;
 	struct btrfs_fs_info *info;
@@ -1308,62 +1308,6 @@ static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
 	}
 }
 
-static void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
-{
-	struct inode *inode;
-	struct extent_map_tree *em_tree;
-	struct extent_map *em;
-	struct address_space *mapping;
-	u64 offset;
-
-	/* the generic O_DIRECT read code does this */
-	if (1 || !page) {
-		__unplug_io_fn(bdi, page);
-		return;
-	}
-
-	/*
-	 * page->mapping may change at any time.  Get a consistent copy
-	 * and use that for everything below
-	 */
-	smp_mb();
-	mapping = page->mapping;
-	if (!mapping)
-		return;
-
-	inode = mapping->host;
-
-	/*
-	 * don't do the expensive searching for a small number of
-	 * devices
-	 */
-	if (BTRFS_I(inode)->root->fs_info->fs_devices->open_devices <= 2) {
-		__unplug_io_fn(bdi, page);
-		return;
-	}
-
-	offset = page_offset(page);
-
-	em_tree = &BTRFS_I(inode)->extent_tree;
-	read_lock(&em_tree->lock);
-	em = lookup_extent_mapping(em_tree, offset, PAGE_CACHE_SIZE);
-	read_unlock(&em_tree->lock);
-	if (!em) {
-		__unplug_io_fn(bdi, page);
-		return;
-	}
-
-	if (em->block_start >= EXTENT_MAP_LAST_BYTE) {
-		free_extent_map(em);
-		__unplug_io_fn(bdi, page);
-		return;
-	}
-	offset = offset - em->start;
-	btrfs_unplug_page(&BTRFS_I(inode)->root->fs_info->mapping_tree,
-			  em->block_start + offset, page);
-	free_extent_map(em);
-}
-
 /*
  * If this fails, caller must call bdi_destroy() to get rid of the
  * bdi again.
fs/btrfs/volumes.c +17 -50

125 lines not on this page · raw message

fs/btrfs/volumes.h +0 -2
index 31b0fab..d5aab74 100644
@@ -169,8 +169,6 @@ int btrfs_add_device(struct btrfs_trans_handle *trans,
 int btrfs_rm_device(struct btrfs_root *root, char *device_path);
 int btrfs_cleanup_fs_uuids(void);
 int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len);
-int btrfs_unplug_page(struct btrfs_mapping_tree *map_tree,
-		      u64 logical, struct page *page);
 int btrfs_grow_device(struct btrfs_trans_handle *trans,
 		      struct btrfs_device *device, u64 new_size);
 struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid,
Signature · 1 line
1.5.6.3