node.c (e7547daccd6a37522f0af74ec4b5a3036f3dd328) | node.c (71644dff481180ba024ac4f5cb1f068756357adf) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/node.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 46 unchanged lines hidden (view full) --- 55 return true; 56 57 si_meminfo(&val); 58 59 /* only uses low memory */ 60 avail_ram = val.totalram - val.totalhigh; 61 62 /* | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/node.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 46 unchanged lines hidden (view full) --- 55 return true; 56 57 si_meminfo(&val); 58 59 /* only uses low memory */ 60 avail_ram = val.totalram - val.totalhigh; 61 62 /* |
63 * give 25%, 25%, 50%, 50%, 50% memory for each components respectively | 63 * give 25%, 25%, 50%, 50%, 25%, 25% memory for each components respectively |
64 */ 65 if (type == FREE_NIDS) { 66 mem_size = (nm_i->nid_cnt[FREE_NID] * 67 sizeof(struct free_nid)) >> PAGE_SHIFT; 68 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2); 69 } else if (type == NAT_ENTRIES) { 70 mem_size = (nm_i->nat_cnt[TOTAL_NAT] * 71 sizeof(struct nat_entry)) >> PAGE_SHIFT; --- 8 unchanged lines hidden (view full) --- 80 } else if (type == INO_ENTRIES) { 81 int i; 82 83 for (i = 0; i < MAX_INO_ENTRY; i++) 84 mem_size += sbi->im[i].ino_num * 85 sizeof(struct ino_entry); 86 mem_size >>= PAGE_SHIFT; 87 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); | 64 */ 65 if (type == FREE_NIDS) { 66 mem_size = (nm_i->nid_cnt[FREE_NID] * 67 sizeof(struct free_nid)) >> PAGE_SHIFT; 68 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2); 69 } else if (type == NAT_ENTRIES) { 70 mem_size = (nm_i->nat_cnt[TOTAL_NAT] * 71 sizeof(struct nat_entry)) >> PAGE_SHIFT; --- 8 unchanged lines hidden (view full) --- 80 } else if (type == INO_ENTRIES) { 81 int i; 82 83 for (i = 0; i < MAX_INO_ENTRY; i++) 84 mem_size += sbi->im[i].ino_num * 85 sizeof(struct ino_entry); 86 mem_size >>= PAGE_SHIFT; 87 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); |
88 } else if (type == READ_EXTENT_CACHE) { 89 struct extent_tree_info *eti = &sbi->extent_tree[EX_READ]; | 88 } else if (type == READ_EXTENT_CACHE || type == AGE_EXTENT_CACHE) { 89 enum extent_type etype = type == READ_EXTENT_CACHE ? 90 EX_READ : EX_BLOCK_AGE; 91 struct extent_tree_info *eti = &sbi->extent_tree[etype]; |
90 91 mem_size = (atomic_read(&eti->total_ext_tree) * 92 sizeof(struct extent_tree) + 93 atomic_read(&eti->total_ext_node) * 94 sizeof(struct extent_node)) >> PAGE_SHIFT; | 92 93 mem_size = (atomic_read(&eti->total_ext_tree) * 94 sizeof(struct extent_tree) + 95 atomic_read(&eti->total_ext_node) * 96 sizeof(struct extent_node)) >> PAGE_SHIFT; |
95 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); | 97 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2); |
96 } else if (type == DISCARD_CACHE) { 97 mem_size = (atomic_read(&dcc->discard_cmd_cnt) * 98 sizeof(struct discard_cmd)) >> PAGE_SHIFT; 99 res = mem_size < (avail_ram * nm_i->ram_thresh / 100); 100 } else if (type == COMPRESS_PAGE) { 101#ifdef CONFIG_F2FS_FS_COMPRESSION 102 unsigned long free_ram = val.freeram; 103 --- 3330 unchanged lines hidden --- | 98 } else if (type == DISCARD_CACHE) { 99 mem_size = (atomic_read(&dcc->discard_cmd_cnt) * 100 sizeof(struct discard_cmd)) >> PAGE_SHIFT; 101 res = mem_size < (avail_ram * nm_i->ram_thresh / 100); 102 } else if (type == COMPRESS_PAGE) { 103#ifdef CONFIG_F2FS_FS_COMPRESSION 104 unsigned long free_ram = val.freeram; 105 --- 3330 unchanged lines hidden --- |