linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: Lukas Czerner <lczerner@redhat.com>, cluster-devel@redhat.com
Subject: [PATCH 6/7] gfs2: Implement fallocate query support mode
Date: Mon, 18 Sep 2017 17:52:26 +0200	[thread overview]
Message-ID: <1505749947-26360-7-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1505749947-26360-1-git-send-email-lczerner@redhat.com>

Return all fallcoate modes supported by gfs2 file system.

Cc: cluster-devel@redhat.com
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 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

  parent reply	other threads:[~2017-09-18 15:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 15:52 [PATCH 0/7][RFC] Introduce fallocate query support mode Lukas Czerner
2017-09-18 15:52 ` [PATCH 1/7] vfs: " Lukas Czerner
2017-09-18 15:52 ` [PATCH 2/7] ext4: Implement " Lukas Czerner
2017-09-18 15:52 ` [PATCH 3/7] ext4: Remove unnecessary S_ISREG checks in fallocate operations Lukas Czerner
2017-09-18 15:52 ` [PATCH 4/7] xfs: Implement fallocate query support mode Lukas Czerner
2017-09-18 17:56   ` Christoph Hellwig
2017-09-19  3:28     ` OGAWA Hirofumi
2017-09-19  8:15     ` Lukas Czerner
2017-09-19 14:13       ` Christoph Hellwig
2017-09-18 20:48   ` Darrick J. Wong
2017-09-18 21:55     ` Andreas Dilger
2017-09-19 14:55       ` Theodore Ts'o
2017-09-19 15:33         ` Lukas Czerner
2017-09-19 15:55         ` Christoph Hellwig
2017-09-19 19:17           ` Florian Weimer
2017-09-19 20:37             ` Christoph Hellwig
2017-09-19 23:17               ` Theodore Ts'o
2017-09-21 13:17                 ` pathconf syscall for linux Lukas Czerner
2017-09-21 13:49                   ` Florian Weimer
2017-09-22  8:38                     ` Lukas Czerner
2017-09-21 13:54                 ` [PATCH 4/7] xfs: Implement fallocate query support mode Florian Weimer
2017-09-22  8:40                   ` Lukas Czerner
2017-09-19  8:20     ` Lukas Czerner
2017-09-18 15:52 ` [PATCH 5/7] fat: " Lukas Czerner
2017-09-18 15:52 ` Lukas Czerner [this message]
2017-09-18 15:52 ` [PATCH 7/7] loop: Check for puch hole and zero range support specifically Lukas Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505749947-26360-7-git-send-email-lczerner@redhat.com \
    --to=lczerner@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).