|
@@ -2318,10 +2318,13 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
|
|
|
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
|
|
|
unsigned short ee_len = ext4_ext_get_actual_len(ex);
|
|
|
ext4_fsblk_t pblk;
|
|
|
- int flags = EXT4_FREE_BLOCKS_FORGET;
|
|
|
+ int flags = 0;
|
|
|
|
|
|
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
|
|
|
- flags |= EXT4_FREE_BLOCKS_METADATA;
|
|
|
+ flags |= EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET;
|
|
|
+ else if (ext4_should_journal_data(inode))
|
|
|
+ flags |= EXT4_FREE_BLOCKS_FORGET;
|
|
|
+
|
|
|
/*
|
|
|
* For bigalloc file systems, we never free a partial cluster
|
|
|
* at the beginning of the extent. Instead, we make a note
|