]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/f2fs/f2fs.h
f2fs: make an accessor to get sections for particular block type
[karo-tx-linux.git] / fs / f2fs / f2fs.h
index 5022a7d7f7ca41ee3315855cf4ea9e7703469039..87840bccaf212bd49c3188dc6c7a6f450ec5cac4 100644 (file)
@@ -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;