disk-io.c (8bfec2e426e40597d594db07de4e53def38c8879) disk-io.c (85d8a826c7cde17f9cca9c4debecb4538bdb6573)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007 Oracle. All rights reserved.
4 */
5
6#include <linux/fs.h>
7#include <linux/blkdev.h>
8#include <linux/radix-tree.h>

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

321 ASSERT(memcmp_extent_buffer(eb, fs_info->fs_devices->metadata_uuid,
322 offsetof(struct btrfs_header, fsid),
323 BTRFS_FSID_SIZE) == 0);
324 csum_tree_block(eb, result);
325
326 if (btrfs_header_level(eb))
327 ret = btrfs_check_node(eb);
328 else
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007 Oracle. All rights reserved.
4 */
5
6#include <linux/fs.h>
7#include <linux/blkdev.h>
8#include <linux/radix-tree.h>

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

321 ASSERT(memcmp_extent_buffer(eb, fs_info->fs_devices->metadata_uuid,
322 offsetof(struct btrfs_header, fsid),
323 BTRFS_FSID_SIZE) == 0);
324 csum_tree_block(eb, result);
325
326 if (btrfs_header_level(eb))
327 ret = btrfs_check_node(eb);
328 else
329 ret = btrfs_check_leaf_full(eb);
329 ret = btrfs_check_leaf(eb);
330
331 if (ret < 0)
332 goto error;
333
334 /*
335 * Also check the generation, the eb reached here must be newer than
336 * last committed. Or something seriously wrong happened.
337 */

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

578 goto out;
579 }
580
581 /*
582 * If this is a leaf block and it is corrupt, set the corrupt bit so
583 * that we don't try and read the other copies of this block, just
584 * return -EIO.
585 */
330
331 if (ret < 0)
332 goto error;
333
334 /*
335 * Also check the generation, the eb reached here must be newer than
336 * last committed. Or something seriously wrong happened.
337 */

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

578 goto out;
579 }
580
581 /*
582 * If this is a leaf block and it is corrupt, set the corrupt bit so
583 * that we don't try and read the other copies of this block, just
584 * return -EIO.
585 */
586 if (found_level == 0 && btrfs_check_leaf_full(eb)) {
586 if (found_level == 0 && btrfs_check_leaf(eb)) {
587 set_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
588 ret = -EIO;
589 }
590
591 if (found_level > 0 && btrfs_check_node(eb))
592 ret = -EIO;
593
594 if (!ret)

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

4696 buf->start, transid, fs_info->generation);
4697 was_dirty = set_extent_buffer_dirty(buf);
4698 if (!was_dirty)
4699 percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
4700 buf->len,
4701 fs_info->dirty_metadata_batch);
4702#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
4703 /*
587 set_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
588 ret = -EIO;
589 }
590
591 if (found_level > 0 && btrfs_check_node(eb))
592 ret = -EIO;
593
594 if (!ret)

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

4696 buf->start, transid, fs_info->generation);
4697 was_dirty = set_extent_buffer_dirty(buf);
4698 if (!was_dirty)
4699 percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
4700 buf->len,
4701 fs_info->dirty_metadata_batch);
4702#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
4703 /*
4704 * Since btrfs_mark_buffer_dirty() can be called with item pointer set
4705 * but item data not updated.
4706 * So here we should only check item pointers, not item data.
4704 * btrfs_check_leaf() won't check item data if we don't have WRITTEN
4705 * set, so this will only validate the basic structure of the items.
4707 */
4706 */
4708 if (btrfs_header_level(buf) == 0 &&
4709 btrfs_check_leaf_relaxed(buf)) {
4707 if (btrfs_header_level(buf) == 0 && btrfs_check_leaf(buf)) {
4710 btrfs_print_leaf(buf);
4711 ASSERT(0);
4712 }
4713#endif
4714}
4715
4716static void __btrfs_btree_balance_dirty(struct btrfs_fs_info *fs_info,
4717 int flush_delayed)

--- 536 unchanged lines hidden ---
4708 btrfs_print_leaf(buf);
4709 ASSERT(0);
4710 }
4711#endif
4712}
4713
4714static void __btrfs_btree_balance_dirty(struct btrfs_fs_info *fs_info,
4715 int flush_delayed)

--- 536 unchanged lines hidden ---