relocation.c (95d002e0a34cb0f238abb39987f9980f325d8332) relocation.c (c258d6e36442eb5d3363f6dbc0e6f2c162bfb66d)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2009 Oracle. All rights reserved.
4 */
5
6#include <linux/sched.h>
7#include <linux/pagemap.h>
8#include <linux/writeback.h>

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

4217 if (err) {
4218 if (inode)
4219 iput(inode);
4220 inode = ERR_PTR(err);
4221 }
4222 return inode;
4223}
4224
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2009 Oracle. All rights reserved.
4 */
5
6#include <linux/sched.h>
7#include <linux/pagemap.h>
8#include <linux/writeback.h>

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

4217 if (err) {
4218 if (inode)
4219 iput(inode);
4220 inode = ERR_PTR(err);
4221 }
4222 return inode;
4223}
4224
4225static struct reloc_control *alloc_reloc_control(void)
4225static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info)
4226{
4227 struct reloc_control *rc;
4228
4229 rc = kzalloc(sizeof(*rc), GFP_NOFS);
4230 if (!rc)
4231 return NULL;
4232
4233 INIT_LIST_HEAD(&rc->reloc_roots);
4234 INIT_LIST_HEAD(&rc->dirty_subvol_roots);
4235 backref_cache_init(&rc->backref_cache);
4236 mapping_tree_init(&rc->reloc_root_tree);
4226{
4227 struct reloc_control *rc;
4228
4229 rc = kzalloc(sizeof(*rc), GFP_NOFS);
4230 if (!rc)
4231 return NULL;
4232
4233 INIT_LIST_HEAD(&rc->reloc_roots);
4234 INIT_LIST_HEAD(&rc->dirty_subvol_roots);
4235 backref_cache_init(&rc->backref_cache);
4236 mapping_tree_init(&rc->reloc_root_tree);
4237 extent_io_tree_init(&rc->processed_blocks, NULL);
4237 extent_io_tree_init(fs_info, &rc->processed_blocks, NULL);
4238 return rc;
4239}
4240
4241/*
4242 * Print the block group being relocated
4243 */
4244static void describe_relocation(struct btrfs_fs_info *fs_info,
4245 struct btrfs_block_group_cache *block_group)

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

4271 if (!bg)
4272 return -ENOENT;
4273
4274 if (btrfs_pinned_by_swapfile(fs_info, bg)) {
4275 btrfs_put_block_group(bg);
4276 return -ETXTBSY;
4277 }
4278
4238 return rc;
4239}
4240
4241/*
4242 * Print the block group being relocated
4243 */
4244static void describe_relocation(struct btrfs_fs_info *fs_info,
4245 struct btrfs_block_group_cache *block_group)

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

4271 if (!bg)
4272 return -ENOENT;
4273
4274 if (btrfs_pinned_by_swapfile(fs_info, bg)) {
4275 btrfs_put_block_group(bg);
4276 return -ETXTBSY;
4277 }
4278
4279 rc = alloc_reloc_control();
4279 rc = alloc_reloc_control(fs_info);
4280 if (!rc) {
4281 btrfs_put_block_group(bg);
4282 return -ENOMEM;
4283 }
4284
4285 rc->extent_root = extent_root;
4286 rc->block_group = bg;
4287

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

4467
4468 key.offset--;
4469 }
4470 btrfs_release_path(path);
4471
4472 if (list_empty(&reloc_roots))
4473 goto out;
4474
4280 if (!rc) {
4281 btrfs_put_block_group(bg);
4282 return -ENOMEM;
4283 }
4284
4285 rc->extent_root = extent_root;
4286 rc->block_group = bg;
4287

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

4467
4468 key.offset--;
4469 }
4470 btrfs_release_path(path);
4471
4472 if (list_empty(&reloc_roots))
4473 goto out;
4474
4475 rc = alloc_reloc_control();
4475 rc = alloc_reloc_control(fs_info);
4476 if (!rc) {
4477 err = -ENOMEM;
4478 goto out;
4479 }
4480
4481 rc->extent_root = fs_info->extent_root;
4482
4483 set_reloc_control(rc);

--- 253 unchanged lines hidden ---
4476 if (!rc) {
4477 err = -ENOMEM;
4478 goto out;
4479 }
4480
4481 rc->extent_root = fs_info->extent_root;
4482
4483 set_reloc_control(rc);

--- 253 unchanged lines hidden ---