node.c (87a9bd265678ec3cc8431b14bcb14c68d0f94032) | node.c (7bd59381c82defe19875284c48b1ac9dacd16e8f) |
---|---|
1/* 2 * fs/f2fs/node.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 1282 unchanged lines hidden (view full) --- 1291 1292 if (nm_i->fcnt > 2 * MAX_FREE_NIDS) 1293 return -1; 1294 1295 /* 0 nid should not be used */ 1296 if (nid == 0) 1297 return 0; 1298 | 1/* 2 * fs/f2fs/node.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 1282 unchanged lines hidden (view full) --- 1291 1292 if (nm_i->fcnt > 2 * MAX_FREE_NIDS) 1293 return -1; 1294 1295 /* 0 nid should not be used */ 1296 if (nid == 0) 1297 return 0; 1298 |
1299 if (!build) 1300 goto retry; 1301 1302 /* do not add allocated nids */ 1303 read_lock(&nm_i->nat_tree_lock); 1304 ne = __lookup_nat_cache(nm_i, nid); 1305 if (ne && nat_get_blkaddr(ne) != NULL_ADDR) 1306 allocated = true; 1307 read_unlock(&nm_i->nat_tree_lock); 1308 if (allocated) 1309 return 0; 1310retry: 1311 i = kmem_cache_alloc(free_nid_slab, GFP_NOFS); 1312 if (!i) { 1313 cond_resched(); 1314 goto retry; | 1299 if (build) { 1300 /* do not add allocated nids */ 1301 read_lock(&nm_i->nat_tree_lock); 1302 ne = __lookup_nat_cache(nm_i, nid); 1303 if (ne && nat_get_blkaddr(ne) != NULL_ADDR) 1304 allocated = true; 1305 read_unlock(&nm_i->nat_tree_lock); 1306 if (allocated) 1307 return 0; |
1315 } | 1308 } |
1309 1310 i = f2fs_kmem_cache_alloc(free_nid_slab, GFP_NOFS); |
|
1316 i->nid = nid; 1317 i->state = NID_NEW; 1318 1319 spin_lock(&nm_i->free_nid_list_lock); 1320 if (__lookup_free_nid_list(nid, &nm_i->free_nid_list)) { 1321 spin_unlock(&nm_i->free_nid_list_lock); 1322 kmem_cache_free(free_nid_slab, i); 1323 return 0; --- 512 unchanged lines hidden --- | 1311 i->nid = nid; 1312 i->state = NID_NEW; 1313 1314 spin_lock(&nm_i->free_nid_list_lock); 1315 if (__lookup_free_nid_list(nid, &nm_i->free_nid_list)) { 1316 spin_unlock(&nm_i->free_nid_list_lock); 1317 kmem_cache_free(free_nid_slab, i); 1318 return 0; --- 512 unchanged lines hidden --- |