Lines Matching refs:nm_i

26 #define on_f2fs_build_free_nids(nmi) mutex_is_locked(&(nm_i)->build_lock)
50 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_available_free_memory() local
65 mem_size = (nm_i->nid_cnt[FREE_NID] * in f2fs_available_free_memory()
67 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2); in f2fs_available_free_memory()
69 mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> in f2fs_available_free_memory()
71 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2); in f2fs_available_free_memory()
78 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); in f2fs_available_free_memory()
86 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); in f2fs_available_free_memory()
92 res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); in f2fs_available_free_memory()
126 struct f2fs_nm_info *nm_i = NM_I(sbi); in get_next_nat_page() local
141 set_to_next_nat(nm_i, nid); in get_next_nat_page()
167 static struct nat_entry *__init_nat_entry(struct f2fs_nm_info *nm_i, in __init_nat_entry() argument
171 f2fs_radix_tree_insert(&nm_i->nat_root, nat_get_nid(ne), ne); in __init_nat_entry()
172 else if (radix_tree_insert(&nm_i->nat_root, nat_get_nid(ne), ne)) in __init_nat_entry()
178 spin_lock(&nm_i->nat_list_lock); in __init_nat_entry()
179 list_add_tail(&ne->list, &nm_i->nat_entries); in __init_nat_entry()
180 spin_unlock(&nm_i->nat_list_lock); in __init_nat_entry()
182 nm_i->nat_cnt++; in __init_nat_entry()
186 static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n) in __lookup_nat_cache() argument
190 ne = radix_tree_lookup(&nm_i->nat_root, n); in __lookup_nat_cache()
194 spin_lock(&nm_i->nat_list_lock); in __lookup_nat_cache()
196 list_move_tail(&ne->list, &nm_i->nat_entries); in __lookup_nat_cache()
197 spin_unlock(&nm_i->nat_list_lock); in __lookup_nat_cache()
203 static unsigned int __gang_lookup_nat_cache(struct f2fs_nm_info *nm_i, in __gang_lookup_nat_cache() argument
206 return radix_tree_gang_lookup(&nm_i->nat_root, (void **)ep, start, nr); in __gang_lookup_nat_cache()
209 static void __del_from_nat_cache(struct f2fs_nm_info *nm_i, struct nat_entry *e) in __del_from_nat_cache() argument
211 radix_tree_delete(&nm_i->nat_root, nat_get_nid(e)); in __del_from_nat_cache()
212 nm_i->nat_cnt--; in __del_from_nat_cache()
216 static struct nat_entry_set *__grab_nat_entry_set(struct f2fs_nm_info *nm_i, in __grab_nat_entry_set() argument
222 head = radix_tree_lookup(&nm_i->nat_set_root, set); in __grab_nat_entry_set()
230 f2fs_radix_tree_insert(&nm_i->nat_set_root, set, head); in __grab_nat_entry_set()
235 static void __set_nat_cache_dirty(struct f2fs_nm_info *nm_i, in __set_nat_cache_dirty() argument
242 head = __grab_nat_entry_set(nm_i, ne); in __set_nat_cache_dirty()
258 nm_i->dirty_nat_cnt++; in __set_nat_cache_dirty()
261 spin_lock(&nm_i->nat_list_lock); in __set_nat_cache_dirty()
266 spin_unlock(&nm_i->nat_list_lock); in __set_nat_cache_dirty()
269 static void __clear_nat_cache_dirty(struct f2fs_nm_info *nm_i, in __clear_nat_cache_dirty() argument
272 spin_lock(&nm_i->nat_list_lock); in __clear_nat_cache_dirty()
273 list_move_tail(&ne->list, &nm_i->nat_entries); in __clear_nat_cache_dirty()
274 spin_unlock(&nm_i->nat_list_lock); in __clear_nat_cache_dirty()
278 nm_i->dirty_nat_cnt--; in __clear_nat_cache_dirty()
281 static unsigned int __gang_lookup_nat_set(struct f2fs_nm_info *nm_i, in __gang_lookup_nat_set() argument
284 return radix_tree_gang_lookup(&nm_i->nat_set_root, (void **)ep, in __gang_lookup_nat_set()
356 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_need_dentry_mark() local
360 down_read(&nm_i->nat_tree_lock); in f2fs_need_dentry_mark()
361 e = __lookup_nat_cache(nm_i, nid); in f2fs_need_dentry_mark()
367 up_read(&nm_i->nat_tree_lock); in f2fs_need_dentry_mark()
373 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_is_checkpointed_node() local
377 down_read(&nm_i->nat_tree_lock); in f2fs_is_checkpointed_node()
378 e = __lookup_nat_cache(nm_i, nid); in f2fs_is_checkpointed_node()
381 up_read(&nm_i->nat_tree_lock); in f2fs_is_checkpointed_node()
387 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_need_inode_block_update() local
391 down_read(&nm_i->nat_tree_lock); in f2fs_need_inode_block_update()
392 e = __lookup_nat_cache(nm_i, ino); in f2fs_need_inode_block_update()
397 up_read(&nm_i->nat_tree_lock); in f2fs_need_inode_block_update()
405 struct f2fs_nm_info *nm_i = NM_I(sbi); in cache_nat_entry() local
412 down_write(&nm_i->nat_tree_lock); in cache_nat_entry()
413 e = __lookup_nat_cache(nm_i, nid); in cache_nat_entry()
415 e = __init_nat_entry(nm_i, new, ne, false); in cache_nat_entry()
421 up_write(&nm_i->nat_tree_lock); in cache_nat_entry()
429 struct f2fs_nm_info *nm_i = NM_I(sbi); in set_node_addr() local
433 down_write(&nm_i->nat_tree_lock); in set_node_addr()
434 e = __lookup_nat_cache(nm_i, ni->nid); in set_node_addr()
436 e = __init_nat_entry(nm_i, new, NULL, true); in set_node_addr()
471 __set_nat_cache_dirty(nm_i, e); in set_node_addr()
475 e = __lookup_nat_cache(nm_i, ni->ino); in set_node_addr()
481 up_write(&nm_i->nat_tree_lock); in set_node_addr()
486 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_try_to_free_nats() local
489 if (!down_write_trylock(&nm_i->nat_tree_lock)) in f2fs_try_to_free_nats()
492 spin_lock(&nm_i->nat_list_lock); in f2fs_try_to_free_nats()
496 if (list_empty(&nm_i->nat_entries)) in f2fs_try_to_free_nats()
499 ne = list_first_entry(&nm_i->nat_entries, in f2fs_try_to_free_nats()
502 spin_unlock(&nm_i->nat_list_lock); in f2fs_try_to_free_nats()
504 __del_from_nat_cache(nm_i, ne); in f2fs_try_to_free_nats()
507 spin_lock(&nm_i->nat_list_lock); in f2fs_try_to_free_nats()
509 spin_unlock(&nm_i->nat_list_lock); in f2fs_try_to_free_nats()
511 up_write(&nm_i->nat_tree_lock); in f2fs_try_to_free_nats()
521 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_get_node_info() local
535 down_read(&nm_i->nat_tree_lock); in f2fs_get_node_info()
536 e = __lookup_nat_cache(nm_i, nid); in f2fs_get_node_info()
541 up_read(&nm_i->nat_tree_lock); in f2fs_get_node_info()
556 up_read(&nm_i->nat_tree_lock); in f2fs_get_node_info()
562 up_read(&nm_i->nat_tree_lock); in f2fs_get_node_info()
1996 static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i, in __lookup_free_nid_list() argument
1999 return radix_tree_lookup(&nm_i->free_nid_root, n); in __lookup_free_nid_list()
2005 struct f2fs_nm_info *nm_i = NM_I(sbi); in __insert_free_nid() local
2007 int err = radix_tree_insert(&nm_i->free_nid_root, i->nid, i); in __insert_free_nid()
2012 nm_i->nid_cnt[state]++; in __insert_free_nid()
2014 list_add_tail(&i->list, &nm_i->free_nid_list); in __insert_free_nid()
2021 struct f2fs_nm_info *nm_i = NM_I(sbi); in __remove_free_nid() local
2024 nm_i->nid_cnt[state]--; in __remove_free_nid()
2027 radix_tree_delete(&nm_i->free_nid_root, i->nid); in __remove_free_nid()
2033 struct f2fs_nm_info *nm_i = NM_I(sbi); in __move_free_nid() local
2037 nm_i->nid_cnt[org_state]--; in __move_free_nid()
2038 nm_i->nid_cnt[dst_state]++; in __move_free_nid()
2045 list_add_tail(&i->list, &nm_i->free_nid_list); in __move_free_nid()
2055 struct f2fs_nm_info *nm_i = NM_I(sbi); in update_free_nid_bitmap() local
2059 if (!test_bit_le(nat_ofs, nm_i->nat_block_bitmap)) in update_free_nid_bitmap()
2063 if (test_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs])) in update_free_nid_bitmap()
2065 __set_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); in update_free_nid_bitmap()
2066 nm_i->free_nid_count[nat_ofs]++; in update_free_nid_bitmap()
2068 if (!test_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs])) in update_free_nid_bitmap()
2070 __clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); in update_free_nid_bitmap()
2072 nm_i->free_nid_count[nat_ofs]--; in update_free_nid_bitmap()
2080 struct f2fs_nm_info *nm_i = NM_I(sbi); in add_free_nid() local
2099 spin_lock(&nm_i->nid_list_lock); in add_free_nid()
2123 ne = __lookup_nat_cache(nm_i, nid); in add_free_nid()
2128 e = __lookup_free_nid_list(nm_i, nid); in add_free_nid()
2141 nm_i->available_nids++; in add_free_nid()
2143 spin_unlock(&nm_i->nid_list_lock); in add_free_nid()
2153 struct f2fs_nm_info *nm_i = NM_I(sbi); in remove_free_nid() local
2157 spin_lock(&nm_i->nid_list_lock); in remove_free_nid()
2158 i = __lookup_free_nid_list(nm_i, nid); in remove_free_nid()
2163 spin_unlock(&nm_i->nid_list_lock); in remove_free_nid()
2172 struct f2fs_nm_info *nm_i = NM_I(sbi); in scan_nat_page() local
2178 __set_bit_le(nat_ofs, nm_i->nat_block_bitmap); in scan_nat_page()
2183 if (unlikely(start_nid >= nm_i->max_nid)) in scan_nat_page()
2226 struct f2fs_nm_info *nm_i = NM_I(sbi); in scan_free_nid_bits() local
2230 down_read(&nm_i->nat_tree_lock); in scan_free_nid_bits()
2232 for (i = 0; i < nm_i->nat_blocks; i++) { in scan_free_nid_bits()
2233 if (!test_bit_le(i, nm_i->nat_block_bitmap)) in scan_free_nid_bits()
2235 if (!nm_i->free_nid_count[i]) in scan_free_nid_bits()
2238 idx = find_next_bit_le(nm_i->free_nid_bitmap[i], in scan_free_nid_bits()
2246 if (nm_i->nid_cnt[FREE_NID] >= MAX_FREE_NIDS) in scan_free_nid_bits()
2253 up_read(&nm_i->nat_tree_lock); in scan_free_nid_bits()
2259 struct f2fs_nm_info *nm_i = NM_I(sbi); in __f2fs_build_free_nids() local
2261 nid_t nid = nm_i->next_scan_nid; in __f2fs_build_free_nids()
2263 if (unlikely(nid >= nm_i->max_nid)) in __f2fs_build_free_nids()
2270 if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK) in __f2fs_build_free_nids()
2280 if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK) in __f2fs_build_free_nids()
2288 down_read(&nm_i->nat_tree_lock); in __f2fs_build_free_nids()
2292 nm_i->nat_block_bitmap)) { in __f2fs_build_free_nids()
2299 up_read(&nm_i->nat_tree_lock); in __f2fs_build_free_nids()
2308 if (unlikely(nid >= nm_i->max_nid)) in __f2fs_build_free_nids()
2316 nm_i->next_scan_nid = nid; in __f2fs_build_free_nids()
2321 up_read(&nm_i->nat_tree_lock); in __f2fs_build_free_nids()
2323 f2fs_ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nm_i->next_scan_nid), in __f2fs_build_free_nids()
2324 nm_i->ra_nid_pages, META_NAT, false); in __f2fs_build_free_nids()
2347 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_alloc_nid() local
2355 spin_lock(&nm_i->nid_list_lock); in f2fs_alloc_nid()
2357 if (unlikely(nm_i->available_nids == 0)) { in f2fs_alloc_nid()
2358 spin_unlock(&nm_i->nid_list_lock); in f2fs_alloc_nid()
2363 if (nm_i->nid_cnt[FREE_NID] && !on_f2fs_build_free_nids(nm_i)) { in f2fs_alloc_nid()
2364 f2fs_bug_on(sbi, list_empty(&nm_i->free_nid_list)); in f2fs_alloc_nid()
2365 i = list_first_entry(&nm_i->free_nid_list, in f2fs_alloc_nid()
2370 nm_i->available_nids--; in f2fs_alloc_nid()
2374 spin_unlock(&nm_i->nid_list_lock); in f2fs_alloc_nid()
2377 spin_unlock(&nm_i->nid_list_lock); in f2fs_alloc_nid()
2390 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_alloc_nid_done() local
2393 spin_lock(&nm_i->nid_list_lock); in f2fs_alloc_nid_done()
2394 i = __lookup_free_nid_list(nm_i, nid); in f2fs_alloc_nid_done()
2397 spin_unlock(&nm_i->nid_list_lock); in f2fs_alloc_nid_done()
2407 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_alloc_nid_failed() local
2414 spin_lock(&nm_i->nid_list_lock); in f2fs_alloc_nid_failed()
2415 i = __lookup_free_nid_list(nm_i, nid); in f2fs_alloc_nid_failed()
2425 nm_i->available_nids++; in f2fs_alloc_nid_failed()
2429 spin_unlock(&nm_i->nid_list_lock); in f2fs_alloc_nid_failed()
2437 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_try_to_free_nids() local
2441 if (nm_i->nid_cnt[FREE_NID] <= MAX_FREE_NIDS) in f2fs_try_to_free_nids()
2444 if (!mutex_trylock(&nm_i->build_lock)) in f2fs_try_to_free_nids()
2447 spin_lock(&nm_i->nid_list_lock); in f2fs_try_to_free_nids()
2448 list_for_each_entry_safe(i, next, &nm_i->free_nid_list, list) { in f2fs_try_to_free_nids()
2450 nm_i->nid_cnt[FREE_NID] <= MAX_FREE_NIDS) in f2fs_try_to_free_nids()
2457 spin_unlock(&nm_i->nid_list_lock); in f2fs_try_to_free_nids()
2458 mutex_unlock(&nm_i->build_lock); in f2fs_try_to_free_nids()
2652 struct f2fs_nm_info *nm_i = NM_I(sbi); in remove_nats_in_journal() local
2668 ne = __lookup_nat_cache(nm_i, nid); in remove_nats_in_journal()
2671 __init_nat_entry(nm_i, ne, &raw_ne, true); in remove_nats_in_journal()
2681 spin_lock(&nm_i->nid_list_lock); in remove_nats_in_journal()
2682 nm_i->available_nids--; in remove_nats_in_journal()
2683 spin_unlock(&nm_i->nid_list_lock); in remove_nats_in_journal()
2686 __set_nat_cache_dirty(nm_i, ne); in remove_nats_in_journal()
2713 struct f2fs_nm_info *nm_i = NM_I(sbi); in __update_nat_bits() local
2731 __set_bit_le(nat_index, nm_i->empty_nat_bits); in __update_nat_bits()
2732 __clear_bit_le(nat_index, nm_i->full_nat_bits); in __update_nat_bits()
2736 __clear_bit_le(nat_index, nm_i->empty_nat_bits); in __update_nat_bits()
2738 __set_bit_le(nat_index, nm_i->full_nat_bits); in __update_nat_bits()
2740 __clear_bit_le(nat_index, nm_i->full_nat_bits); in __update_nat_bits()
2819 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_flush_nat_entries() local
2830 down_write(&nm_i->nat_tree_lock); in f2fs_flush_nat_entries()
2832 up_write(&nm_i->nat_tree_lock); in f2fs_flush_nat_entries()
2835 if (!nm_i->dirty_nat_cnt) in f2fs_flush_nat_entries()
2838 down_write(&nm_i->nat_tree_lock); in f2fs_flush_nat_entries()
2846 !__has_cursum_space(journal, nm_i->dirty_nat_cnt, NAT_JOURNAL)) in f2fs_flush_nat_entries()
2849 while ((found = __gang_lookup_nat_set(nm_i, in f2fs_flush_nat_entries()
2862 up_write(&nm_i->nat_tree_lock); in f2fs_flush_nat_entries()
2869 struct f2fs_nm_info *nm_i = NM_I(sbi); in __get_nat_bitmaps() local
2870 unsigned int nat_bits_bytes = nm_i->nat_blocks / BITS_PER_BYTE; in __get_nat_bitmaps()
2878 nm_i->nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8); in __get_nat_bitmaps()
2879 nm_i->nat_bits = f2fs_kzalloc(sbi, in __get_nat_bitmaps()
2880 nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL); in __get_nat_bitmaps()
2881 if (!nm_i->nat_bits) in __get_nat_bitmaps()
2885 nm_i->nat_bits_blocks; in __get_nat_bitmaps()
2886 for (i = 0; i < nm_i->nat_bits_blocks; i++) { in __get_nat_bitmaps()
2895 memcpy(nm_i->nat_bits + (i << F2FS_BLKSIZE_BITS), in __get_nat_bitmaps()
2901 if (cpu_to_le64(cp_ver) != *(__le64 *)nm_i->nat_bits) { in __get_nat_bitmaps()
2906 nm_i->full_nat_bits = nm_i->nat_bits + 8; in __get_nat_bitmaps()
2907 nm_i->empty_nat_bits = nm_i->full_nat_bits + nat_bits_bytes; in __get_nat_bitmaps()
2915 struct f2fs_nm_info *nm_i = NM_I(sbi); in load_free_nid_bitmap() local
2922 for (i = 0; i < nm_i->nat_blocks; i++) { in load_free_nid_bitmap()
2923 i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i); in load_free_nid_bitmap()
2924 if (i >= nm_i->nat_blocks) in load_free_nid_bitmap()
2927 __set_bit_le(i, nm_i->nat_block_bitmap); in load_free_nid_bitmap()
2938 for (i = 0; i < nm_i->nat_blocks; i++) { in load_free_nid_bitmap()
2939 i = find_next_bit_le(nm_i->full_nat_bits, nm_i->nat_blocks, i); in load_free_nid_bitmap()
2940 if (i >= nm_i->nat_blocks) in load_free_nid_bitmap()
2943 __set_bit_le(i, nm_i->nat_block_bitmap); in load_free_nid_bitmap()
2950 struct f2fs_nm_info *nm_i = NM_I(sbi); in init_node_manager() local
2955 nm_i->nat_blkaddr = le32_to_cpu(sb_raw->nat_blkaddr); in init_node_manager()
2959 nm_i->nat_blocks = nat_segs << le32_to_cpu(sb_raw->log_blocks_per_seg); in init_node_manager()
2960 nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nm_i->nat_blocks; in init_node_manager()
2963 nm_i->available_nids = nm_i->max_nid - sbi->total_valid_node_count - in init_node_manager()
2965 nm_i->nid_cnt[FREE_NID] = 0; in init_node_manager()
2966 nm_i->nid_cnt[PREALLOC_NID] = 0; in init_node_manager()
2967 nm_i->nat_cnt = 0; in init_node_manager()
2968 nm_i->ram_thresh = DEF_RAM_THRESHOLD; in init_node_manager()
2969 nm_i->ra_nid_pages = DEF_RA_NID_PAGES; in init_node_manager()
2970 nm_i->dirty_nats_ratio = DEF_DIRTY_NAT_RATIO_THRESHOLD; in init_node_manager()
2972 INIT_RADIX_TREE(&nm_i->free_nid_root, GFP_ATOMIC); in init_node_manager()
2973 INIT_LIST_HEAD(&nm_i->free_nid_list); in init_node_manager()
2974 INIT_RADIX_TREE(&nm_i->nat_root, GFP_NOIO); in init_node_manager()
2975 INIT_RADIX_TREE(&nm_i->nat_set_root, GFP_NOIO); in init_node_manager()
2976 INIT_LIST_HEAD(&nm_i->nat_entries); in init_node_manager()
2977 spin_lock_init(&nm_i->nat_list_lock); in init_node_manager()
2979 mutex_init(&nm_i->build_lock); in init_node_manager()
2980 spin_lock_init(&nm_i->nid_list_lock); in init_node_manager()
2981 init_rwsem(&nm_i->nat_tree_lock); in init_node_manager()
2983 nm_i->next_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); in init_node_manager()
2984 nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); in init_node_manager()
2989 nm_i->nat_bitmap = kmemdup(version_bitmap, nm_i->bitmap_size, in init_node_manager()
2991 if (!nm_i->nat_bitmap) in init_node_manager()
2999 nm_i->nat_bitmap_mir = kmemdup(version_bitmap, nm_i->bitmap_size, in init_node_manager()
3001 if (!nm_i->nat_bitmap_mir) in init_node_manager()
3010 struct f2fs_nm_info *nm_i = NM_I(sbi); in init_free_nid_cache() local
3013 nm_i->free_nid_bitmap = in init_free_nid_cache()
3015 nm_i->nat_blocks), in init_free_nid_cache()
3017 if (!nm_i->free_nid_bitmap) in init_free_nid_cache()
3020 for (i = 0; i < nm_i->nat_blocks; i++) { in init_free_nid_cache()
3021 nm_i->free_nid_bitmap[i] = f2fs_kvzalloc(sbi, in init_free_nid_cache()
3023 if (!nm_i->free_nid_bitmap[i]) in init_free_nid_cache()
3027 nm_i->nat_block_bitmap = f2fs_kvzalloc(sbi, nm_i->nat_blocks / 8, in init_free_nid_cache()
3029 if (!nm_i->nat_block_bitmap) in init_free_nid_cache()
3032 nm_i->free_nid_count = in init_free_nid_cache()
3034 nm_i->nat_blocks), in init_free_nid_cache()
3036 if (!nm_i->free_nid_count) in init_free_nid_cache()
3066 struct f2fs_nm_info *nm_i = NM_I(sbi); in f2fs_destroy_node_manager() local
3073 if (!nm_i) in f2fs_destroy_node_manager()
3077 spin_lock(&nm_i->nid_list_lock); in f2fs_destroy_node_manager()
3078 list_for_each_entry_safe(i, next_i, &nm_i->free_nid_list, list) { in f2fs_destroy_node_manager()
3080 spin_unlock(&nm_i->nid_list_lock); in f2fs_destroy_node_manager()
3082 spin_lock(&nm_i->nid_list_lock); in f2fs_destroy_node_manager()
3084 f2fs_bug_on(sbi, nm_i->nid_cnt[FREE_NID]); in f2fs_destroy_node_manager()
3085 f2fs_bug_on(sbi, nm_i->nid_cnt[PREALLOC_NID]); in f2fs_destroy_node_manager()
3086 f2fs_bug_on(sbi, !list_empty(&nm_i->free_nid_list)); in f2fs_destroy_node_manager()
3087 spin_unlock(&nm_i->nid_list_lock); in f2fs_destroy_node_manager()
3090 down_write(&nm_i->nat_tree_lock); in f2fs_destroy_node_manager()
3091 while ((found = __gang_lookup_nat_cache(nm_i, in f2fs_destroy_node_manager()
3097 spin_lock(&nm_i->nat_list_lock); in f2fs_destroy_node_manager()
3099 spin_unlock(&nm_i->nat_list_lock); in f2fs_destroy_node_manager()
3101 __del_from_nat_cache(nm_i, natvec[idx]); in f2fs_destroy_node_manager()
3104 f2fs_bug_on(sbi, nm_i->nat_cnt); in f2fs_destroy_node_manager()
3108 while ((found = __gang_lookup_nat_set(nm_i, in f2fs_destroy_node_manager()
3116 radix_tree_delete(&nm_i->nat_set_root, setvec[idx]->set); in f2fs_destroy_node_manager()
3120 up_write(&nm_i->nat_tree_lock); in f2fs_destroy_node_manager()
3122 kvfree(nm_i->nat_block_bitmap); in f2fs_destroy_node_manager()
3123 if (nm_i->free_nid_bitmap) { in f2fs_destroy_node_manager()
3126 for (i = 0; i < nm_i->nat_blocks; i++) in f2fs_destroy_node_manager()
3127 kvfree(nm_i->free_nid_bitmap[i]); in f2fs_destroy_node_manager()
3128 kfree(nm_i->free_nid_bitmap); in f2fs_destroy_node_manager()
3130 kvfree(nm_i->free_nid_count); in f2fs_destroy_node_manager()
3132 kfree(nm_i->nat_bitmap); in f2fs_destroy_node_manager()
3133 kfree(nm_i->nat_bits); in f2fs_destroy_node_manager()
3135 kfree(nm_i->nat_bitmap_mir); in f2fs_destroy_node_manager()
3138 kfree(nm_i); in f2fs_destroy_node_manager()