summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2013-02-02 23:52:59 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-02-12 07:15:02 +0900
commit5ac206cf4f9aad871aa1f1dd653a3404092db56c (patch)
treef9d487406816b58c5e3b1b52a376d459245be803 /fs/f2fs/f2fs.h
parent25718423ea6f7118f9c173adff0fac52414571b8 (diff)
downloadop-kernel-dev-5ac206cf4f9aad871aa1f1dd653a3404092db56c.zip
op-kernel-dev-5ac206cf4f9aad871aa1f1dd653a3404092db56c.tar.gz
f2fs: make an accessor to get sections for particular block type
Introduce accessor to get the sections based upon the block type (node,dents...) and modify the functions : should_do_checkpoint, has_not_enough_free_secs to use this accessor function to get the node sections and dent sections. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5022a7d..87840bc 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -573,6 +573,14 @@ static inline int get_pages(struct f2fs_sb_info *sbi, int count_type)
return atomic_read(&sbi->nr_pages[count_type]);
}
+static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type)
+{
+ unsigned int pages_per_sec = sbi->segs_per_sec *
+ (1 << sbi->log_blocks_per_seg);
+ return ((get_pages(sbi, block_type) + pages_per_sec - 1)
+ >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
+}
+
static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi)
{
block_t ret;
OpenPOWER on IntegriCloud