@@ -1122,8 +1122,8 @@ static int ext4_update_inline_dir(handle_t *handle, struct inode *dir,
1122
1122
}
1123
1123
1124
1124
static void ext4_restore_inline_data (handle_t * handle , struct inode * inode ,
1125
- struct ext4_iloc * iloc ,
1126
- void * buf , int inline_size )
1125
+ struct ext4_iloc * iloc , void * buf ,
1126
+ int inline_size , bool has_data )
1127
1127
{
1128
1128
int ret ;
1129
1129
@@ -1135,7 +1135,8 @@ static void ext4_restore_inline_data(handle_t *handle, struct inode *inode,
1135
1135
return ;
1136
1136
}
1137
1137
ext4_write_inline_data (inode , iloc , buf , 0 , inline_size );
1138
- ext4_set_inode_state (inode , EXT4_STATE_MAY_INLINE_DATA );
1138
+ if (has_data )
1139
+ ext4_set_inode_state (inode , EXT4_STATE_MAY_INLINE_DATA );
1139
1140
}
1140
1141
1141
1142
static int ext4_finish_convert_inline_dir (handle_t * handle ,
@@ -1191,6 +1192,7 @@ static int ext4_convert_inline_data_nolock(handle_t *handle,
1191
1192
struct buffer_head * data_bh = NULL ;
1192
1193
struct ext4_map_blocks map ;
1193
1194
int inline_size ;
1195
+ bool has_data ;
1194
1196
1195
1197
inline_size = ext4_get_inline_size (inode );
1196
1198
buf = kmalloc (inline_size , GFP_NOFS );
@@ -1219,6 +1221,8 @@ static int ext4_convert_inline_data_nolock(handle_t *handle,
1219
1221
if (error )
1220
1222
goto out ;
1221
1223
1224
+ has_data = !!ext4_test_inode_state (inode , EXT4_STATE_MAY_INLINE_DATA );
1225
+
1222
1226
map .m_lblk = 0 ;
1223
1227
map .m_len = 1 ;
1224
1228
map .m_flags = 0 ;
@@ -1259,7 +1263,8 @@ static int ext4_convert_inline_data_nolock(handle_t *handle,
1259
1263
unlock_buffer (data_bh );
1260
1264
out_restore :
1261
1265
if (error )
1262
- ext4_restore_inline_data (handle , inode , iloc , buf , inline_size );
1266
+ ext4_restore_inline_data (handle , inode , iloc , buf ,
1267
+ inline_size , has_data );
1263
1268
1264
1269
out :
1265
1270
brelse (data_bh );
0 commit comments