Lines Matching refs:sbi
203 static inline struct f2fs_super_block *F2FS_RAW_SUPER(struct f2fs_sb_info *sbi) in F2FS_RAW_SUPER() argument
205 return (struct f2fs_super_block *)(sbi->raw_super); in F2FS_RAW_SUPER()
208 static inline struct f2fs_checkpoint *F2FS_CKPT(struct f2fs_sb_info *sbi) in F2FS_CKPT() argument
210 return (struct f2fs_checkpoint *)(sbi->ckpt); in F2FS_CKPT()
213 static inline struct f2fs_fsck *F2FS_FSCK(struct f2fs_sb_info *sbi) in F2FS_FSCK() argument
215 return (struct f2fs_fsck *)(sbi->fsck); in F2FS_FSCK()
218 static inline struct f2fs_nm_info *NM_I(struct f2fs_sb_info *sbi) in NM_I() argument
220 return (struct f2fs_nm_info *)(sbi->nm_info); in NM_I()
223 static inline struct f2fs_sm_info *SM_I(struct f2fs_sb_info *sbi) in SM_I() argument
225 return (struct f2fs_sm_info *)(sbi->sm_info); in SM_I()
228 static inline struct sit_info *SIT_I(struct f2fs_sb_info *sbi) in SIT_I() argument
230 return (struct sit_info *)(SM_I(sbi)->sit_info); in SIT_I()
244 static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag) in __bitmap_size() argument
246 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); in __bitmap_size()
257 static inline void *__bitmap_ptr(struct f2fs_sb_info *sbi, int flag) in __bitmap_ptr() argument
259 struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); in __bitmap_ptr()
261 if (le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload) > 0) { in __bitmap_ptr()
279 static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi) in __start_cp_addr() argument
281 block_t start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr); in __start_cp_addr()
283 if (sbi->cur_cp == 2) in __start_cp_addr()
284 start_addr += sbi->blocks_per_seg; in __start_cp_addr()
288 static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi) in __start_sum_addr() argument
290 return le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_start_sum); in __start_sum_addr()
293 static inline block_t __end_block_addr(struct f2fs_sb_info *sbi) in __end_block_addr() argument
295 block_t end = SM_I(sbi)->main_blkaddr; in __end_block_addr()
296 return end + le64_to_cpu(F2FS_RAW_SUPER(sbi)->block_count); in __end_block_addr()
299 #define GET_ZONENO_FROM_SEGNO(sbi, segno) \ argument
300 ((segno / sbi->segs_per_sec) / sbi->secs_per_zone)
310 #define GET_SUM_BLKADDR(sbi, segno) \ argument
311 ((sbi->sm_info->ssa_blkaddr) + segno)
313 #define GET_SEGOFF_FROM_SEG0(sbi, blk_addr) \ argument
314 ((blk_addr) - SM_I(sbi)->seg0_blkaddr)
316 #define GET_SEGNO_FROM_SEG0(sbi, blk_addr) \ argument
317 (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) >> sbi->log_blocks_per_seg)
319 #define GET_BLKOFF_FROM_SEG0(sbi, blk_addr) \ argument
320 (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (sbi->blocks_per_seg - 1))
322 #define FREE_I_START_SEGNO(sbi) \ argument
323 GET_SEGNO_FROM_SEG0(sbi, SM_I(sbi)->main_blkaddr)
324 #define GET_R2L_SEGNO(sbi, segno) (segno + FREE_I_START_SEGNO(sbi)) argument
326 #define START_BLOCK(sbi, segno) (SM_I(sbi)->main_blkaddr + \ argument
327 ((segno) << sbi->log_blocks_per_seg))
329 static inline struct curseg_info *CURSEG_I(struct f2fs_sb_info *sbi, int type) in CURSEG_I() argument
331 return (struct curseg_info *)(SM_I(sbi)->curseg_array + type); in CURSEG_I()
334 static inline block_t start_sum_block(struct f2fs_sb_info *sbi) in start_sum_block() argument
336 return __start_cp_addr(sbi) + le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_start_sum); in start_sum_block()
339 static inline block_t sum_blk_addr(struct f2fs_sb_info *sbi, int base, int type) in sum_blk_addr() argument
341 return __start_cp_addr(sbi) + le32_to_cpu(F2FS_CKPT(sbi)->cp_pack_total_block_count) in sum_blk_addr()
357 #define TOTAL_SEGS(sbi) (SM_I(sbi)->main_segments) argument
359 static inline bool IS_VALID_NID(struct f2fs_sb_info *sbi, u32 nid) in IS_VALID_NID() argument
362 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_nat) in IS_VALID_NID()
363 << (sbi->log_blocks_per_seg - 1))); in IS_VALID_NID()
366 static inline bool IS_VALID_BLK_ADDR(struct f2fs_sb_info *sbi, u32 addr) in IS_VALID_BLK_ADDR() argument
370 if (addr >= le64_to_cpu(F2FS_RAW_SUPER(sbi)->block_count) || in IS_VALID_BLK_ADDR()
371 addr < SM_I(sbi)->main_blkaddr) { in IS_VALID_BLK_ADDR()
377 struct curseg_info *curseg = CURSEG_I(sbi, i); in IS_VALID_BLK_ADDR()
379 if (START_BLOCK(sbi, curseg->segno) + in IS_VALID_BLK_ADDR()
386 static inline int IS_CUR_SEGNO(struct f2fs_sb_info *sbi, u32 segno, int type) in IS_CUR_SEGNO() argument
391 struct curseg_info *curseg = CURSEG_I(sbi, i); in IS_CUR_SEGNO()
402 static inline u64 BLKOFF_FROM_MAIN(struct f2fs_sb_info *sbi, u64 blk_addr) in BLKOFF_FROM_MAIN() argument
404 ASSERT(blk_addr >= SM_I(sbi)->main_blkaddr); in BLKOFF_FROM_MAIN()
405 return blk_addr - SM_I(sbi)->main_blkaddr; in BLKOFF_FROM_MAIN()
408 static inline u32 GET_SEGNO(struct f2fs_sb_info *sbi, u64 blk_addr) in GET_SEGNO() argument
410 return (u32)(BLKOFF_FROM_MAIN(sbi, blk_addr) in GET_SEGNO()
411 >> sbi->log_blocks_per_seg); in GET_SEGNO()
414 static inline u32 OFFSET_IN_SEG(struct f2fs_sb_info *sbi, u64 blk_addr) in OFFSET_IN_SEG() argument
416 return (u32)(BLKOFF_FROM_MAIN(sbi, blk_addr) in OFFSET_IN_SEG()
417 % (1 << sbi->log_blocks_per_seg)); in OFFSET_IN_SEG()
464 extern int lookup_nat_in_journal(struct f2fs_sb_info *sbi, u32 nid, struct f2fs_nat_entry *ne);