recovery.c (bc4a1f873b9db010f5b0971ee5f2987d9be32c36) recovery.c (caf0047e7e1e60a7ad1d655d3b81b32e2dfb6095)
1/*
2 * fs/f2fs/recovery.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

--- 494 unchanged lines hidden (view full) ---

503 fsync_entry_slab = f2fs_kmem_cache_create("f2fs_fsync_inode_entry",
504 sizeof(struct fsync_inode_entry));
505 if (!fsync_entry_slab)
506 return -ENOMEM;
507
508 INIT_LIST_HEAD(&inode_list);
509
510 /* step #1: find fsynced inode numbers */
1/*
2 * fs/f2fs/recovery.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

--- 494 unchanged lines hidden (view full) ---

503 fsync_entry_slab = f2fs_kmem_cache_create("f2fs_fsync_inode_entry",
504 sizeof(struct fsync_inode_entry));
505 if (!fsync_entry_slab)
506 return -ENOMEM;
507
508 INIT_LIST_HEAD(&inode_list);
509
510 /* step #1: find fsynced inode numbers */
511 sbi->por_doing = true;
511 set_sbi_flag(sbi, SBI_POR_DOING);
512
513 /* prevent checkpoint */
514 mutex_lock(&sbi->cp_mutex);
515
516 blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
517
518 err = find_fsync_dnodes(sbi, &inode_list);
519 if (err)

--- 16 unchanged lines hidden (view full) ---

536 truncate_inode_pages_range(META_MAPPING(sbi),
537 MAIN_BLKADDR(sbi) << PAGE_CACHE_SHIFT, -1);
538
539 if (err) {
540 truncate_inode_pages_final(NODE_MAPPING(sbi));
541 truncate_inode_pages_final(META_MAPPING(sbi));
542 }
543
512
513 /* prevent checkpoint */
514 mutex_lock(&sbi->cp_mutex);
515
516 blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
517
518 err = find_fsync_dnodes(sbi, &inode_list);
519 if (err)

--- 16 unchanged lines hidden (view full) ---

536 truncate_inode_pages_range(META_MAPPING(sbi),
537 MAIN_BLKADDR(sbi) << PAGE_CACHE_SHIFT, -1);
538
539 if (err) {
540 truncate_inode_pages_final(NODE_MAPPING(sbi));
541 truncate_inode_pages_final(META_MAPPING(sbi));
542 }
543
544 sbi->por_doing = false;
544 clear_sbi_flag(sbi, SBI_POR_DOING);
545 if (err) {
546 discard_next_dnode(sbi, blkaddr);
547
548 /* Flush all the NAT/SIT pages */
549 while (get_pages(sbi, F2FS_DIRTY_META))
550 sync_meta_pages(sbi, META, LONG_MAX);
551 set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
552 mutex_unlock(&sbi->cp_mutex);
553 } else if (need_writecp) {
554 struct cp_control cpc = {
555 .reason = CP_SYNC,
556 };
557 mutex_unlock(&sbi->cp_mutex);
558 write_checkpoint(sbi, &cpc);
559 } else {
560 mutex_unlock(&sbi->cp_mutex);
561 }
562 return err;
563}
545 if (err) {
546 discard_next_dnode(sbi, blkaddr);
547
548 /* Flush all the NAT/SIT pages */
549 while (get_pages(sbi, F2FS_DIRTY_META))
550 sync_meta_pages(sbi, META, LONG_MAX);
551 set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
552 mutex_unlock(&sbi->cp_mutex);
553 } else if (need_writecp) {
554 struct cp_control cpc = {
555 .reason = CP_SYNC,
556 };
557 mutex_unlock(&sbi->cp_mutex);
558 write_checkpoint(sbi, &cpc);
559 } else {
560 mutex_unlock(&sbi->cp_mutex);
561 }
562 return err;
563}