Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+10
+7
fs/fuse/file.c
··· 2185 2185 }; 2186 2186 int err; 2187 2187 2188 + if (fc->no_fallocate) 2189 + return -EOPNOTSUPP; 2190 + 2188 2191 req = fuse_get_req(fc); 2189 2192 if (IS_ERR(req)) 2190 2193 return PTR_ERR(req); ··· 2199 2196 req->in.args[0].value = &inarg; 2200 2197 fuse_request_send(fc, req); 2201 2198 err = req->out.h.error; 2199 + if (err == -ENOSYS) { 2200 + fc->no_fallocate = 1; 2201 + err = -EOPNOTSUPP; 2202 + } 2202 2203 fuse_put_request(fc, req); 2203 2204 2204 2205 return err;
+3
fs/fuse/fuse_i.h
··· 478 478 /** Are BSD file locking primitives not implemented by fs? */ 479 479 unsigned no_flock:1; 480 480 481 + /** Is fallocate not implemented by fs? */ 482 + unsigned no_fallocate:1; 483 + 481 484 /** The number of requests waiting for completion */ 482 485 atomic_t num_waiting; 483 486