segment.h (aaccf3c97418f169afdbb5855e9cbcbda34e90fd) | segment.h (4354994f097d068a894aa1a0860da54571df3582) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 |
|
1/* 2 * fs/f2fs/segment.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ | 2/* 3 * fs/f2fs/segment.h 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * 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 9 * published by the Free Software Foundation. | |
10 */ 11#include <linux/blkdev.h> 12#include <linux/backing-dev.h> 13 14/* constant macro */ 15#define NULL_SEGNO ((unsigned int)(~0)) 16#define NULL_SECNO ((unsigned int)(~0)) 17 --- 319 unchanged lines hidden (view full) --- 337 * segments, f2fs manages two counting structures separately. 338 */ 339 if (use_section && sbi->segs_per_sec > 1) 340 return get_sec_entry(sbi, segno)->valid_blocks; 341 else 342 return get_seg_entry(sbi, segno)->valid_blocks; 343} 344 | 7 */ 8#include <linux/blkdev.h> 9#include <linux/backing-dev.h> 10 11/* constant macro */ 12#define NULL_SEGNO ((unsigned int)(~0)) 13#define NULL_SECNO ((unsigned int)(~0)) 14 --- 319 unchanged lines hidden (view full) --- 334 * segments, f2fs manages two counting structures separately. 335 */ 336 if (use_section && sbi->segs_per_sec > 1) 337 return get_sec_entry(sbi, segno)->valid_blocks; 338 else 339 return get_seg_entry(sbi, segno)->valid_blocks; 340} 341 |
342static inline unsigned int get_ckpt_valid_blocks(struct f2fs_sb_info *sbi, 343 unsigned int segno) 344{ 345 return get_seg_entry(sbi, segno)->ckpt_valid_blocks; 346} 347 |
|
345static inline void seg_info_from_raw_sit(struct seg_entry *se, 346 struct f2fs_sit_entry *rs) 347{ 348 se->valid_blocks = GET_SIT_VBLOCKS(rs); 349 se->ckpt_valid_blocks = GET_SIT_VBLOCKS(rs); 350 memcpy(se->cur_valid_map, rs->valid_map, SIT_VBLOCK_MAP_SIZE); 351 memcpy(se->ckpt_valid_map, rs->valid_map, SIT_VBLOCK_MAP_SIZE); 352#ifdef CONFIG_F2FS_CHECK_FS --- 221 unchanged lines hidden (view full) --- 574 if (free_sections(sbi) + freed == reserved_sections(sbi) + needed && 575 has_curseg_enough_space(sbi)) 576 return false; 577 return (free_sections(sbi) + freed) <= 578 (node_secs + 2 * dent_secs + imeta_secs + 579 reserved_sections(sbi) + needed); 580} 581 | 348static inline void seg_info_from_raw_sit(struct seg_entry *se, 349 struct f2fs_sit_entry *rs) 350{ 351 se->valid_blocks = GET_SIT_VBLOCKS(rs); 352 se->ckpt_valid_blocks = GET_SIT_VBLOCKS(rs); 353 memcpy(se->cur_valid_map, rs->valid_map, SIT_VBLOCK_MAP_SIZE); 354 memcpy(se->ckpt_valid_map, rs->valid_map, SIT_VBLOCK_MAP_SIZE); 355#ifdef CONFIG_F2FS_CHECK_FS --- 221 unchanged lines hidden (view full) --- 577 if (free_sections(sbi) + freed == reserved_sections(sbi) + needed && 578 has_curseg_enough_space(sbi)) 579 return false; 580 return (free_sections(sbi) + freed) <= 581 (node_secs + 2 * dent_secs + imeta_secs + 582 reserved_sections(sbi) + needed); 583} 584 |
585static inline int f2fs_is_checkpoint_ready(struct f2fs_sb_info *sbi) 586{ 587 if (likely(!is_sbi_flag_set(sbi, SBI_CP_DISABLED))) 588 return 0; 589 if (likely(!has_not_enough_free_secs(sbi, 0, 0))) 590 return 0; 591 return -ENOSPC; 592} 593 |
|
582static inline bool excess_prefree_segs(struct f2fs_sb_info *sbi) 583{ 584 return prefree_segments(sbi) > SM_I(sbi)->rec_prefree_segments; 585} 586 587static inline int utilization(struct f2fs_sb_info *sbi) 588{ 589 return div_u64((u64)valid_user_blocks(sbi) * 100, --- 272 unchanged lines hidden --- | 594static inline bool excess_prefree_segs(struct f2fs_sb_info *sbi) 595{ 596 return prefree_segments(sbi) > SM_I(sbi)->rec_prefree_segments; 597} 598 599static inline int utilization(struct f2fs_sb_info *sbi) 600{ 601 return div_u64((u64)valid_user_blocks(sbi) * 100, --- 272 unchanged lines hidden --- |