mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-26 19:51:32 +00:00
mkfs.f2fs: update allocation policy for ro feature
Update allocation policy for ro feature: - hot_data: allocating blocks by LBA ascending order - hot_node: allocating blocks by LBA descending order Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
3a80a7e962
commit
0bed51f3ad
@ -2817,6 +2817,14 @@ static void move_one_curseg_info(struct f2fs_sb_info *sbi, u64 from, int left,
|
||||
if ((get_sb(feature) & cpu_to_le32(F2FS_FEATURE_RO))) {
|
||||
if (i != CURSEG_HOT_DATA && i != CURSEG_HOT_NODE)
|
||||
return;
|
||||
|
||||
if (i == CURSEG_HOT_DATA) {
|
||||
left = 0;
|
||||
from = SM_I(sbi)->main_blkaddr;
|
||||
} else {
|
||||
left = 1;
|
||||
from = __end_block_addr(sbi);
|
||||
}
|
||||
goto bypass_ssa;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ int reserve_new_block(struct f2fs_sb_info *sbi, block_t *to,
|
||||
u64 blkaddr, offset;
|
||||
u64 old_blkaddr = *to;
|
||||
bool is_node = IS_NODESEG(type);
|
||||
int left = 0;
|
||||
|
||||
if (old_blkaddr == NULL_ADDR) {
|
||||
if (c.func == FSCK) {
|
||||
@ -56,7 +57,19 @@ int reserve_new_block(struct f2fs_sb_info *sbi, block_t *to,
|
||||
|
||||
blkaddr = SM_I(sbi)->main_blkaddr;
|
||||
|
||||
if (find_next_free_block(sbi, &blkaddr, 0, type, false)) {
|
||||
if (sbi->raw_super->feature & cpu_to_le32(F2FS_FEATURE_RO)) {
|
||||
if (IS_NODESEG(type)) {
|
||||
type = CURSEG_HOT_NODE;
|
||||
blkaddr = __end_block_addr(sbi);
|
||||
left = 1;
|
||||
} else if (IS_DATASEG(type)) {
|
||||
type = CURSEG_HOT_DATA;
|
||||
blkaddr = SM_I(sbi)->main_blkaddr;
|
||||
left = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (find_next_free_block(sbi, &blkaddr, left, type, false)) {
|
||||
ERR_MSG("Can't find free block");
|
||||
ASSERT(0);
|
||||
}
|
||||
|
@ -546,10 +546,10 @@ static int f2fs_prepare_super_block(void)
|
||||
}
|
||||
|
||||
if (c.feature & cpu_to_le32(F2FS_FEATURE_RO)) {
|
||||
c.cur_seg[CURSEG_HOT_NODE] = 0;
|
||||
c.cur_seg[CURSEG_HOT_NODE] = last_section(last_zone(total_zones));
|
||||
c.cur_seg[CURSEG_WARM_NODE] = 0;
|
||||
c.cur_seg[CURSEG_COLD_NODE] = 0;
|
||||
c.cur_seg[CURSEG_HOT_DATA] = 1;
|
||||
c.cur_seg[CURSEG_HOT_DATA] = 0;
|
||||
c.cur_seg[CURSEG_COLD_DATA] = 0;
|
||||
c.cur_seg[CURSEG_WARM_DATA] = 0;
|
||||
} else if (c.heap) {
|
||||
|
Loading…
Reference in New Issue
Block a user