checkpoint.c (5459aa9770fe2e8c6a660a0985ea454c42cfd8c1) checkpoint.c (0d47c1adc2a1f1e4f4673f122a8328c90c58e232)
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

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

189const struct address_space_operations f2fs_meta_aops = {
190 .writepage = f2fs_write_meta_page,
191 .writepages = f2fs_write_meta_pages,
192 .set_page_dirty = f2fs_set_meta_page_dirty,
193};
194
195int acquire_orphan_inode(struct f2fs_sb_info *sbi)
196{
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

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

189const struct address_space_operations f2fs_meta_aops = {
190 .writepage = f2fs_write_meta_page,
191 .writepages = f2fs_write_meta_pages,
192 .set_page_dirty = f2fs_set_meta_page_dirty,
193};
194
195int acquire_orphan_inode(struct f2fs_sb_info *sbi)
196{
197 unsigned int max_orphans;
198 int err = 0;
199
197 int err = 0;
198
200 /*
201 * considering 512 blocks in a segment 8 blocks are needed for cp
202 * and log segment summaries. Remaining blocks are used to keep
203 * orphan entries with the limitation one reserved segment
204 * for cp pack we can have max 1020*504 orphan entries
205 */
206 max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE)
207 * F2FS_ORPHANS_PER_BLOCK;
208 mutex_lock(&sbi->orphan_inode_mutex);
199 mutex_lock(&sbi->orphan_inode_mutex);
209 if (unlikely(sbi->n_orphans >= max_orphans))
200 if (unlikely(sbi->n_orphans >= sbi->max_orphans))
210 err = -ENOSPC;
211 else
212 sbi->n_orphans++;
213 mutex_unlock(&sbi->orphan_inode_mutex);
201 err = -ENOSPC;
202 else
203 sbi->n_orphans++;
204 mutex_unlock(&sbi->orphan_inode_mutex);
205
214 return err;
215}
216
217void release_orphan_inode(struct f2fs_sb_info *sbi)
218{
219 mutex_lock(&sbi->orphan_inode_mutex);
220 f2fs_bug_on(sbi->n_orphans == 0);
221 sbi->n_orphans--;

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

829 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint");
830}
831
832void init_orphan_info(struct f2fs_sb_info *sbi)
833{
834 mutex_init(&sbi->orphan_inode_mutex);
835 INIT_LIST_HEAD(&sbi->orphan_inode_list);
836 sbi->n_orphans = 0;
206 return err;
207}
208
209void release_orphan_inode(struct f2fs_sb_info *sbi)
210{
211 mutex_lock(&sbi->orphan_inode_mutex);
212 f2fs_bug_on(sbi->n_orphans == 0);
213 sbi->n_orphans--;

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

821 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint");
822}
823
824void init_orphan_info(struct f2fs_sb_info *sbi)
825{
826 mutex_init(&sbi->orphan_inode_mutex);
827 INIT_LIST_HEAD(&sbi->orphan_inode_list);
828 sbi->n_orphans = 0;
829 /*
830 * considering 512 blocks in a segment 8 blocks are needed for cp
831 * and log segment summaries. Remaining blocks are used to keep
832 * orphan entries with the limitation one reserved segment
833 * for cp pack we can have max 1020*504 orphan entries
834 */
835 sbi->max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE)
836 * F2FS_ORPHANS_PER_BLOCK;
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 (!orphan_entry_slab)
844 return -ENOMEM;

--- 14 unchanged lines hidden ---
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 (!orphan_entry_slab)
844 return -ENOMEM;

--- 14 unchanged lines hidden ---