aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2013-11-29 03:37:00 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-12-22 20:18:04 -0500
commit6947eea957e4c4c873f92a4ee5da7a6ef0012718 (patch)
tree0c6c7c5410554c9dc95e880944ebd1d18e6cec1d /fs
parenta66c7b2fcfbc9ef4e972f6bc2b63d72d00f23122 (diff)
f2fs: avoid to calculate incorrect max orphan number
Because we will write node summaries when do_checkpoint with umount flag, our number of max orphan blocks should minus NR_CURSEG_NODE_TYPE additional. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Shu Tan <shu.tan@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/checkpoint.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 21e721534965..c7e0572fdede 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -190,12 +190,13 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
190 int err = 0; 190 int err = 0;
191 191
192 /* 192 /*
193 * considering 512 blocks in a segment 5 blocks are needed for cp 193 * considering 512 blocks in a segment 8 blocks are needed for cp
194 * and log segment summaries. Remaining blocks are used to keep 194 * and log segment summaries. Remaining blocks are used to keep
195 * orphan entries with the limitation one reserved segment 195 * orphan entries with the limitation one reserved segment
196 * for cp pack we can have max 1020*507 orphan entries 196 * for cp pack we can have max 1020*504 orphan entries
197 */ 197 */
198 max_orphans = (sbi->blocks_per_seg - 5) * F2FS_ORPHANS_PER_BLOCK; 198 max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE)
199 * F2FS_ORPHANS_PER_BLOCK;
199 mutex_lock(&sbi->orphan_inode_mutex); 200 mutex_lock(&sbi->orphan_inode_mutex);
200 if (sbi->n_orphans >= max_orphans) 201 if (sbi->n_orphans >= max_orphans)
201 err = -ENOSPC; 202 err = -ENOSPC;