aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-04-03 09:19:03 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-04-03 09:19:03 -0400
commit49952fa182a2e9b3f40b974278c5b1144f0c918b (patch)
treed7c3ed17f9bf942749fcb836c112dabb7da35a21 /fs/f2fs/node.c
parent1571f84a1f65f6bf35d99d59ba52bdee6722e4b6 (diff)
f2fs: reduce redundant spin_lock operations
This patch reduces redundant spin_lock operations in alloc_nid_failed(). The alloc_nid_failed() does not need to delete entry and add one again by triggering spin_lock and spin_unlock redundantly. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 95298ef68262..ad3adbee842a 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1407,10 +1407,8 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)
1407 1407
1408 spin_lock(&nm_i->free_nid_list_lock); 1408 spin_lock(&nm_i->free_nid_list_lock);
1409 i = __lookup_free_nid_list(nid, &nm_i->free_nid_list); 1409 i = __lookup_free_nid_list(nid, &nm_i->free_nid_list);
1410 if (i) { 1410 BUG_ON(!i || i->state != NID_ALLOC);
1411 BUG_ON(i->state != NID_ALLOC); 1411 __del_from_free_nid_list(i);
1412 __del_from_free_nid_list(i);
1413 }
1414 spin_unlock(&nm_i->free_nid_list_lock); 1412 spin_unlock(&nm_i->free_nid_list_lock);
1415} 1413}
1416 1414
@@ -1419,8 +1417,15 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)
1419 */ 1417 */
1420void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid) 1418void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)
1421{ 1419{
1422 alloc_nid_done(sbi, nid); 1420 struct f2fs_nm_info *nm_i = NM_I(sbi);
1423 add_free_nid(NM_I(sbi), nid); 1421 struct free_nid *i;
1422
1423 spin_lock(&nm_i->free_nid_list_lock);
1424 i = __lookup_free_nid_list(nid, &nm_i->free_nid_list);
1425 BUG_ON(!i || i->state != NID_ALLOC);
1426 i->state = NID_NEW;
1427 nm_i->fcnt++;
1428 spin_unlock(&nm_i->free_nid_list_lock);
1424} 1429}
1425 1430
1426void recover_node_page(struct f2fs_sb_info *sbi, struct page *page, 1431void recover_node_page(struct f2fs_sb_info *sbi, struct page *page,