提交 519c6040 编写于 作者: M Miklos Szeredi

fuse: optimize fallocate on permanent failure

If userspace filesystem doesn't support fallocate, remember this and don't send
request next time.
Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
上级 05ba1f08
...@@ -2185,6 +2185,9 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset, ...@@ -2185,6 +2185,9 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
}; };
int err; int err;
if (fc->no_fallocate)
return -EOPNOTSUPP;
req = fuse_get_req(fc); req = fuse_get_req(fc);
if (IS_ERR(req)) if (IS_ERR(req))
return PTR_ERR(req); return PTR_ERR(req);
...@@ -2196,6 +2199,10 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset, ...@@ -2196,6 +2199,10 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
req->in.args[0].value = &inarg; req->in.args[0].value = &inarg;
fuse_request_send(fc, req); fuse_request_send(fc, req);
err = req->out.h.error; err = req->out.h.error;
if (err == -ENOSYS) {
fc->no_fallocate = 1;
err = -EOPNOTSUPP;
}
fuse_put_request(fc, req); fuse_put_request(fc, req);
return err; return err;
......
...@@ -478,6 +478,9 @@ struct fuse_conn { ...@@ -478,6 +478,9 @@ struct fuse_conn {
/** Are BSD file locking primitives not implemented by fs? */ /** Are BSD file locking primitives not implemented by fs? */
unsigned no_flock:1; unsigned no_flock:1;
/** Is fallocate not implemented by fs? */
unsigned no_fallocate:1;
/** The number of requests waiting for completion */ /** The number of requests waiting for completion */
atomic_t num_waiting; atomic_t num_waiting;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册