diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/hppfs | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/hppfs')
-rw-r--r-- | fs/hppfs/hppfs.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index 7b027720d820..85c098a499f3 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
@@ -139,7 +139,8 @@ static int file_removed(struct dentry *dentry, const char *file) | |||
139 | static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, | 139 | static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, |
140 | struct nameidata *nd) | 140 | struct nameidata *nd) |
141 | { | 141 | { |
142 | struct dentry *proc_dentry, *new, *parent; | 142 | struct dentry *proc_dentry, *parent; |
143 | struct qstr *name = &dentry->d_name; | ||
143 | struct inode *inode; | 144 | struct inode *inode; |
144 | int err, deleted; | 145 | int err, deleted; |
145 | 146 | ||
@@ -149,23 +150,9 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, | |||
149 | else if (deleted) | 150 | else if (deleted) |
150 | return ERR_PTR(-ENOENT); | 151 | return ERR_PTR(-ENOENT); |
151 | 152 | ||
152 | err = -ENOMEM; | ||
153 | parent = HPPFS_I(ino)->proc_dentry; | 153 | parent = HPPFS_I(ino)->proc_dentry; |
154 | mutex_lock(&parent->d_inode->i_mutex); | 154 | mutex_lock(&parent->d_inode->i_mutex); |
155 | proc_dentry = d_lookup(parent, &dentry->d_name); | 155 | proc_dentry = lookup_one_len(name->name, parent, name->len); |
156 | if (proc_dentry == NULL) { | ||
157 | proc_dentry = d_alloc(parent, &dentry->d_name); | ||
158 | if (proc_dentry == NULL) { | ||
159 | mutex_unlock(&parent->d_inode->i_mutex); | ||
160 | goto out; | ||
161 | } | ||
162 | new = (*parent->d_inode->i_op->lookup)(parent->d_inode, | ||
163 | proc_dentry, NULL); | ||
164 | if (new) { | ||
165 | dput(proc_dentry); | ||
166 | proc_dentry = new; | ||
167 | } | ||
168 | } | ||
169 | mutex_unlock(&parent->d_inode->i_mutex); | 156 | mutex_unlock(&parent->d_inode->i_mutex); |
170 | 157 | ||
171 | if (IS_ERR(proc_dentry)) | 158 | if (IS_ERR(proc_dentry)) |
@@ -174,13 +161,11 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, | |||
174 | err = -ENOMEM; | 161 | err = -ENOMEM; |
175 | inode = get_inode(ino->i_sb, proc_dentry); | 162 | inode = get_inode(ino->i_sb, proc_dentry); |
176 | if (!inode) | 163 | if (!inode) |
177 | goto out_dput; | 164 | goto out; |
178 | 165 | ||
179 | d_add(dentry, inode); | 166 | d_add(dentry, inode); |
180 | return NULL; | 167 | return NULL; |
181 | 168 | ||
182 | out_dput: | ||
183 | dput(proc_dentry); | ||
184 | out: | 169 | out: |
185 | return ERR_PTR(err); | 170 | return ERR_PTR(err); |
186 | } | 171 | } |
@@ -598,6 +583,7 @@ static const struct file_operations hppfs_dir_fops = { | |||
598 | .readdir = hppfs_readdir, | 583 | .readdir = hppfs_readdir, |
599 | .open = hppfs_dir_open, | 584 | .open = hppfs_dir_open, |
600 | .fsync = hppfs_fsync, | 585 | .fsync = hppfs_fsync, |
586 | .llseek = default_llseek, | ||
601 | }; | 587 | }; |
602 | 588 | ||
603 | static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf) | 589 | static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf) |
@@ -631,11 +617,18 @@ void hppfs_evict_inode(struct inode *ino) | |||
631 | mntput(ino->i_sb->s_fs_info); | 617 | mntput(ino->i_sb->s_fs_info); |
632 | } | 618 | } |
633 | 619 | ||
634 | static void hppfs_destroy_inode(struct inode *inode) | 620 | static void hppfs_i_callback(struct rcu_head *head) |
635 | { | 621 | { |
622 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
623 | INIT_LIST_HEAD(&inode->i_dentry); | ||
636 | kfree(HPPFS_I(inode)); | 624 | kfree(HPPFS_I(inode)); |
637 | } | 625 | } |
638 | 626 | ||
627 | static void hppfs_destroy_inode(struct inode *inode) | ||
628 | { | ||
629 | call_rcu(&inode->i_rcu, hppfs_i_callback); | ||
630 | } | ||
631 | |||
639 | static const struct super_operations hppfs_sbops = { | 632 | static const struct super_operations hppfs_sbops = { |
640 | .alloc_inode = hppfs_alloc_inode, | 633 | .alloc_inode = hppfs_alloc_inode, |
641 | .destroy_inode = hppfs_destroy_inode, | 634 | .destroy_inode = hppfs_destroy_inode, |
@@ -682,8 +675,10 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) | |||
682 | struct inode *proc_ino = dentry->d_inode; | 675 | struct inode *proc_ino = dentry->d_inode; |
683 | struct inode *inode = new_inode(sb); | 676 | struct inode *inode = new_inode(sb); |
684 | 677 | ||
685 | if (!inode) | 678 | if (!inode) { |
679 | dput(dentry); | ||
686 | return ERR_PTR(-ENOMEM); | 680 | return ERR_PTR(-ENOMEM); |
681 | } | ||
687 | 682 | ||
688 | if (S_ISDIR(dentry->d_inode->i_mode)) { | 683 | if (S_ISDIR(dentry->d_inode->i_mode)) { |
689 | inode->i_op = &hppfs_dir_iops; | 684 | inode->i_op = &hppfs_dir_iops; |
@@ -696,7 +691,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) | |||
696 | inode->i_fop = &hppfs_file_fops; | 691 | inode->i_fop = &hppfs_file_fops; |
697 | } | 692 | } |
698 | 693 | ||
699 | HPPFS_I(inode)->proc_dentry = dget(dentry); | 694 | HPPFS_I(inode)->proc_dentry = dentry; |
700 | 695 | ||
701 | inode->i_uid = proc_ino->i_uid; | 696 | inode->i_uid = proc_ino->i_uid; |
702 | inode->i_gid = proc_ino->i_gid; | 697 | inode->i_gid = proc_ino->i_gid; |
@@ -729,7 +724,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) | |||
729 | sb->s_fs_info = proc_mnt; | 724 | sb->s_fs_info = proc_mnt; |
730 | 725 | ||
731 | err = -ENOMEM; | 726 | err = -ENOMEM; |
732 | root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root); | 727 | root_inode = get_inode(sb, dget(proc_mnt->mnt_sb->s_root)); |
733 | if (!root_inode) | 728 | if (!root_inode) |
734 | goto out_mntput; | 729 | goto out_mntput; |
735 | 730 | ||
@@ -747,17 +742,17 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) | |||
747 | return(err); | 742 | return(err); |
748 | } | 743 | } |
749 | 744 | ||
750 | static int hppfs_read_super(struct file_system_type *type, | 745 | static struct dentry *hppfs_read_super(struct file_system_type *type, |
751 | int flags, const char *dev_name, | 746 | int flags, const char *dev_name, |
752 | void *data, struct vfsmount *mnt) | 747 | void *data) |
753 | { | 748 | { |
754 | return get_sb_nodev(type, flags, data, hppfs_fill_super, mnt); | 749 | return mount_nodev(type, flags, data, hppfs_fill_super); |
755 | } | 750 | } |
756 | 751 | ||
757 | static struct file_system_type hppfs_type = { | 752 | static struct file_system_type hppfs_type = { |
758 | .owner = THIS_MODULE, | 753 | .owner = THIS_MODULE, |
759 | .name = "hppfs", | 754 | .name = "hppfs", |
760 | .get_sb = hppfs_read_super, | 755 | .mount = hppfs_read_super, |
761 | .kill_sb = kill_anon_super, | 756 | .kill_sb = kill_anon_super, |
762 | .fs_flags = 0, | 757 | .fs_flags = 0, |
763 | }; | 758 | }; |