aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-06-15 21:08:07 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-06-15 21:08:07 -0400
commit7eef4091a653c243a87e5375c54504cc03bec4d8 (patch)
treef65b77f830b2c8f7d014512badfef5df0d591ee9 /fs/btrfs/disk-io.c
parent0a93a47f042c459f0f46942c3a920e3c81878031 (diff)
parent07a2039b8eb0af4ff464efd3dfd95de5c02648c6 (diff)
Merge commit 'v2.6.30' into for-2.6.31
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c95
1 files changed, 30 insertions, 65 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a6b83744b05d..4b0ea0b80c23 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -232,10 +232,14 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
232 memcpy(&found, result, csum_size); 232 memcpy(&found, result, csum_size);
233 233
234 read_extent_buffer(buf, &val, 0, csum_size); 234 read_extent_buffer(buf, &val, 0, csum_size);
235 printk(KERN_INFO "btrfs: %s checksum verify failed " 235 if (printk_ratelimit()) {
236 "on %llu wanted %X found %X level %d\n", 236 printk(KERN_INFO "btrfs: %s checksum verify "
237 root->fs_info->sb->s_id, 237 "failed on %llu wanted %X found %X "
238 buf->start, val, found, btrfs_header_level(buf)); 238 "level %d\n",
239 root->fs_info->sb->s_id,
240 (unsigned long long)buf->start, val, found,
241 btrfs_header_level(buf));
242 }
239 if (result != (char *)&inline_result) 243 if (result != (char *)&inline_result)
240 kfree(result); 244 kfree(result);
241 return 1; 245 return 1;
@@ -268,10 +272,13 @@ static int verify_parent_transid(struct extent_io_tree *io_tree,
268 ret = 0; 272 ret = 0;
269 goto out; 273 goto out;
270 } 274 }
271 printk("parent transid verify failed on %llu wanted %llu found %llu\n", 275 if (printk_ratelimit()) {
272 (unsigned long long)eb->start, 276 printk("parent transid verify failed on %llu wanted %llu "
273 (unsigned long long)parent_transid, 277 "found %llu\n",
274 (unsigned long long)btrfs_header_generation(eb)); 278 (unsigned long long)eb->start,
279 (unsigned long long)parent_transid,
280 (unsigned long long)btrfs_header_generation(eb));
281 }
275 ret = 1; 282 ret = 1;
276 clear_extent_buffer_uptodate(io_tree, eb); 283 clear_extent_buffer_uptodate(io_tree, eb);
277out: 284out:
@@ -415,9 +422,12 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
415 422
416 found_start = btrfs_header_bytenr(eb); 423 found_start = btrfs_header_bytenr(eb);
417 if (found_start != start) { 424 if (found_start != start) {
418 printk(KERN_INFO "btrfs bad tree block start %llu %llu\n", 425 if (printk_ratelimit()) {
419 (unsigned long long)found_start, 426 printk(KERN_INFO "btrfs bad tree block start "
420 (unsigned long long)eb->start); 427 "%llu %llu\n",
428 (unsigned long long)found_start,
429 (unsigned long long)eb->start);
430 }
421 ret = -EIO; 431 ret = -EIO;
422 goto err; 432 goto err;
423 } 433 }
@@ -429,8 +439,10 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
429 goto err; 439 goto err;
430 } 440 }
431 if (check_tree_block_fsid(root, eb)) { 441 if (check_tree_block_fsid(root, eb)) {
432 printk(KERN_INFO "btrfs bad fsid on block %llu\n", 442 if (printk_ratelimit()) {
433 (unsigned long long)eb->start); 443 printk(KERN_INFO "btrfs bad fsid on block %llu\n",
444 (unsigned long long)eb->start);
445 }
434 ret = -EIO; 446 ret = -EIO;
435 goto err; 447 goto err;
436 } 448 }
@@ -584,18 +596,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
584 btrfs_set_work_high_prio(&async->work); 596 btrfs_set_work_high_prio(&async->work);
585 597
586 btrfs_queue_worker(&fs_info->workers, &async->work); 598 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 599
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 while (atomic_read(&fs_info->async_submit_draining) &&
600 atomic_read(&fs_info->nr_async_submits)) { 601 atomic_read(&fs_info->nr_async_submits)) {
601 wait_event(fs_info->async_submit_wait, 602 wait_event(fs_info->async_submit_wait,
@@ -770,27 +771,6 @@ static void btree_invalidatepage(struct page *page, unsigned long offset)
770 } 771 }
771} 772}
772 773
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 = { 774static struct address_space_operations btree_aops = {
795 .readpage = btree_readpage, 775 .readpage = btree_readpage,
796 .writepage = btree_writepage, 776 .writepage = btree_writepage,
@@ -868,8 +848,6 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
868 848
869 if (ret == 0) 849 if (ret == 0)
870 set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags); 850 set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags);
871 else
872 WARN_ON(1);
873 return buf; 851 return buf;
874 852
875} 853}
@@ -1278,11 +1256,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
1278 int ret = 0; 1256 int ret = 0;
1279 struct btrfs_device *device; 1257 struct btrfs_device *device;
1280 struct backing_dev_info *bdi; 1258 struct backing_dev_info *bdi;
1281#if 0 1259
1282 if ((bdi_bits & (1 << BDI_write_congested)) &&
1283 btrfs_congested_async(info, 0))
1284 return 1;
1285#endif
1286 list_for_each_entry(device, &info->fs_devices->devices, dev_list) { 1260 list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
1287 if (!device->bdev) 1261 if (!device->bdev)
1288 continue; 1262 continue;
@@ -1604,6 +1578,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1604 fs_info->btree_inode = new_inode(sb); 1578 fs_info->btree_inode = new_inode(sb);
1605 fs_info->btree_inode->i_ino = 1; 1579 fs_info->btree_inode->i_ino = 1;
1606 fs_info->btree_inode->i_nlink = 1; 1580 fs_info->btree_inode->i_nlink = 1;
1581 fs_info->metadata_ratio = 8;
1607 1582
1608 fs_info->thread_pool_size = min_t(unsigned long, 1583 fs_info->thread_pool_size = min_t(unsigned long,
1609 num_online_cpus() + 2, 8); 1584 num_online_cpus() + 2, 8);
@@ -1694,7 +1669,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1694 if (features) { 1669 if (features) {
1695 printk(KERN_ERR "BTRFS: couldn't mount because of " 1670 printk(KERN_ERR "BTRFS: couldn't mount because of "
1696 "unsupported optional features (%Lx).\n", 1671 "unsupported optional features (%Lx).\n",
1697 features); 1672 (unsigned long long)features);
1698 err = -EINVAL; 1673 err = -EINVAL;
1699 goto fail_iput; 1674 goto fail_iput;
1700 } 1675 }
@@ -1704,7 +1679,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1704 if (!(sb->s_flags & MS_RDONLY) && features) { 1679 if (!(sb->s_flags & MS_RDONLY) && features) {
1705 printk(KERN_ERR "BTRFS: couldn't mount RDWR because of " 1680 printk(KERN_ERR "BTRFS: couldn't mount RDWR because of "
1706 "unsupported option features (%Lx).\n", 1681 "unsupported option features (%Lx).\n",
1707 features); 1682 (unsigned long long)features);
1708 err = -EINVAL; 1683 err = -EINVAL;
1709 goto fail_iput; 1684 goto fail_iput;
1710 } 1685 }
@@ -2296,7 +2271,7 @@ int close_ctree(struct btrfs_root *root)
2296 2271
2297 if (fs_info->delalloc_bytes) { 2272 if (fs_info->delalloc_bytes) {
2298 printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", 2273 printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n",
2299 fs_info->delalloc_bytes); 2274 (unsigned long long)fs_info->delalloc_bytes);
2300 } 2275 }
2301 if (fs_info->total_ref_cache_size) { 2276 if (fs_info->total_ref_cache_size) {
2302 printk(KERN_INFO "btrfs: at umount reference cache size %llu\n", 2277 printk(KERN_INFO "btrfs: at umount reference cache size %llu\n",
@@ -2333,16 +2308,6 @@ int close_ctree(struct btrfs_root *root)
2333 btrfs_stop_workers(&fs_info->endio_write_workers); 2308 btrfs_stop_workers(&fs_info->endio_write_workers);
2334 btrfs_stop_workers(&fs_info->submit_workers); 2309 btrfs_stop_workers(&fs_info->submit_workers);
2335 2310
2336#if 0
2337 while (!list_empty(&fs_info->hashers)) {
2338 struct btrfs_hasher *hasher;
2339 hasher = list_entry(fs_info->hashers.next, struct btrfs_hasher,
2340 hashers);
2341 list_del(&hasher->hashers);
2342 crypto_free_hash(&fs_info->hash_tfm);
2343 kfree(hasher);
2344 }
2345#endif
2346 btrfs_close_devices(fs_info->fs_devices); 2311 btrfs_close_devices(fs_info->fs_devices);
2347 btrfs_mapping_tree_free(&fs_info->mapping_tree); 2312 btrfs_mapping_tree_free(&fs_info->mapping_tree);
2348 2313