summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/vfs.c
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@Netapp.com>2014-11-07 14:44:26 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-11-07 16:19:49 -0500
commit95d871f03cae6b49de040265cf88cbe2a16b9f05 (patch)
tree911d8bed4226e4e87e1411145c7fe0e275dea545 /fs/nfsd/vfs.c
parent72c72bdf7bf53353d2d8e055194d27f0128be92b (diff)
nfsd: Add ALLOCATE support
The ALLOCATE operation is used to preallocate space in a file. I can do this by using vfs_fallocate() to do the actual preallocation. ALLOCATE only returns a status indicator, so we don't need to write a special encode() function. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r--fs/nfsd/vfs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index d16076bd9a7a..f1999619d516 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -16,6 +16,7 @@
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/file.h> 17#include <linux/file.h>
18#include <linux/splice.h> 18#include <linux/splice.h>
19#include <linux/falloc.h>
19#include <linux/fcntl.h> 20#include <linux/fcntl.h>
20#include <linux/namei.h> 21#include <linux/namei.h>
21#include <linux/delay.h> 22#include <linux/delay.h>
@@ -533,6 +534,26 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
533} 534}
534#endif 535#endif
535 536
537__be32 nfsd4_vfs_fallocate(struct svc_rqst *rqstp, struct svc_fh *fhp,
538 struct file *file, loff_t offset, loff_t len,
539 int flags)
540{
541 __be32 err;
542 int error;
543
544 if (!S_ISREG(file_inode(file)->i_mode))
545 return nfserr_inval;
546
547 err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, NFSD_MAY_WRITE);
548 if (err)
549 return err;
550
551 error = vfs_fallocate(file, flags, offset, len);
552 if (!error)
553 error = commit_metadata(fhp);
554
555 return nfserrno(error);
556}
536#endif /* defined(CONFIG_NFSD_V4) */ 557#endif /* defined(CONFIG_NFSD_V4) */
537 558
538#ifdef CONFIG_NFSD_V3 559#ifdef CONFIG_NFSD_V3