checkpoint.c (cfb271d485d0ec31eb92b51f4fbe54bf6542e8e6) checkpoint.c (6bacf52fb58aeb3e89d9a62970b85a5570aa8ace)
1/*
2 * fs/f2fs/checkpoint.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

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

61 if (PageUptodate(page))
62 goto out;
63
64 if (f2fs_submit_page_bio(sbi, page, index,
65 READ_SYNC | REQ_META | REQ_PRIO))
66 goto repeat;
67
68 lock_page(page);
1/*
2 * fs/f2fs/checkpoint.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

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

61 if (PageUptodate(page))
62 goto out;
63
64 if (f2fs_submit_page_bio(sbi, page, index,
65 READ_SYNC | REQ_META | REQ_PRIO))
66 goto repeat;
67
68 lock_page(page);
69 if (page->mapping != mapping) {
69 if (unlikely(page->mapping != mapping)) {
70 f2fs_put_page(page, 1);
71 goto repeat;
72 }
73out:
74 mark_page_accessed(page);
75 return page;
76}
77

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

468{
469 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
470 struct list_head *head = &sbi->dir_inode_list;
471 struct list_head *this;
472
473 list_for_each(this, head) {
474 struct dir_inode_entry *entry;
475 entry = list_entry(this, struct dir_inode_entry, list);
70 f2fs_put_page(page, 1);
71 goto repeat;
72 }
73out:
74 mark_page_accessed(page);
75 return page;
76}
77

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

468{
469 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
470 struct list_head *head = &sbi->dir_inode_list;
471 struct list_head *this;
472
473 list_for_each(this, head) {
474 struct dir_inode_entry *entry;
475 entry = list_entry(this, struct dir_inode_entry, list);
476 if (entry->inode == inode)
476 if (unlikely(entry->inode == inode))
477 return -EEXIST;
478 }
479 list_add_tail(&new->list, head);
480 stat_inc_dirty_dir(sbi);
481 return 0;
482}
483
484void set_dirty_dir_page(struct inode *inode, struct page *page)

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

778
779 /* update user_block_counts */
780 sbi->last_valid_block_count = sbi->total_valid_block_count;
781 sbi->alloc_valid_block_count = 0;
782
783 /* Here, we only have one bio having CP pack */
784 sync_meta_pages(sbi, META_FLUSH, LONG_MAX);
785
477 return -EEXIST;
478 }
479 list_add_tail(&new->list, head);
480 stat_inc_dirty_dir(sbi);
481 return 0;
482}
483
484void set_dirty_dir_page(struct inode *inode, struct page *page)

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

778
779 /* update user_block_counts */
780 sbi->last_valid_block_count = sbi->total_valid_block_count;
781 sbi->alloc_valid_block_count = 0;
782
783 /* Here, we only have one bio having CP pack */
784 sync_meta_pages(sbi, META_FLUSH, LONG_MAX);
785
786 if (!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG)) {
786 if (unlikely(!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))) {
787 clear_prefree_segments(sbi);
788 F2FS_RESET_SB_DIRT(sbi);
789 }
790}
791
792/*
793 * We guarantee that this checkpoint procedure should not fail.
794 */

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

835 INIT_LIST_HEAD(&sbi->orphan_inode_list);
836 sbi->n_orphans = 0;
837}
838
839int __init create_checkpoint_caches(void)
840{
841 orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry",
842 sizeof(struct orphan_inode_entry), NULL);
787 clear_prefree_segments(sbi);
788 F2FS_RESET_SB_DIRT(sbi);
789 }
790}
791
792/*
793 * We guarantee that this checkpoint procedure should not fail.
794 */

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

835 INIT_LIST_HEAD(&sbi->orphan_inode_list);
836 sbi->n_orphans = 0;
837}
838
839int __init create_checkpoint_caches(void)
840{
841 orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry",
842 sizeof(struct orphan_inode_entry), NULL);
843 if (unlikely(!orphan_entry_slab))
843 if (!orphan_entry_slab)
844 return -ENOMEM;
845 inode_entry_slab = f2fs_kmem_cache_create("f2fs_dirty_dir_entry",
846 sizeof(struct dir_inode_entry), NULL);
844 return -ENOMEM;
845 inode_entry_slab = f2fs_kmem_cache_create("f2fs_dirty_dir_entry",
846 sizeof(struct dir_inode_entry), NULL);
847 if (unlikely(!inode_entry_slab)) {
847 if (!inode_entry_slab) {
848 kmem_cache_destroy(orphan_entry_slab);
849 return -ENOMEM;
850 }
851 return 0;
852}
853
854void destroy_checkpoint_caches(void)
855{
856 kmem_cache_destroy(orphan_entry_slab);
857 kmem_cache_destroy(inode_entry_slab);
858}
848 kmem_cache_destroy(orphan_entry_slab);
849 return -ENOMEM;
850 }
851 return 0;
852}
853
854void destroy_checkpoint_caches(void)
855{
856 kmem_cache_destroy(orphan_entry_slab);
857 kmem_cache_destroy(inode_entry_slab);
858}