@@ -114,6 +114,17 @@ int ext4_defrag_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
block = ext4_bmap(mapping, block);
return put_user(block, p);
+ } else if (cmd == EXT4_IOC_GROUP_INFO) {
+ struct ext4_group_data_info grp_data;
+
+ grp_data.s_blocks_per_group =
+ EXT4_BLOCKS_PER_GROUP(inode->i_sb);
+ grp_data.s_inodes_per_group =
+ EXT4_INODES_PER_GROUP(inode->i_sb);
+
+ if (copy_to_user((struct ext4_group_data_info __user *)arg,
+ &grp_data, sizeof(grp_data)))
+ return -EFAULT;
} else if (cmd == EXT4_IOC_DEFRAG) {
struct ext4_ext_defrag_data defrag;
struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
@@ -304,6 +304,7 @@ struct ext4_new_group_data {
/* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */
#define EXT4_IOC_DEFRAG _IOW('f', 15, struct ext4_ext_defrag_data)
#define EXT4_IOC_FIBMAP _IOW('f', 16, ext4_fsblk_t)
+#define EXT4_IOC_GROUP_INFO _IOW('f', 17, struct ext4_group_data_info)
/*
* ioctl commands in 32 bit emulation
@@ -327,6 +328,11 @@ struct ext4_ext_defrag_data {
ext4_fsblk_t goal; /* block offset for allocation */
};
+struct ext4_group_data_info {
+ int s_blocks_per_group; /* blocks per group */
+ int s_inodes_per_group; /* inodes per group */
+};
+
#define EXT4_TRANS_META_BLOCKS 4 /* bitmap + group desc + sb + inode */
/*
@@ -257,7 +257,8 @@ setversion_out:
return err;
}
case EXT4_IOC_FIBMAP:
- case EXT4_IOC_DEFRAG: {
+ case EXT4_IOC_DEFRAG:
+ case EXT4_IOC_GROUP_INFO: {
return ext4_defrag_ioctl(inode, filp, cmd, arg);
}
case EXT4_IOC_GROUP_ADD: {