From patchwork Mon Sep 18 15:52:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Czerner X-Patchwork-Id: 9957019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B6A876039A for ; Mon, 18 Sep 2017 15:53:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A794F28CDE for ; Mon, 18 Sep 2017 15:53:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C57C28CCE; Mon, 18 Sep 2017 15:53:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26C8A28CCE for ; Mon, 18 Sep 2017 15:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755417AbdIRPxG (ORCPT ); Mon, 18 Sep 2017 11:53:06 -0400 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 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F2BD7EA81; Mon, 18 Sep 2017 15:53:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9F2BD7EA81 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lczerner@redhat.com Received: from rh_laptop.brq.redhat.com (unknown [10.43.17.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 804315D6A8; Mon, 18 Sep 2017 15:53:04 +0000 (UTC) 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> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 18 Sep 2017 15:53:05 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {