Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 000009a

Browse files
justin-heanolis-bot
authored andcommitted
ext4: don't set EXTENT_STATUS_DELAYED on allocated blocks
ANBZ: #20084 commit eba8c36 upstream. Currently, we release delayed allocation reservation when removing delayed extent from extent status tree (which also happens when overwriting one extent with another one). When we allocated unwritten extent under some delayed allocated extent, we don't need the reservation anymore and hence we don't need to preserve the EXT4_MAP_DELAYED status bit. Allocating the new extent blocks will properly release the reservation. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Signed-off-by: Jia He <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Link: https://gitee.com/anolis/cloud-kernel/pulls/5130
1 parent b25db19 commit 000009a

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

fs/ext4/extents_status.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -870,13 +870,7 @@ void ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
870870

871871
BUG_ON(end < lblk);
872872

873-
if ((status & EXTENT_STATUS_DELAYED) &&
874-
(status & EXTENT_STATUS_WRITTEN)) {
875-
ext4_warning(inode->i_sb, "Inserting extent [%u/%u] as "
876-
" delayed and written which can potentially "
877-
" cause data loss.", lblk, len);
878-
WARN_ON(1);
879-
}
873+
WARN_ON_ONCE(status & EXTENT_STATUS_DELAYED);
880874

881875
newes.es_lblk = lblk;
882876
newes.es_len = len;

fs/ext4/inode.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,6 @@ static int ext4_map_create_blocks(handle_t *handle, struct inode *inode,
558558

559559
status = map->m_flags & EXT4_MAP_UNWRITTEN ?
560560
EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
561-
if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) &&
562-
!(status & EXTENT_STATUS_WRITTEN) &&
563-
ext4_es_scan_range(inode, &ext4_es_is_delayed, map->m_lblk,
564-
map->m_lblk + map->m_len - 1))
565-
status |= EXTENT_STATUS_DELAYED;
566-
567561
ext4_es_insert_extent(inode, map->m_lblk, map->m_len,
568562
map->m_pblk, status);
569563

@@ -681,11 +675,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
681675

682676
status = map->m_flags & EXT4_MAP_UNWRITTEN ?
683677
EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
684-
if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) &&
685-
!(status & EXTENT_STATUS_WRITTEN) &&
686-
ext4_es_scan_range(inode, &ext4_es_is_delayed, map->m_lblk,
687-
map->m_lblk + map->m_len - 1))
688-
status |= EXTENT_STATUS_DELAYED;
689678
ext4_es_insert_extent(inode, map->m_lblk, map->m_len,
690679
map->m_pblk, status);
691680
}

0 commit comments

Comments
 (0)