Commit 232cad84 authored by Chris Mason's avatar Chris Mason

Merge branch 'misc-4.6' of...

Merge branch 'misc-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.6
parents 389f239c ce63f891
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/migrate.h> #include <linux/migrate.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
...@@ -303,7 +302,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, ...@@ -303,7 +302,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
err = map_private_extent_buffer(buf, offset, 32, err = map_private_extent_buffer(buf, offset, 32,
&kaddr, &map_start, &map_len); &kaddr, &map_start, &map_len);
if (err) if (err)
return 1; return err;
cur_len = min(len, map_len - (offset - map_start)); cur_len = min(len, map_len - (offset - map_start));
crc = btrfs_csum_data(kaddr + offset - map_start, crc = btrfs_csum_data(kaddr + offset - map_start,
crc, cur_len); crc, cur_len);
...@@ -313,7 +312,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, ...@@ -313,7 +312,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
if (csum_size > sizeof(inline_result)) { if (csum_size > sizeof(inline_result)) {
result = kzalloc(csum_size, GFP_NOFS); result = kzalloc(csum_size, GFP_NOFS);
if (!result) if (!result)
return 1; return -ENOMEM;
} else { } else {
result = (char *)&inline_result; result = (char *)&inline_result;
} }
...@@ -334,7 +333,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, ...@@ -334,7 +333,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
val, found, btrfs_header_level(buf)); val, found, btrfs_header_level(buf));
if (result != (char *)&inline_result) if (result != (char *)&inline_result)
kfree(result); kfree(result);
return 1; return -EUCLEAN;
} }
} else { } else {
write_extent_buffer(buf, result, 0, csum_size); write_extent_buffer(buf, result, 0, csum_size);
...@@ -513,11 +512,21 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page) ...@@ -513,11 +512,21 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
eb = (struct extent_buffer *)page->private; eb = (struct extent_buffer *)page->private;
if (page != eb->pages[0]) if (page != eb->pages[0])
return 0; return 0;
found_start = btrfs_header_bytenr(eb); found_start = btrfs_header_bytenr(eb);
if (WARN_ON(found_start != start || !PageUptodate(page))) /*
return 0; * Please do not consolidate these warnings into a single if.
csum_tree_block(fs_info, eb, 0); * It is useful to know what went wrong.
return 0; */
if (WARN_ON(found_start != start))
return -EUCLEAN;
if (WARN_ON(!PageUptodate(page)))
return -EUCLEAN;
ASSERT(memcmp_extent_buffer(eb, fs_info->fsid,
btrfs_header_fsid(), BTRFS_FSID_SIZE) == 0);
return csum_tree_block(fs_info, eb, 0);
} }
static int check_tree_block_fsid(struct btrfs_fs_info *fs_info, static int check_tree_block_fsid(struct btrfs_fs_info *fs_info,
...@@ -661,10 +670,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio, ...@@ -661,10 +670,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
eb, found_level); eb, found_level);
ret = csum_tree_block(fs_info, eb, 1); ret = csum_tree_block(fs_info, eb, 1);
if (ret) { if (ret)
ret = -EIO;
goto err; goto err;
}
/* /*
* If this is a leaf block and it is corrupt, set the corrupt bit so * If this is a leaf block and it is corrupt, set the corrupt bit so
...@@ -1831,7 +1838,7 @@ static int cleaner_kthread(void *arg) ...@@ -1831,7 +1838,7 @@ static int cleaner_kthread(void *arg)
*/ */
btrfs_delete_unused_bgs(root->fs_info); btrfs_delete_unused_bgs(root->fs_info);
sleep: sleep:
if (!try_to_freeze() && !again) { if (!again) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (!kthread_should_stop()) if (!kthread_should_stop())
schedule(); schedule();
...@@ -1921,14 +1928,12 @@ static int transaction_kthread(void *arg) ...@@ -1921,14 +1928,12 @@ static int transaction_kthread(void *arg)
if (unlikely(test_bit(BTRFS_FS_STATE_ERROR, if (unlikely(test_bit(BTRFS_FS_STATE_ERROR,
&root->fs_info->fs_state))) &root->fs_info->fs_state)))
btrfs_cleanup_transaction(root); btrfs_cleanup_transaction(root);
if (!try_to_freeze()) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (!kthread_should_stop() && if (!kthread_should_stop() &&
(!btrfs_transaction_blocked(root->fs_info) || (!btrfs_transaction_blocked(root->fs_info) ||
cannot_commit)) cannot_commit))
schedule_timeout(delay); schedule_timeout(delay);
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop()); } while (!kthread_should_stop());
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment