From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:51974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754499AbdIRPxF (ORCPT ); Mon, 18 Sep 2017 11:53:05 -0400 From: Lukas Czerner To: linux-fsdevel@vger.kernel.org Cc: Lukas Czerner , OGAWA Hirofumi Subject: [PATCH 5/7] fat: Implement fallocate query support mode Date: Mon, 18 Sep 2017 17:52:25 +0200 Message-Id: <1505749947-26360-6-git-send-email-lczerner@redhat.com> In-Reply-To: <1505749947-26360-1-git-send-email-lczerner@redhat.com> References: <1505749947-26360-1-git-send-email-lczerner@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 Signed-off-by: Lukas Czerner --- fs/fat/fat.h | 7 +++++++ fs/fat/file.c | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) 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) { -- 2.7.5