diff mbox

[5/7] fat: Implement fallocate query support mode

Message ID 1505749947-26360-6-git-send-email-lczerner@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lukas Czerner Sept. 18, 2017, 3:52 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 051dac1..2ff49ee0 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -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 {
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 4724cc9..119915e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -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) {