diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-21 17:20:21 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-28 11:24:10 +0900 |
commit | 029cd28c1f739bbfc5105035696d5f1f4e45d161 (patch) | |
tree | 738b26494ab4b9c959398e729caefe16956bee79 /fs/f2fs/segment.h | |
parent | f58ad8f51a5a0f34c8d41ffc065e0f1c896c991c (diff) | |
download | linux-029cd28c1f739bbfc5105035696d5f1f4e45d161.tar.gz linux-029cd28c1f739bbfc5105035696d5f1f4e45d161.tar.bz2 linux-029cd28c1f739bbfc5105035696d5f1f4e45d161.zip |
f2fs: fix equation of has_not_enough_free_secs()
Practically, has_not_enough_free_secs() should calculate with the numbers of
current node and directory data blocks together.
Actually the equation was implemented in need_to_flush().
So, this patch removes need_flush() and moves the equation into
has_not_enough_free_secs().
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r-- | fs/f2fs/segment.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 0948405af6f5..66a288a52fd3 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -459,7 +459,20 @@ static inline int get_ssr_segment(struct f2fs_sb_info *sbi, int type) static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi) { - return free_sections(sbi) <= reserved_sections(sbi); + unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) * + sbi->segs_per_sec; + int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1) + >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; + int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1) + >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; + + if (sbi->por_doing) + return false; + + if (free_sections(sbi) <= (node_secs + 2 * dent_secs + + reserved_sections(sbi))) + return true; + return false; } static inline int utilization(struct f2fs_sb_info *sbi) |