diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2012-04-26 04:56:36 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2012-04-26 04:56:36 -0400 |
commit | 519c6040ce04474bc893774f866fd8d907b20429 (patch) | |
tree | 0e114d545be1bc2c432f6256edfc28206a835d1e /fs | |
parent | 05ba1f0823004e947748523782e9c2f07f3bff0d (diff) |
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: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/file.c | 7 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e3fee88831d4..bbfd571b37e1 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -2185,6 +2185,9 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset, | |||
2185 | }; | 2185 | }; |
2186 | int err; | 2186 | int err; |
2187 | 2187 | ||
2188 | if (fc->no_fallocate) | ||
2189 | return -EOPNOTSUPP; | ||
2190 | |||
2188 | req = fuse_get_req(fc); | 2191 | req = fuse_get_req(fc); |
2189 | if (IS_ERR(req)) | 2192 | if (IS_ERR(req)) |
2190 | return PTR_ERR(req); | 2193 | return PTR_ERR(req); |
@@ -2196,6 +2199,10 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset, | |||
2196 | req->in.args[0].value = &inarg; | 2199 | req->in.args[0].value = &inarg; |
2197 | fuse_request_send(fc, req); | 2200 | fuse_request_send(fc, req); |
2198 | err = req->out.h.error; | 2201 | err = req->out.h.error; |
2202 | if (err == -ENOSYS) { | ||
2203 | fc->no_fallocate = 1; | ||
2204 | err = -EOPNOTSUPP; | ||
2205 | } | ||
2199 | fuse_put_request(fc, req); | 2206 | fuse_put_request(fc, req); |
2200 | 2207 | ||
2201 | return err; | 2208 | return err; |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 572cefc78012..f38fb795f03c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -478,6 +478,9 @@ struct fuse_conn { | |||
478 | /** Are BSD file locking primitives not implemented by fs? */ | 478 | /** Are BSD file locking primitives not implemented by fs? */ |
479 | unsigned no_flock:1; | 479 | unsigned no_flock:1; |
480 | 480 | ||
481 | /** Is fallocate not implemented by fs? */ | ||
482 | unsigned no_fallocate:1; | ||
483 | |||
481 | /** The number of requests waiting for completion */ | 484 | /** The number of requests waiting for completion */ |
482 | atomic_t num_waiting; | 485 | atomic_t num_waiting; |
483 | 486 | ||