summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust2010-04-16 22:22:45 +0200
committerTrond Myklebust2010-05-14 21:09:21 +0200
commit2d36bfde8565b315e624302d12da5a7c9d195522 (patch)
tree5760ff58853027df0343c6bab0530025cd7a6fa1 /fs/nfs/inode.c
parentgss_krb5: Advertise rc4-hmac enctype support in the rpcsec_gss/krb5 upcall (diff)
downloadkernel-qcow2-linux-2d36bfde8565b315e624302d12da5a7c9d195522.tar.gz
kernel-qcow2-linux-2d36bfde8565b315e624302d12da5a7c9d195522.tar.xz
kernel-qcow2-linux-2d36bfde8565b315e624302d12da5a7c9d195522.zip
NFS: Add helper functions for allocating filehandles and fattr structs
NFS Filehandles and struct fattr are really too large to be allocated on the stack. This patch adds in a couple of helper functions to allocate them dynamically instead. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 50a56edca0b5..0f9852ab87bb 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -916,6 +916,26 @@ void nfs_fattr_init(struct nfs_fattr *fattr)
fattr->gencount = nfs_inc_attr_generation_counter();
}
+struct nfs_fattr *nfs_alloc_fattr(void)
+{
+ struct nfs_fattr *fattr;
+
+ fattr = kmalloc(sizeof(*fattr), GFP_NOFS);
+ if (fattr != NULL)
+ nfs_fattr_init(fattr);
+ return fattr;
+}
+
+struct nfs_fh *nfs_alloc_fhandle(void)
+{
+ struct nfs_fh *fh;
+
+ fh = kmalloc(sizeof(struct nfs_fh), GFP_NOFS);
+ if (fh != NULL)
+ fh->size = 0;
+ return fh;
+}
+
/**
* nfs_inode_attrs_need_update - check if the inode attributes need updating
* @inode - pointer to inode