space-info.c (03551d651e9d8ff5b310f9038581b2b030daeb87) | space-info.c (8a526c44daeeb14df0f6e3147a58b4b996968830) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2 3#include "misc.h" 4#include "ctree.h" 5#include "space-info.h" 6#include "sysfs.h" 7#include "volumes.h" 8#include "free-space-cache.h" --- 542 unchanged lines hidden (view full) --- 551 552 bytes = btrfs_calc_insert_metadata_size(fs_info, 1); 553 nr = div64_u64(to_reclaim, bytes); 554 if (!nr) 555 nr = 1; 556 return nr; 557} 558 | 1// SPDX-License-Identifier: GPL-2.0 2 3#include "misc.h" 4#include "ctree.h" 5#include "space-info.h" 6#include "sysfs.h" 7#include "volumes.h" 8#include "free-space-cache.h" --- 542 unchanged lines hidden (view full) --- 551 552 bytes = btrfs_calc_insert_metadata_size(fs_info, 1); 553 nr = div64_u64(to_reclaim, bytes); 554 if (!nr) 555 nr = 1; 556 return nr; 557} 558 |
559static inline u64 calc_delayed_refs_nr(const struct btrfs_fs_info *fs_info, 560 u64 to_reclaim) 561{ 562 const u64 bytes = btrfs_calc_delayed_ref_bytes(fs_info, 1); 563 u64 nr; 564 565 nr = div64_u64(to_reclaim, bytes); 566 if (!nr) 567 nr = 1; 568 return nr; 569} 570 | |
571#define EXTENT_SIZE_PER_ITEM SZ_256K 572 573/* 574 * shrink metadata reservation for delalloc 575 */ 576static void shrink_delalloc(struct btrfs_fs_info *fs_info, 577 struct btrfs_space_info *space_info, 578 u64 to_reclaim, bool wait_ordered, --- 165 unchanged lines hidden (view full) --- 744 trans = btrfs_join_transaction_nostart(root); 745 if (IS_ERR(trans)) { 746 ret = PTR_ERR(trans); 747 if (ret == -ENOENT) 748 ret = 0; 749 break; 750 } 751 if (state == FLUSH_DELAYED_REFS_NR) | 559#define EXTENT_SIZE_PER_ITEM SZ_256K 560 561/* 562 * shrink metadata reservation for delalloc 563 */ 564static void shrink_delalloc(struct btrfs_fs_info *fs_info, 565 struct btrfs_space_info *space_info, 566 u64 to_reclaim, bool wait_ordered, --- 165 unchanged lines hidden (view full) --- 732 trans = btrfs_join_transaction_nostart(root); 733 if (IS_ERR(trans)) { 734 ret = PTR_ERR(trans); 735 if (ret == -ENOENT) 736 ret = 0; 737 break; 738 } 739 if (state == FLUSH_DELAYED_REFS_NR) |
752 nr = calc_delayed_refs_nr(fs_info, num_bytes); | 740 btrfs_run_delayed_refs(trans, num_bytes); |
753 else | 741 else |
754 nr = 0; 755 btrfs_run_delayed_refs(trans, nr); | 742 btrfs_run_delayed_refs(trans, 0); |
756 btrfs_end_transaction(trans); 757 break; 758 case ALLOC_CHUNK: 759 case ALLOC_CHUNK_FORCE: 760 trans = btrfs_join_transaction(root); 761 if (IS_ERR(trans)) { 762 ret = PTR_ERR(trans); 763 break; --- 1089 unchanged lines hidden --- | 743 btrfs_end_transaction(trans); 744 break; 745 case ALLOC_CHUNK: 746 case ALLOC_CHUNK_FORCE: 747 trans = btrfs_join_transaction(root); 748 if (IS_ERR(trans)) { 749 ret = PTR_ERR(trans); 750 break; --- 1089 unchanged lines hidden --- |