summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4file.c
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2014-11-25 13:18:16 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-11-25 16:38:32 -0500
commit624bd5b7b683c978c6d5f4e9f6142cfb3470983d (patch)
treedcbe9728ea9a6ef12b57c63aec6b34b872a42542 /fs/nfs/nfs4file.c
parentf4ac1674f5da420ef17896f0f222c5215ebcde80 (diff)
downloadop-kernel-dev-624bd5b7b683c978c6d5f4e9f6142cfb3470983d.zip
op-kernel-dev-624bd5b7b683c978c6d5f4e9f6142cfb3470983d.tar.gz
nfs: Add DEALLOCATE support
This patch adds support for using the NFS v4.2 operation DEALLOCATE to punch holes in a file. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4file.c')
-rw-r--r--fs/nfs/nfs4file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index f78e9fd..8b46389 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -145,7 +145,7 @@ static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t
if (!S_ISREG(inode->i_mode))
return -EOPNOTSUPP;
- if (mode != 0)
+ if ((mode != 0) && (mode != (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)))
return -EOPNOTSUPP;
ret = inode_newsize_ok(inode, offset + len);
@@ -153,7 +153,10 @@ static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t
return ret;
mutex_lock(&inode->i_mutex);
- ret = nfs42_proc_allocate(filep, offset, len);
+ if (mode & FALLOC_FL_PUNCH_HOLE)
+ ret = nfs42_proc_deallocate(filep, offset, len);
+ else
+ ret = nfs42_proc_allocate(filep, offset, len);
mutex_unlock(&inode->i_mutex);
nfs_zap_caches(inode);
OpenPOWER on IntegriCloud