scrub.c (3212fa14e772913b69e85e080678472f8f1aecde) scrub.c (29cbcf401793f4e2c871c846edc2191731df2c41)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2011, 2012 STRATO. All rights reserved.
4 */
5
6#include <linux/blkdev.h>
7#include <linux/ratelimit.h>
8#include <linux/sched/mm.h>

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

2892static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx,
2893 struct map_lookup *map,
2894 struct btrfs_device *sdev,
2895 struct btrfs_path *path,
2896 u64 logic_start,
2897 u64 logic_end)
2898{
2899 struct btrfs_fs_info *fs_info = sctx->fs_info;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2011, 2012 STRATO. All rights reserved.
4 */
5
6#include <linux/blkdev.h>
7#include <linux/ratelimit.h>
8#include <linux/sched/mm.h>

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

2892static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx,
2893 struct map_lookup *map,
2894 struct btrfs_device *sdev,
2895 struct btrfs_path *path,
2896 u64 logic_start,
2897 u64 logic_end)
2898{
2899 struct btrfs_fs_info *fs_info = sctx->fs_info;
2900 struct btrfs_root *root = fs_info->extent_root;
2900 struct btrfs_root *root = btrfs_extent_root(fs_info, logic_start);
2901 struct btrfs_root *csum_root = fs_info->csum_root;
2902 struct btrfs_extent_item *extent;
2903 struct btrfs_io_context *bioc = NULL;
2904 u64 flags;
2905 int ret;
2906 int slot;
2907 struct extent_buffer *l;
2908 struct btrfs_key key;

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

3163static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
3164 struct map_lookup *map,
3165 struct btrfs_device *scrub_dev,
3166 int num, u64 base, u64 length,
3167 struct btrfs_block_group *cache)
3168{
3169 struct btrfs_path *path, *ppath;
3170 struct btrfs_fs_info *fs_info = sctx->fs_info;
2901 struct btrfs_root *csum_root = fs_info->csum_root;
2902 struct btrfs_extent_item *extent;
2903 struct btrfs_io_context *bioc = NULL;
2904 u64 flags;
2905 int ret;
2906 int slot;
2907 struct extent_buffer *l;
2908 struct btrfs_key key;

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

3163static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
3164 struct map_lookup *map,
3165 struct btrfs_device *scrub_dev,
3166 int num, u64 base, u64 length,
3167 struct btrfs_block_group *cache)
3168{
3169 struct btrfs_path *path, *ppath;
3170 struct btrfs_fs_info *fs_info = sctx->fs_info;
3171 struct btrfs_root *root = fs_info->extent_root;
3171 struct btrfs_root *root;
3172 struct btrfs_root *csum_root = fs_info->csum_root;
3173 struct btrfs_extent_item *extent;
3174 struct blk_plug plug;
3175 u64 flags;
3176 int ret;
3177 int slot;
3178 u64 nstripes;
3179 struct extent_buffer *l;

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

3257 logic_end += base;
3258 } else {
3259 logic_end = logical + increment * nstripes;
3260 }
3261 wait_event(sctx->list_wait,
3262 atomic_read(&sctx->bios_in_flight) == 0);
3263 scrub_blocked_if_needed(fs_info);
3264
3172 struct btrfs_root *csum_root = fs_info->csum_root;
3173 struct btrfs_extent_item *extent;
3174 struct blk_plug plug;
3175 u64 flags;
3176 int ret;
3177 int slot;
3178 u64 nstripes;
3179 struct extent_buffer *l;

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

3257 logic_end += base;
3258 } else {
3259 logic_end = logical + increment * nstripes;
3260 }
3261 wait_event(sctx->list_wait,
3262 atomic_read(&sctx->bios_in_flight) == 0);
3263 scrub_blocked_if_needed(fs_info);
3264
3265 root = btrfs_extent_root(fs_info, logical);
3266
3265 /* FIXME it might be better to start readahead at commit root */
3266 key.objectid = logical;
3267 key.type = BTRFS_EXTENT_ITEM_KEY;
3268 key.offset = (u64)0;
3269 key_end.objectid = logic_end;
3270 key_end.type = BTRFS_METADATA_ITEM_KEY;
3271 key_end.offset = (u64)-1;
3272 reada1 = btrfs_reada_add(root, &key, &key_end);

--- 1057 unchanged lines hidden ---
3267 /* FIXME it might be better to start readahead at commit root */
3268 key.objectid = logical;
3269 key.type = BTRFS_EXTENT_ITEM_KEY;
3270 key.offset = (u64)0;
3271 key_end.objectid = logic_end;
3272 key_end.type = BTRFS_METADATA_ITEM_KEY;
3273 key_end.offset = (u64)-1;
3274 reada1 = btrfs_reada_add(root, &key, &key_end);

--- 1057 unchanged lines hidden ---