diff options
author | Jean-Pierre André <jpandre@users.sourceforge.net> | 2012-08-22 10:00:21 +0200 |
---|---|---|
committer | Jean-Pierre André <jpandre@users.sourceforge.net> | 2012-08-22 10:00:21 +0200 |
commit | 5c5174322bd32ffc52fb1aa65964290bace05f7d (patch) | |
tree | ff8e9a6624e63fb30de54580c520f5e32a545388 | |
parent | 77ba47465706465e8abee7472aeddf5a335e7d5d (diff) | |
download | illumos-fusefs-5c5174322bd32ffc52fb1aa65964290bace05f7d.tar.gz |
Avoided sending create() for existing files to the file system
-rw-r--r-- | kernel/fuse_vnops.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/fuse_vnops.c b/kernel/fuse_vnops.c index 34abd18..ffb2310 100644 --- a/kernel/fuse_vnops.c +++ b/kernel/fuse_vnops.c @@ -713,6 +713,15 @@ static int fuse_open(struct vnode **vpp, int flag, struct cred *cred_p, goto out; } + if ((flag & (FWRITE | FTRUNC | FAPPEND)) == (FWRITE | FTRUNC)) { + vattr_t va; + int err; + + va.va_mask = AT_SIZE; + va.va_size = 0; + err = VOP_SETATTR(vp, &va, 0, cred_p, ct); + } + /* * TBD: Check can we do any optimization here? FreeBSD Fuse invokes * vnode_create_vobject to avoid as it says needless getattr... @@ -2238,6 +2247,13 @@ fuse_create(struct vnode *dvp, char *nm, struct vattr *vap, vcexcl_t excl, return (EINVAL); } + int lku = fuse_lookup_i(dvp, nm, vpp, cred_p); + if (*vpp) + VN_RELE(*vpp); + if (!lku) { + return (0); + } + /* * We follow the approach as in FreeBSD Fuse and provide atomic * create + open. So this create method for a regular file doesn't send |