All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.liu@linux.alibaba.com>
To: virtio-fs@redhat.com
Subject: [Virtio-fs] [PATCH 4/4] virtiofsd: use fallocate(2) instead posix_fallocate(3)
Date: Wed, 17 Apr 2019 03:08:58 +0800	[thread overview]
Message-ID: <20190416190858.16833-5-bo.liu@linux.alibaba.com> (raw)
In-Reply-To: <20190416190858.16833-1-bo.liu@linux.alibaba.com>

From: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>

This is because posix_fallocate(3) does not support FALLOC_FL_KEEP_SIZE
and FALLOC_FL_PUNCH_HOLE. Our underlying host filesystem is ext4 and
ext4 supports FALLOC_FL_KEEP_SIZE and FALLOC_FL_PUNCH_HOLE well, so
this change will be ok.

Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
---
 contrib/virtiofsd/passthrough_ll.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index 10ea8aa..ccb5312 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -1568,15 +1568,10 @@ static void lo_fallocate(fuse_req_t req, fuse_ino_t ino, int mode,
 			 off_t offset, off_t length, struct fuse_file_info *fi)
 {
 	int err;
-	(void) ino;
-
-	if (mode) {
-		fuse_reply_err(req, EOPNOTSUPP);
-		return;
-	}
 
-	err = posix_fallocate(lo_fi_fd(req, fi), offset,
-			      length);
+	err = fallocate(lo_fi_fd(req, fi), mode, offset, length);
+        if (err < 0)
+                err = errno;
 
 	fuse_reply_err(req, err);
 }
-- 
1.8.3.1


  parent reply	other threads:[~2019-04-16 19:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 19:08 [Virtio-fs] [PATCH 0/4] virtiofsd fixes Liu Bo
2019-04-16 19:08 ` [Virtio-fs] [PATCH 1/4] virtiofsd: send reply correctly on read failure Liu Bo
2019-04-17 17:26   ` Dr. David Alan Gilbert
2019-04-18 12:25     ` Dr. David Alan Gilbert
2019-04-18 18:14       ` Liu Bo
2019-04-18 19:05         ` Dr. David Alan Gilbert
2019-04-23  6:27   ` [Virtio-fs] [PATCH v2] " Eryu Guan
2019-04-30 14:58     ` Dr. David Alan Gilbert
2019-04-16 19:08 ` [Virtio-fs] [PATCH 2/4] virtiofsd: support nanosecond resolution for file timestamp Liu Bo
2019-04-17 13:31   ` Dr. David Alan Gilbert
2019-04-16 19:08 ` [Virtio-fs] [PATCH 3/4] virtiofsd: use file-backend memory region for virtiofsd's cache area Liu Bo
2019-04-17 14:51   ` Dr. David Alan Gilbert
2019-04-23 12:09     ` Stefan Hajnoczi
2019-04-23 18:49       ` Liu Bo
2019-04-25 14:33         ` Stefan Hajnoczi
2019-04-25 21:21           ` Vivek Goyal
2019-04-26  9:05             ` Stefan Hajnoczi
2019-05-01 18:59               ` Dr. David Alan Gilbert
2019-05-02 11:46                 ` Stefan Hajnoczi
2019-05-18  2:28               ` Liu Bo
2019-05-20 13:49                 ` Vivek Goyal
2019-05-20 18:33                   ` Liu Bo
2019-05-20 19:01                     ` Dr. David Alan Gilbert
2019-05-20 17:58                 ` Dr. David Alan Gilbert
2019-04-16 19:08 ` Liu Bo [this message]
2019-04-17 13:18   ` [Virtio-fs] [PATCH 4/4] virtiofsd: use fallocate(2) instead posix_fallocate(3) Dr. David Alan Gilbert
2019-04-17 13:44     ` Miklos Szeredi
2019-04-17 14:05       ` Dr. David Alan Gilbert
2019-04-17 14:25         ` Miklos Szeredi
2019-04-17 14:29           ` Dr. David Alan Gilbert
2019-04-17 19:24             ` Liu Bo

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=20190416190858.16833-5-bo.liu@linux.alibaba.com \
    --to=bo.liu@linux.alibaba.com \
    --cc=virtio-fs@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.