tree-log.c (78ac4f9e5ae022bd183ca21da7b373d300b7be17) | tree-log.c (c71dd88007bdc8ba62e99439d93050b0778f101a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2008 Oracle. All rights reserved. 4 */ 5 6#include <linux/sched.h> 7#include <linux/slab.h> 8#include <linux/blkdev.h> --- 330 unchanged lines hidden (view full) --- 339 * If the key isn't in the destination yet, a new item is inserted. 340 */ 341static noinline int overwrite_item(struct btrfs_trans_handle *trans, 342 struct btrfs_root *root, 343 struct btrfs_path *path, 344 struct extent_buffer *eb, int slot, 345 struct btrfs_key *key) 346{ | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2008 Oracle. All rights reserved. 4 */ 5 6#include <linux/sched.h> 7#include <linux/slab.h> 8#include <linux/blkdev.h> --- 330 unchanged lines hidden (view full) --- 339 * If the key isn't in the destination yet, a new item is inserted. 340 */ 341static noinline int overwrite_item(struct btrfs_trans_handle *trans, 342 struct btrfs_root *root, 343 struct btrfs_path *path, 344 struct extent_buffer *eb, int slot, 345 struct btrfs_key *key) 346{ |
347 struct btrfs_fs_info *fs_info = root->fs_info; | |
348 int ret; 349 u32 item_size; 350 u64 saved_i_size = 0; 351 int save_old_i_size = 0; 352 unsigned long src_ptr; 353 unsigned long dst_ptr; 354 int overwrite_root = 0; 355 bool inode_item = key->type == BTRFS_INODE_ITEM_KEY; --- 106 unchanged lines hidden (view full) --- 462 /* make sure any existing item is the correct size */ 463 if (ret == -EEXIST || ret == -EOVERFLOW) { 464 u32 found_size; 465 found_size = btrfs_item_size_nr(path->nodes[0], 466 path->slots[0]); 467 if (found_size > item_size) 468 btrfs_truncate_item(path, item_size, 1); 469 else if (found_size < item_size) | 347 int ret; 348 u32 item_size; 349 u64 saved_i_size = 0; 350 int save_old_i_size = 0; 351 unsigned long src_ptr; 352 unsigned long dst_ptr; 353 int overwrite_root = 0; 354 bool inode_item = key->type == BTRFS_INODE_ITEM_KEY; --- 106 unchanged lines hidden (view full) --- 461 /* make sure any existing item is the correct size */ 462 if (ret == -EEXIST || ret == -EOVERFLOW) { 463 u32 found_size; 464 found_size = btrfs_item_size_nr(path->nodes[0], 465 path->slots[0]); 466 if (found_size > item_size) 467 btrfs_truncate_item(path, item_size, 1); 468 else if (found_size < item_size) |
470 btrfs_extend_item(fs_info, path, 471 item_size - found_size); | 469 btrfs_extend_item(path, item_size - found_size); |
472 } else if (ret) { 473 return ret; 474 } 475 dst_ptr = btrfs_item_ptr_offset(path->nodes[0], 476 path->slots[0]); 477 478 /* don't overwrite an existing inode if the generation number 479 * was logged as zero. This is done when the tree logging code --- 5878 unchanged lines hidden --- | 470 } else if (ret) { 471 return ret; 472 } 473 dst_ptr = btrfs_item_ptr_offset(path->nodes[0], 474 path->slots[0]); 475 476 /* don't overwrite an existing inode if the generation number 477 * was logged as zero. This is done when the tree logging code --- 5878 unchanged lines hidden --- |