diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-14 22:39:53 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-26 02:45:52 -0500 |
commit | 0df4d6e5bd008a94f1527aa751bbcf7160257c1d (patch) | |
tree | 9b547c38bec951f353f90efbaf65d2316eab8ce6 /fs | |
parent | 3451538a114d738a6528b1da58e19e7d8964c647 (diff) |
hugetlb_file_setup(): use d_alloc_pseudo()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 99fe7ef2f09b..7f94e0cbc69c 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -918,6 +918,16 @@ static int get_hstate_idx(int page_size_log) | |||
918 | return h - hstates; | 918 | return h - hstates; |
919 | } | 919 | } |
920 | 920 | ||
921 | static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen) | ||
922 | { | ||
923 | return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)", | ||
924 | dentry->d_name.name); | ||
925 | } | ||
926 | |||
927 | static struct dentry_operations anon_ops = { | ||
928 | .d_dname = hugetlb_dname | ||
929 | }; | ||
930 | |||
921 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, | 931 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, |
922 | size_t size, vm_flags_t acctflag, | 932 | size_t size, vm_flags_t acctflag, |
923 | struct user_struct **user, | 933 | struct user_struct **user, |
@@ -926,7 +936,7 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr, | |||
926 | struct file *file = ERR_PTR(-ENOMEM); | 936 | struct file *file = ERR_PTR(-ENOMEM); |
927 | struct inode *inode; | 937 | struct inode *inode; |
928 | struct path path; | 938 | struct path path; |
929 | struct dentry *root; | 939 | struct super_block *sb; |
930 | struct qstr quick_string; | 940 | struct qstr quick_string; |
931 | struct hstate *hstate; | 941 | struct hstate *hstate; |
932 | unsigned long num_pages; | 942 | unsigned long num_pages; |
@@ -954,17 +964,18 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr, | |||
954 | } | 964 | } |
955 | } | 965 | } |
956 | 966 | ||
957 | root = hugetlbfs_vfsmount[hstate_idx]->mnt_root; | 967 | sb = hugetlbfs_vfsmount[hstate_idx]->mnt_sb; |
958 | quick_string.name = name; | 968 | quick_string.name = name; |
959 | quick_string.len = strlen(quick_string.name); | 969 | quick_string.len = strlen(quick_string.name); |
960 | quick_string.hash = 0; | 970 | quick_string.hash = 0; |
961 | path.dentry = d_alloc(root, &quick_string); | 971 | path.dentry = d_alloc_pseudo(sb, &quick_string); |
962 | if (!path.dentry) | 972 | if (!path.dentry) |
963 | goto out_shm_unlock; | 973 | goto out_shm_unlock; |
964 | 974 | ||
975 | d_set_d_op(path.dentry, &anon_ops); | ||
965 | path.mnt = mntget(hugetlbfs_vfsmount[hstate_idx]); | 976 | path.mnt = mntget(hugetlbfs_vfsmount[hstate_idx]); |
966 | file = ERR_PTR(-ENOSPC); | 977 | file = ERR_PTR(-ENOSPC); |
967 | inode = hugetlbfs_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0); | 978 | inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0); |
968 | if (!inode) | 979 | if (!inode) |
969 | goto out_dentry; | 980 | goto out_dentry; |
970 | 981 | ||