@@ -57,6 +57,13 @@ struct fat_mount_options {
#define FAT_HASH_SIZE (1UL << FAT_HASH_BITS)
/*
+ * Supported fallocate modes
+ */
+#define FAT_FALLOC_SUPPORTED (FALLOC_FL_KEEP_SIZE | \
+ FALLOC_FL_QUERY_SUPPORT | \
+ FALLOC_FL_PREALLOC_RANGE)
+
+/*
* MS-DOS file system in-core superblock data
*/
struct msdos_sb_info {
@@ -239,12 +239,11 @@ static long fat_fallocate(struct file *file, int mode,
int err = 0;
/* No support for hole punch or other fallocate flags. */
- if (mode & ~FALLOC_FL_KEEP_SIZE)
+ if (mode & ~FAT_FALLOC_SUPPORTED)
return -EOPNOTSUPP;
- /* No support for dir */
- if (!S_ISREG(inode->i_mode))
- return -EOPNOTSUPP;
+ if (mode & FALLOC_FL_QUERY_SUPPORT)
+ return FAT_FALLOC_SUPPORTED;
inode_lock(inode);
if (mode & FALLOC_FL_KEEP_SIZE) {
Return all fallcoate modes supported by fat file system. Remove unnecessary check for regular file since it's already done in vfs_fallocate() Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Lukas Czerner <lczerner@redhat.com> --- fs/fat/fat.h | 7 +++++++ fs/fat/file.c | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-)