diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-04-16 16:22:45 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-14 15:09:21 -0400 |
commit | 2d36bfde8565b315e624302d12da5a7c9d195522 (patch) | |
tree | 5760ff58853027df0343c6bab0530025cd7a6fa1 /fs/nfs/inode.c | |
parent | fc54a0c65fc8cae6b0355512f0b619c1515e7d7f (diff) |
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.c | 20 |
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) | |||
916 | fattr->gencount = nfs_inc_attr_generation_counter(); | 916 | fattr->gencount = nfs_inc_attr_generation_counter(); |
917 | } | 917 | } |
918 | 918 | ||
919 | struct nfs_fattr *nfs_alloc_fattr(void) | ||
920 | { | ||
921 | struct nfs_fattr *fattr; | ||
922 | |||
923 | fattr = kmalloc(sizeof(*fattr), GFP_NOFS); | ||
924 | if (fattr != NULL) | ||
925 | nfs_fattr_init(fattr); | ||
926 | return fattr; | ||
927 | } | ||
928 | |||
929 | struct nfs_fh *nfs_alloc_fhandle(void) | ||
930 | { | ||
931 | struct nfs_fh *fh; | ||
932 | |||
933 | fh = kmalloc(sizeof(struct nfs_fh), GFP_NOFS); | ||
934 | if (fh != NULL) | ||
935 | fh->size = 0; | ||
936 | return fh; | ||
937 | } | ||
938 | |||
919 | /** | 939 | /** |
920 | * nfs_inode_attrs_need_update - check if the inode attributes need updating | 940 | * nfs_inode_attrs_need_update - check if the inode attributes need updating |
921 | * @inode - pointer to inode | 941 | * @inode - pointer to inode |