mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
fs/ntfs3: Add ioctl operation for directories (FITRIM)
While ntfs3 supports discards, FITRIM ioctl() command has defined only for regular files. This may confuse users trying to invoke `fstrim` utility with the directory argument (for example, call `fstrim <mountpoint>` which is the common practice). In this case, ioctl() returns -ENOTTY without any error messages in kernel ring buffer, this may be easily interpreted as no support for discards in ntfs3 driver. Currently only FITRIM command implemented in ntfs_ioctl() and passed inode used only for dereferencing NTFS superblock, so no need for separate ioctl() handler for directories, just add existing ntfs_ioctl() handler to ntfs_dir_operations. Signed-off-by: Nekun <nekokun@firemail.cc> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
731ab1f982
commit
1f5fa4b3b8
@ -611,5 +611,9 @@ const struct file_operations ntfs_dir_operations = {
|
||||
.iterate_shared = ntfs_readdir,
|
||||
.fsync = generic_file_fsync,
|
||||
.open = ntfs_file_open,
|
||||
.unlocked_ioctl = ntfs_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = ntfs_compat_ioctl,
|
||||
#endif
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -48,7 +48,7 @@ static int ntfs_ioctl_fitrim(struct ntfs_sb_info *sbi, unsigned long arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg)
|
||||
long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct ntfs_sb_info *sbi = inode->i_sb->s_fs_info;
|
||||
@ -61,7 +61,7 @@ static long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg)
|
||||
long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg)
|
||||
|
||||
{
|
||||
return ntfs_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
|
||||
|
@ -502,6 +502,8 @@ int ntfs3_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int ntfs_file_open(struct inode *inode, struct file *file);
|
||||
int ntfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
__u64 start, __u64 len);
|
||||
long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg);
|
||||
long ntfs_compat_ioctl(struct file *filp, u32 cmd, unsigned long arg);
|
||||
extern const struct inode_operations ntfs_special_inode_operations;
|
||||
extern const struct inode_operations ntfs_file_inode_operations;
|
||||
extern const struct file_operations ntfs_file_operations;
|
||||
|
Loading…
Reference in New Issue
Block a user