From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:53318 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752572AbdIRPxJ (ORCPT ); Mon, 18 Sep 2017 11:53:09 -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 3B1ED63E0E for ; Mon, 18 Sep 2017 15:53:09 +0000 (UTC) From: Lukas Czerner To: linux-fsdevel@vger.kernel.org Cc: Lukas Czerner , cluster-devel@redhat.com Subject: [PATCH 6/7] gfs2: Implement fallocate query support mode Date: Mon, 18 Sep 2017 17:52:26 +0200 Message-Id: <1505749947-26360-7-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 gfs2 file system. Cc: cluster-devel@redhat.com Signed-off-by: Lukas Czerner --- fs/gfs2/file.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 33a0cb5..12e1de5 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -910,6 +910,14 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t return error; } +/* + * Supported fallocate modes + */ +#define GFS2_FALLOC_SUPPORTED (FALLOC_FL_KEEP_SIZE | \ + FALLOC_FL_QUERY_SUPPORT | \ + FALLOC_FL_PREALLOC_RANGE) + + static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file_inode(file); @@ -918,11 +926,18 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t le struct gfs2_holder gh; int ret; - if (mode & ~FALLOC_FL_KEEP_SIZE) + if (mode & ~GFS2_FALLOC_SUPPORTED) return -EOPNOTSUPP; + /* fallocate is needed by gfs2_grow to reserve space in the rindex */ - if (gfs2_is_jdata(ip) && inode != sdp->sd_rindex) + if (gfs2_is_jdata(ip) && inode != sdp->sd_rindex) { + if (mode & FALLOC_FL_QUERY_SUPPORT) + return 0; return -EOPNOTSUPP; + } + + if (mode & FALLOC_FL_QUERY_SUPPORT) + return GFS2_FALLOC_SUPPORTED; inode_lock(inode); -- 2.7.5