diff options
author | Chris Mason <chris.mason@oracle.com> | 2012-05-30 11:55:38 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-05-30 11:55:38 -0400 |
commit | cfc442b69696b593cb442f09997dcb4cb5748171 (patch) | |
tree | 84a28a271ad14a695507df65af4ac0c83e64217c /fs/btrfs/disk-io.c | |
parent | 76e10d158efb6d4516018846f60c2ab5501900bc (diff) | |
parent | 48235a68a3d1db579fc20d9915815228a1825757 (diff) |
Merge branch 'for-chris' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next into HEAD
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a7ffc88a7dbe..b0d49e21b0b1 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1153,7 +1153,6 @@ static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
1153 | root->orphan_block_rsv = NULL; | 1153 | root->orphan_block_rsv = NULL; |
1154 | 1154 | ||
1155 | INIT_LIST_HEAD(&root->dirty_list); | 1155 | INIT_LIST_HEAD(&root->dirty_list); |
1156 | INIT_LIST_HEAD(&root->orphan_list); | ||
1157 | INIT_LIST_HEAD(&root->root_list); | 1156 | INIT_LIST_HEAD(&root->root_list); |
1158 | spin_lock_init(&root->orphan_lock); | 1157 | spin_lock_init(&root->orphan_lock); |
1159 | spin_lock_init(&root->inode_lock); | 1158 | spin_lock_init(&root->inode_lock); |
@@ -1166,6 +1165,7 @@ static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
1166 | atomic_set(&root->log_commit[0], 0); | 1165 | atomic_set(&root->log_commit[0], 0); |
1167 | atomic_set(&root->log_commit[1], 0); | 1166 | atomic_set(&root->log_commit[1], 0); |
1168 | atomic_set(&root->log_writers, 0); | 1167 | atomic_set(&root->log_writers, 0); |
1168 | atomic_set(&root->orphan_inodes, 0); | ||
1169 | root->log_batch = 0; | 1169 | root->log_batch = 0; |
1170 | root->log_transid = 0; | 1170 | root->log_transid = 0; |
1171 | root->last_log_commit = 0; | 1171 | root->last_log_commit = 0; |
@@ -2001,7 +2001,8 @@ int open_ctree(struct super_block *sb, | |||
2001 | BTRFS_I(fs_info->btree_inode)->root = tree_root; | 2001 | BTRFS_I(fs_info->btree_inode)->root = tree_root; |
2002 | memset(&BTRFS_I(fs_info->btree_inode)->location, 0, | 2002 | memset(&BTRFS_I(fs_info->btree_inode)->location, 0, |
2003 | sizeof(struct btrfs_key)); | 2003 | sizeof(struct btrfs_key)); |
2004 | BTRFS_I(fs_info->btree_inode)->dummy_inode = 1; | 2004 | set_bit(BTRFS_INODE_DUMMY, |
2005 | &BTRFS_I(fs_info->btree_inode)->runtime_flags); | ||
2005 | insert_inode_hash(fs_info->btree_inode); | 2006 | insert_inode_hash(fs_info->btree_inode); |
2006 | 2007 | ||
2007 | spin_lock_init(&fs_info->block_group_cache_lock); | 2008 | spin_lock_init(&fs_info->block_group_cache_lock); |
@@ -2353,6 +2354,13 @@ retry_root_backup: | |||
2353 | fs_info->generation = generation; | 2354 | fs_info->generation = generation; |
2354 | fs_info->last_trans_committed = generation; | 2355 | fs_info->last_trans_committed = generation; |
2355 | 2356 | ||
2357 | ret = btrfs_init_dev_stats(fs_info); | ||
2358 | if (ret) { | ||
2359 | printk(KERN_ERR "btrfs: failed to init dev_stats: %d\n", | ||
2360 | ret); | ||
2361 | goto fail_block_groups; | ||
2362 | } | ||
2363 | |||
2356 | ret = btrfs_init_space_info(fs_info); | 2364 | ret = btrfs_init_space_info(fs_info); |
2357 | if (ret) { | 2365 | if (ret) { |
2358 | printk(KERN_ERR "Failed to initial space info: %d\n", ret); | 2366 | printk(KERN_ERR "Failed to initial space info: %d\n", ret); |
@@ -2556,18 +2564,19 @@ recovery_tree_root: | |||
2556 | 2564 | ||
2557 | static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate) | 2565 | static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate) |
2558 | { | 2566 | { |
2559 | char b[BDEVNAME_SIZE]; | ||
2560 | |||
2561 | if (uptodate) { | 2567 | if (uptodate) { |
2562 | set_buffer_uptodate(bh); | 2568 | set_buffer_uptodate(bh); |
2563 | } else { | 2569 | } else { |
2570 | struct btrfs_device *device = (struct btrfs_device *) | ||
2571 | bh->b_private; | ||
2572 | |||
2564 | printk_ratelimited(KERN_WARNING "lost page write due to " | 2573 | printk_ratelimited(KERN_WARNING "lost page write due to " |
2565 | "I/O error on %s\n", | 2574 | "I/O error on %s\n", device->name); |
2566 | bdevname(bh->b_bdev, b)); | ||
2567 | /* note, we dont' set_buffer_write_io_error because we have | 2575 | /* note, we dont' set_buffer_write_io_error because we have |
2568 | * our own ways of dealing with the IO errors | 2576 | * our own ways of dealing with the IO errors |
2569 | */ | 2577 | */ |
2570 | clear_buffer_uptodate(bh); | 2578 | clear_buffer_uptodate(bh); |
2579 | btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_WRITE_ERRS); | ||
2571 | } | 2580 | } |
2572 | unlock_buffer(bh); | 2581 | unlock_buffer(bh); |
2573 | put_bh(bh); | 2582 | put_bh(bh); |
@@ -2682,6 +2691,7 @@ static int write_dev_supers(struct btrfs_device *device, | |||
2682 | set_buffer_uptodate(bh); | 2691 | set_buffer_uptodate(bh); |
2683 | lock_buffer(bh); | 2692 | lock_buffer(bh); |
2684 | bh->b_end_io = btrfs_end_buffer_write_sync; | 2693 | bh->b_end_io = btrfs_end_buffer_write_sync; |
2694 | bh->b_private = device; | ||
2685 | } | 2695 | } |
2686 | 2696 | ||
2687 | /* | 2697 | /* |
@@ -2740,6 +2750,9 @@ static int write_dev_flush(struct btrfs_device *device, int wait) | |||
2740 | } | 2750 | } |
2741 | if (!bio_flagged(bio, BIO_UPTODATE)) { | 2751 | if (!bio_flagged(bio, BIO_UPTODATE)) { |
2742 | ret = -EIO; | 2752 | ret = -EIO; |
2753 | if (!bio_flagged(bio, BIO_EOPNOTSUPP)) | ||
2754 | btrfs_dev_stat_inc_and_print(device, | ||
2755 | BTRFS_DEV_STAT_FLUSH_ERRS); | ||
2743 | } | 2756 | } |
2744 | 2757 | ||
2745 | /* drop the reference from the wait == 0 run */ | 2758 | /* drop the reference from the wait == 0 run */ |
@@ -2902,19 +2915,6 @@ int write_ctree_super(struct btrfs_trans_handle *trans, | |||
2902 | return ret; | 2915 | return ret; |
2903 | } | 2916 | } |
2904 | 2917 | ||
2905 | /* Kill all outstanding I/O */ | ||
2906 | void btrfs_abort_devices(struct btrfs_root *root) | ||
2907 | { | ||
2908 | struct list_head *head; | ||
2909 | struct btrfs_device *dev; | ||
2910 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); | ||
2911 | head = &root->fs_info->fs_devices->devices; | ||
2912 | list_for_each_entry_rcu(dev, head, dev_list) { | ||
2913 | blk_abort_queue(dev->bdev->bd_disk->queue); | ||
2914 | } | ||
2915 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | ||
2916 | } | ||
2917 | |||
2918 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root) | 2918 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root) |
2919 | { | 2919 | { |
2920 | spin_lock(&fs_info->fs_roots_radix_lock); | 2920 | spin_lock(&fs_info->fs_roots_radix_lock); |
@@ -3671,17 +3671,6 @@ int btrfs_cleanup_transaction(struct btrfs_root *root) | |||
3671 | return 0; | 3671 | return 0; |
3672 | } | 3672 | } |
3673 | 3673 | ||
3674 | static int btree_writepage_io_failed_hook(struct bio *bio, struct page *page, | ||
3675 | u64 start, u64 end, | ||
3676 | struct extent_state *state) | ||
3677 | { | ||
3678 | struct super_block *sb = page->mapping->host->i_sb; | ||
3679 | struct btrfs_fs_info *fs_info = btrfs_sb(sb); | ||
3680 | btrfs_error(fs_info, -EIO, | ||
3681 | "Error occured while writing out btree at %llu", start); | ||
3682 | return -EIO; | ||
3683 | } | ||
3684 | |||
3685 | static struct extent_io_ops btree_extent_io_ops = { | 3674 | static struct extent_io_ops btree_extent_io_ops = { |
3686 | .write_cache_pages_lock_hook = btree_lock_page_hook, | 3675 | .write_cache_pages_lock_hook = btree_lock_page_hook, |
3687 | .readpage_end_io_hook = btree_readpage_end_io_hook, | 3676 | .readpage_end_io_hook = btree_readpage_end_io_hook, |
@@ -3689,5 +3678,4 @@ static struct extent_io_ops btree_extent_io_ops = { | |||
3689 | .submit_bio_hook = btree_submit_bio_hook, | 3678 | .submit_bio_hook = btree_submit_bio_hook, |
3690 | /* note we're sharing with inode.c for the merge bio hook */ | 3679 | /* note we're sharing with inode.c for the merge bio hook */ |
3691 | .merge_bio_hook = btrfs_merge_bio_hook, | 3680 | .merge_bio_hook = btrfs_merge_bio_hook, |
3692 | .writepage_io_failed_hook = btree_writepage_io_failed_hook, | ||
3693 | }; | 3681 | }; |