@@ -622,6 +622,10 @@ int ext4_defrag_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
err = ext4_defrag_move_victim(filp, &ext_info);
+ } else if (cmd == EXT4_IOC_BLOCK_RELEASE) {
+ down_write(&EXT4_I(inode)->i_data_sem);
+ ext4_discard_reservation(inode);
+ up_write(&EXT4_I(inode)->i_data_sem);
} else if (cmd == EXT4_IOC_DEFRAG) {
struct ext4_ext_defrag_data defrag;
struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
@@ -314,6 +314,7 @@ struct ext4_new_group_data {
#define EXT4_IOC_FIEMAP_INO _IOW('f', 19, struct fiemap_ino)
#define EXT4_IOC_RESERVE_BLOCK _IOW('f', 20, struct ext4_extents_info)
#define EXT4_IOC_MOVE_VICTIM _IOW('f', 21, struct ext4_extents_info)
+#define EXT4_IOC_BLOCK_RELEASE _IO('f', 22)
/*
* ioctl commands in 32 bit emulation
@@ -262,7 +262,8 @@ setversion_out:
case EXT4_IOC_FREE_BLOCKS_INFO:
case EXT4_IOC_FIEMAP_INO:
case EXT4_IOC_RESERVE_BLOCK:
- case EXT4_IOC_MOVE_VICTIM: {
+ case EXT4_IOC_MOVE_VICTIM:
+ case EXT4_IOC_BLOCK_RELEASE: {
return ext4_defrag_ioctl(inode, filp, cmd, arg);
}
case EXT4_IOC_GROUP_ADD: {