segment.h (4ba24fef3eb3b142197135223b90ced2f319cd53) | segment.h (caf0047e7e1e60a7ad1d655d3b81b32e2dfb6095) |
---|---|
1/* 2 * fs/f2fs/segment.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 446 unchanged lines hidden (view full) --- 455 reserved_sections(sbi) + 1); 456} 457 458static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, int freed) 459{ 460 int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES); 461 int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS); 462 | 1/* 2 * fs/f2fs/segment.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 446 unchanged lines hidden (view full) --- 455 reserved_sections(sbi) + 1); 456} 457 458static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi, int freed) 459{ 460 int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES); 461 int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS); 462 |
463 if (unlikely(sbi->por_doing)) | 463 if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) |
464 return false; 465 466 return (free_sections(sbi) + freed) <= (node_secs + 2 * dent_secs + 467 reserved_sections(sbi)); 468} 469 470static inline bool excess_prefree_segs(struct f2fs_sb_info *sbi) 471{ --- 122 unchanged lines hidden (view full) --- 594 is_valid = !is_valid; 595 } while (cur_pos < sbi->blocks_per_seg); 596 BUG_ON(GET_SIT_VBLOCKS(raw_sit) != valid_blocks); 597} 598#else 599static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno) 600{ 601 if (segno > TOTAL_SEGS(sbi) - 1) | 464 return false; 465 466 return (free_sections(sbi) + freed) <= (node_secs + 2 * dent_secs + 467 reserved_sections(sbi)); 468} 469 470static inline bool excess_prefree_segs(struct f2fs_sb_info *sbi) 471{ --- 122 unchanged lines hidden (view full) --- 594 is_valid = !is_valid; 595 } while (cur_pos < sbi->blocks_per_seg); 596 BUG_ON(GET_SIT_VBLOCKS(raw_sit) != valid_blocks); 597} 598#else 599static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno) 600{ 601 if (segno > TOTAL_SEGS(sbi) - 1) |
602 sbi->need_fsck = true; | 602 set_sbi_flag(sbi, SBI_NEED_FSCK); |
603} 604 605static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) 606{ 607 if (blk_addr < SEG0_BLKADDR(sbi) || blk_addr >= MAX_BLKADDR(sbi)) | 603} 604 605static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) 606{ 607 if (blk_addr < SEG0_BLKADDR(sbi) || blk_addr >= MAX_BLKADDR(sbi)) |
608 sbi->need_fsck = true; | 608 set_sbi_flag(sbi, SBI_NEED_FSCK); |
609} 610 611/* 612 * Summary block is always treated as an invalid block 613 */ 614static inline void check_block_count(struct f2fs_sb_info *sbi, 615 int segno, struct f2fs_sit_entry *raw_sit) 616{ 617 /* check segment usage */ 618 if (GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg) | 609} 610 611/* 612 * Summary block is always treated as an invalid block 613 */ 614static inline void check_block_count(struct f2fs_sb_info *sbi, 615 int segno, struct f2fs_sit_entry *raw_sit) 616{ 617 /* check segment usage */ 618 if (GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg) |
619 sbi->need_fsck = true; | 619 set_sbi_flag(sbi, SBI_NEED_FSCK); |
620 621 /* check boundary of a given segment number */ 622 if (segno > TOTAL_SEGS(sbi) - 1) | 620 621 /* check boundary of a given segment number */ 622 if (segno > TOTAL_SEGS(sbi) - 1) |
623 sbi->need_fsck = true; | 623 set_sbi_flag(sbi, SBI_NEED_FSCK); |
624} 625#endif 626 627static inline pgoff_t current_sit_addr(struct f2fs_sb_info *sbi, 628 unsigned int start) 629{ 630 struct sit_info *sit_i = SIT_I(sbi); 631 unsigned int offset = SIT_BLOCK_OFFSET(start); --- 118 unchanged lines hidden --- | 624} 625#endif 626 627static inline pgoff_t current_sit_addr(struct f2fs_sb_info *sbi, 628 unsigned int start) 629{ 630 struct sit_info *sit_i = SIT_I(sbi); 631 unsigned int offset = SIT_BLOCK_OFFSET(start); --- 118 unchanged lines hidden --- |