disk-io.c (97e728d4353f38c87bf0804cdfd79a9b13fc2c3e) disk-io.c (b7967db75a38df4891b22efe1b0969b9357eb946)
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 570 unchanged lines hidden (view full) ---

579 async->bio_flags = bio_flags;
580
581 atomic_inc(&fs_info->nr_async_submits);
582
583 if (rw & (1 << BIO_RW_SYNCIO))
584 btrfs_set_work_high_prio(&async->work);
585
586 btrfs_queue_worker(&fs_info->workers, &async->work);
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 570 unchanged lines hidden (view full) ---

579 async->bio_flags = bio_flags;
580
581 atomic_inc(&fs_info->nr_async_submits);
582
583 if (rw & (1 << BIO_RW_SYNCIO))
584 btrfs_set_work_high_prio(&async->work);
585
586 btrfs_queue_worker(&fs_info->workers, &async->work);
587#if 0
588 int limit = btrfs_async_submit_limit(fs_info);
589 if (atomic_read(&fs_info->nr_async_submits) > limit) {
590 wait_event_timeout(fs_info->async_submit_wait,
591 (atomic_read(&fs_info->nr_async_submits) < limit),
592 HZ/10);
593
587
594 wait_event_timeout(fs_info->async_submit_wait,
595 (atomic_read(&fs_info->nr_async_bios) < limit),
596 HZ/10);
597 }
598#endif
599 while (atomic_read(&fs_info->async_submit_draining) &&
600 atomic_read(&fs_info->nr_async_submits)) {
601 wait_event(fs_info->async_submit_wait,
602 (atomic_read(&fs_info->nr_async_submits) == 0));
603 }
604
605 return 0;
606}

--- 158 unchanged lines hidden (view full) ---

765 printk(KERN_WARNING "btrfs warning page private not zero "
766 "on page %llu\n", (unsigned long long)page_offset(page));
767 ClearPagePrivate(page);
768 set_page_private(page, 0);
769 page_cache_release(page);
770 }
771}
772
588 while (atomic_read(&fs_info->async_submit_draining) &&
589 atomic_read(&fs_info->nr_async_submits)) {
590 wait_event(fs_info->async_submit_wait,
591 (atomic_read(&fs_info->nr_async_submits) == 0));
592 }
593
594 return 0;
595}

--- 158 unchanged lines hidden (view full) ---

754 printk(KERN_WARNING "btrfs warning page private not zero "
755 "on page %llu\n", (unsigned long long)page_offset(page));
756 ClearPagePrivate(page);
757 set_page_private(page, 0);
758 page_cache_release(page);
759 }
760}
761
773#if 0
774static int btree_writepage(struct page *page, struct writeback_control *wbc)
775{
776 struct buffer_head *bh;
777 struct btrfs_root *root = BTRFS_I(page->mapping->host)->root;
778 struct buffer_head *head;
779 if (!page_has_buffers(page)) {
780 create_empty_buffers(page, root->fs_info->sb->s_blocksize,
781 (1 << BH_Dirty)|(1 << BH_Uptodate));
782 }
783 head = page_buffers(page);
784 bh = head;
785 do {
786 if (buffer_dirty(bh))
787 csum_tree_block(root, bh, 0);
788 bh = bh->b_this_page;
789 } while (bh != head);
790 return block_write_full_page(page, btree_get_block, wbc);
791}
792#endif
793
794static struct address_space_operations btree_aops = {
795 .readpage = btree_readpage,
796 .writepage = btree_writepage,
797 .writepages = btree_writepages,
798 .releasepage = btree_releasepage,
799 .invalidatepage = btree_invalidatepage,
800 .sync_page = block_sync_page,
801};

--- 471 unchanged lines hidden (view full) ---

1273}
1274
1275static int btrfs_congested_fn(void *congested_data, int bdi_bits)
1276{
1277 struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data;
1278 int ret = 0;
1279 struct btrfs_device *device;
1280 struct backing_dev_info *bdi;
762static struct address_space_operations btree_aops = {
763 .readpage = btree_readpage,
764 .writepage = btree_writepage,
765 .writepages = btree_writepages,
766 .releasepage = btree_releasepage,
767 .invalidatepage = btree_invalidatepage,
768 .sync_page = block_sync_page,
769};

--- 471 unchanged lines hidden (view full) ---

1241}
1242
1243static int btrfs_congested_fn(void *congested_data, int bdi_bits)
1244{
1245 struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data;
1246 int ret = 0;
1247 struct btrfs_device *device;
1248 struct backing_dev_info *bdi;
1281#if 0
1282 if ((bdi_bits & (1 << BDI_write_congested)) &&
1283 btrfs_congested_async(info, 0))
1284 return 1;
1285#endif
1249
1286 list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
1287 if (!device->bdev)
1288 continue;
1289 bdi = blk_get_backing_dev_info(device->bdev);
1290 if (bdi && bdi_congested(bdi, bdi_bits)) {
1291 ret = 1;
1292 break;
1293 }

--- 1035 unchanged lines hidden (view full) ---

2329 btrfs_stop_workers(&fs_info->delalloc_workers);
2330 btrfs_stop_workers(&fs_info->workers);
2331 btrfs_stop_workers(&fs_info->endio_workers);
2332 btrfs_stop_workers(&fs_info->endio_meta_workers);
2333 btrfs_stop_workers(&fs_info->endio_meta_write_workers);
2334 btrfs_stop_workers(&fs_info->endio_write_workers);
2335 btrfs_stop_workers(&fs_info->submit_workers);
2336
1250 list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
1251 if (!device->bdev)
1252 continue;
1253 bdi = blk_get_backing_dev_info(device->bdev);
1254 if (bdi && bdi_congested(bdi, bdi_bits)) {
1255 ret = 1;
1256 break;
1257 }

--- 1035 unchanged lines hidden (view full) ---

2293 btrfs_stop_workers(&fs_info->delalloc_workers);
2294 btrfs_stop_workers(&fs_info->workers);
2295 btrfs_stop_workers(&fs_info->endio_workers);
2296 btrfs_stop_workers(&fs_info->endio_meta_workers);
2297 btrfs_stop_workers(&fs_info->endio_meta_write_workers);
2298 btrfs_stop_workers(&fs_info->endio_write_workers);
2299 btrfs_stop_workers(&fs_info->submit_workers);
2300
2337#if 0
2338 while (!list_empty(&fs_info->hashers)) {
2339 struct btrfs_hasher *hasher;
2340 hasher = list_entry(fs_info->hashers.next, struct btrfs_hasher,
2341 hashers);
2342 list_del(&hasher->hashers);
2343 crypto_free_hash(&fs_info->hash_tfm);
2344 kfree(hasher);
2345 }
2346#endif
2347 btrfs_close_devices(fs_info->fs_devices);
2348 btrfs_mapping_tree_free(&fs_info->mapping_tree);
2349
2350 bdi_destroy(&fs_info->bdi);
2351
2352 kfree(fs_info->extent_root);
2353 kfree(fs_info->tree_root);
2354 kfree(fs_info->chunk_root);

--- 128 unchanged lines hidden ---
2301 btrfs_close_devices(fs_info->fs_devices);
2302 btrfs_mapping_tree_free(&fs_info->mapping_tree);
2303
2304 bdi_destroy(&fs_info->bdi);
2305
2306 kfree(fs_info->extent_root);
2307 kfree(fs_info->tree_root);
2308 kfree(fs_info->chunk_root);

--- 128 unchanged lines hidden ---