From patchwork Mon Mar 22 03:23:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim owens X-Patchwork-Id: 87338 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2M3NpPL018075 for ; Mon, 22 Mar 2010 03:23:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753970Ab0CVDXu (ORCPT ); Sun, 21 Mar 2010 23:23:50 -0400 Received: from mail-qy0-f179.google.com ([209.85.221.179]:59479 "EHLO mail-qy0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753726Ab0CVDXt (ORCPT ); Sun, 21 Mar 2010 23:23:49 -0400 Received: by qyk9 with SMTP id 9so2968670qyk.1 for ; Sun, 21 Mar 2010 20:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=SORu8XZAC2vngTmZSdnyg83inNMMbfTCQIlSO6GboDA=; b=H1i+Q7+OjJFRU4e6eG44zPEEeUvQK1V7l5EJT6XsmdaW8y15JHVK6NhR8Rpur1USeo 3meRcQ0v7MtaKa30OkhKj1XRh956FK8RSgKE4i3K4PJ5xR1TzCBjKdtDeS6L4Evctb+K 8r2AJldfSwXWjkyhWaTOjFxm7Tehy3ZX6oE1o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=CAJ5P/QKV4koqX7oR2zulVpFnady34tN7oW6WBQk2+8wfiafYyQ7bVMtayEEZFExTT XYG1LQTwumFl8nXRCQn4LeBcRxk32Mgmh5k77LkN6vBaEJUGYFJIgVOto54i9o6Qwscy hOvtEux1pJXyllHhfi2kjut5u5ZbecNVMPvxo= Received: by 10.229.241.66 with SMTP id ld2mr2692876qcb.78.1269228228941; Sun, 21 Mar 2010 20:23:48 -0700 (PDT) Received: from [192.168.0.97] (c-24-147-40-65.hsd1.nh.comcast.net [24.147.40.65]) by mx.google.com with ESMTPS id 21sm1354230qyk.1.2010.03.21.20.23.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 21 Mar 2010 20:23:48 -0700 (PDT) Message-ID: <4BA6E2C3.8030904@gmail.com> Date: Sun, 21 Mar 2010 23:23:47 -0400 From: jim owens User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: linux-btrfs Subject: [PATCH V3 06/18] Btrfs: remove dead code for unplugging pages. Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Mar 2010 03:23:51 +0000 (UTC) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 11d0ad3..fe12cf7 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1291,10 +1291,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; @@ -1310,62 +1310,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. diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 39c3299..ebdd10f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2626,10 +2626,10 @@ static int find_live_mirror(struct map_lookup *map, int first, int num, return optimal; } -static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, +int btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, u64 logical, u64 *length, struct btrfs_multi_bio **multi_ret, - int mirror_num, struct page *unplug_page) + int mirror_num) { struct extent_map *em; struct map_lookup *map; @@ -2641,17 +2641,12 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, int i; int num_stripes; int max_errors; - struct btrfs_multi_bio *multi = NULL; + struct btrfs_multi_bio *multi; read_lock(&em_tree->lock); em = lookup_extent_mapping(em_tree, logical, *length); read_unlock(&em_tree->lock); - if (!em && unplug_page) { - kfree(multi); - return 0; - } - if (!em) { printk(KERN_CRIT "unable to find logical %llu len %llu\n", (unsigned long long)logical, @@ -2687,7 +2682,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, *length = min(*length, em->len - offset); } - if (!multi_ret && !unplug_page) + if (!multi_ret) goto out; if (mirror_num > map->num_stripes) @@ -2705,7 +2700,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, num_stripes = 1; stripe_index = 0; if (map->type & BTRFS_BLOCK_GROUP_RAID1) { - if (unplug_page || (rw & (1 << BIO_RW))) + if (rw & (1 << BIO_RW)) num_stripes = map->num_stripes; else if (mirror_num) stripe_index = mirror_num - 1; @@ -2727,7 +2722,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, stripe_index = do_div(stripe_nr, factor); stripe_index *= map->sub_stripes; - if (unplug_page || (rw & (1 << BIO_RW))) + if (rw & (1 << BIO_RW)) num_stripes = map->sub_stripes; else if (mirror_num) stripe_index += mirror_num - 1; @@ -2746,34 +2741,20 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, } BUG_ON(stripe_index >= map->num_stripes); - if (multi_ret) { - multi = kzalloc(btrfs_multi_bio_size(num_stripes), GFP_NOFS); - if (!multi) - return -ENOMEM; - *multi_ret = multi; + multi = kzalloc(btrfs_multi_bio_size(num_stripes), GFP_NOFS); + if (!multi) + return -ENOMEM; + *multi_ret = multi; - atomic_set(&multi->error, 0); - multi->num_stripes = num_stripes; - multi->max_errors = max_errors; - } + atomic_set(&multi->error, 0); + multi->num_stripes = num_stripes; + multi->max_errors = max_errors; for (i = 0; i < num_stripes; i++) { - if (unplug_page) { - struct btrfs_device *device; - struct backing_dev_info *bdi; - - device = map->stripes[stripe_index].dev; - if (device->bdev) { - bdi = blk_get_backing_dev_info(device->bdev); - if (bdi->unplug_io_fn) - bdi->unplug_io_fn(bdi, unplug_page); - } - } else { - multi->stripes[i].physical = - map->stripes[stripe_index].physical + - stripe_offset + stripe_nr * map->stripe_len; - multi->stripes[i].dev = map->stripes[stripe_index].dev; - } + multi->stripes[i].physical = + map->stripes[stripe_index].physical + + stripe_offset + stripe_nr * map->stripe_len; + multi->stripes[i].dev = map->stripes[stripe_index].dev; stripe_index++; } out: @@ -2781,14 +2762,6 @@ out: return 0; } -int btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, - u64 logical, u64 *length, - struct btrfs_multi_bio **multi_ret, int mirror_num) -{ - return __btrfs_map_block(map_tree, rw, logical, length, multi_ret, - mirror_num, NULL); -} - int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree, u64 chunk_start, u64 physical, u64 devid, u64 **logical, int *naddrs, int *stripe_len) @@ -2854,14 +2827,6 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree, return 0; } -int btrfs_unplug_page(struct btrfs_mapping_tree *map_tree, - u64 logical, struct page *page) -{ - u64 length = PAGE_CACHE_SIZE; - return __btrfs_map_block(map_tree, READ, logical, &length, - NULL, 0, page); -} - static void end_bio_multi_stripe(struct bio *bio, int err) { struct btrfs_multi_bio *multi = bio->bi_private; diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 31b0fab..d5aab74 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -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,