summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index efce9a2fa9be..a8ecccfc36de 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -610,7 +610,7 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
610 * that we don't try and read the other copies of this block, just 610 * that we don't try and read the other copies of this block, just
611 * return -EIO. 611 * return -EIO.
612 */ 612 */
613 if (found_level == 0 && btrfs_check_leaf(root, eb)) { 613 if (found_level == 0 && btrfs_check_leaf_full(root, eb)) {
614 set_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); 614 set_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
615 ret = -EIO; 615 ret = -EIO;
616 } 616 }
@@ -3231,6 +3231,7 @@ static int write_dev_supers(struct btrfs_device *device,
3231 int errors = 0; 3231 int errors = 0;
3232 u32 crc; 3232 u32 crc;
3233 u64 bytenr; 3233 u64 bytenr;
3234 int op_flags;
3234 3235
3235 if (max_mirrors == 0) 3236 if (max_mirrors == 0)
3236 max_mirrors = BTRFS_SUPER_MIRROR_MAX; 3237 max_mirrors = BTRFS_SUPER_MIRROR_MAX;
@@ -3273,13 +3274,10 @@ static int write_dev_supers(struct btrfs_device *device,
3273 * we fua the first super. The others we allow 3274 * we fua the first super. The others we allow
3274 * to go down lazy. 3275 * to go down lazy.
3275 */ 3276 */
3276 if (i == 0) { 3277 op_flags = REQ_SYNC | REQ_META | REQ_PRIO;
3277 ret = btrfsic_submit_bh(REQ_OP_WRITE, 3278 if (i == 0 && !btrfs_test_opt(device->fs_info, NOBARRIER))
3278 REQ_SYNC | REQ_FUA | REQ_META | REQ_PRIO, bh); 3279 op_flags |= REQ_FUA;
3279 } else { 3280 ret = btrfsic_submit_bh(REQ_OP_WRITE, op_flags, bh);
3280 ret = btrfsic_submit_bh(REQ_OP_WRITE,
3281 REQ_SYNC | REQ_META | REQ_PRIO, bh);
3282 }
3283 if (ret) 3281 if (ret)
3284 errors++; 3282 errors++;
3285 } 3283 }
@@ -3848,7 +3846,13 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
3848 buf->len, 3846 buf->len,
3849 fs_info->dirty_metadata_batch); 3847 fs_info->dirty_metadata_batch);
3850#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 3848#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
3851 if (btrfs_header_level(buf) == 0 && btrfs_check_leaf(root, buf)) { 3849 /*
3850 * Since btrfs_mark_buffer_dirty() can be called with item pointer set
3851 * but item data not updated.
3852 * So here we should only check item pointers, not item data.
3853 */
3854 if (btrfs_header_level(buf) == 0 &&
3855 btrfs_check_leaf_relaxed(root, buf)) {
3852 btrfs_print_leaf(buf); 3856 btrfs_print_leaf(buf);
3853 ASSERT(0); 3857 ASSERT(0);
3854 } 3858 }