aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-02-12 22:08:01 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-20 21:29:37 -0400
commit318ceed088497d1ca839b1172518ac4cc7096b82 (patch)
tree7dfd07bfb5e8c5d5dbb0ba4ea523f334c98c66bb
parentca85c07809ca19de3391cb79ee1198f3dd91fa8d (diff)
tidy up after d_make_root() conversion
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c14
-rw-r--r--drivers/oprofile/oprofilefs.c9
-rw-r--r--drivers/usb/core/inode.c6
-rw-r--r--fs/pstore/inode.c24
-rw-r--r--fs/ramfs/inode.c20
-rw-r--r--mm/shmem.c6
6 files changed, 26 insertions, 53 deletions
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 15f24f362208..1c034b80d408 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -87,7 +87,7 @@
87static LIST_HEAD(service_processors); 87static LIST_HEAD(service_processors);
88 88
89static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode); 89static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode);
90static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root); 90static void ibmasmfs_create_files (struct super_block *sb);
91static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent); 91static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent);
92 92
93 93
@@ -114,7 +114,6 @@ static struct file_system_type ibmasmfs_type = {
114static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent) 114static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
115{ 115{
116 struct inode *root; 116 struct inode *root;
117 struct dentry *root_dentry;
118 117
119 sb->s_blocksize = PAGE_CACHE_SIZE; 118 sb->s_blocksize = PAGE_CACHE_SIZE;
120 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 119 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -129,12 +128,11 @@ static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
129 root->i_op = &simple_dir_inode_operations; 128 root->i_op = &simple_dir_inode_operations;
130 root->i_fop = ibmasmfs_dir_ops; 129 root->i_fop = ibmasmfs_dir_ops;
131 130
132 root_dentry = d_make_root(root); 131 sb->s_root = d_make_root(root);
133 if (!root_dentry) 132 if (!sb->s_root)
134 return -ENOMEM; 133 return -ENOMEM;
135 sb->s_root = root_dentry;
136 134
137 ibmasmfs_create_files(sb, root_dentry); 135 ibmasmfs_create_files(sb);
138 return 0; 136 return 0;
139} 137}
140 138
@@ -610,7 +608,7 @@ static const struct file_operations remote_settings_fops = {
610}; 608};
611 609
612 610
613static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root) 611static void ibmasmfs_create_files (struct super_block *sb)
614{ 612{
615 struct list_head *entry; 613 struct list_head *entry;
616 struct service_processor *sp; 614 struct service_processor *sp;
@@ -619,7 +617,7 @@ static void ibmasmfs_create_files (struct super_block *sb, struct dentry *root)
619 struct dentry *dir; 617 struct dentry *dir;
620 struct dentry *remote_dir; 618 struct dentry *remote_dir;
621 sp = list_entry(entry, struct service_processor, node); 619 sp = list_entry(entry, struct service_processor, node);
622 dir = ibmasmfs_create_dir(sb, root, sp->dirname); 620 dir = ibmasmfs_create_dir(sb, sb->s_root, sp->dirname);
623 if (!dir) 621 if (!dir)
624 continue; 622 continue;
625 623
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 277bb70b8d75..ee8fd037bb53 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -238,7 +238,6 @@ struct dentry *oprofilefs_mkdir(struct super_block *sb,
238static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent) 238static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
239{ 239{
240 struct inode *root_inode; 240 struct inode *root_inode;
241 struct dentry *root_dentry;
242 241
243 sb->s_blocksize = PAGE_CACHE_SIZE; 242 sb->s_blocksize = PAGE_CACHE_SIZE;
244 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 243 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -251,13 +250,11 @@ static int oprofilefs_fill_super(struct super_block *sb, void *data, int silent)
251 return -ENOMEM; 250 return -ENOMEM;
252 root_inode->i_op = &simple_dir_inode_operations; 251 root_inode->i_op = &simple_dir_inode_operations;
253 root_inode->i_fop = &simple_dir_operations; 252 root_inode->i_fop = &simple_dir_operations;
254 root_dentry = d_make_root(root_inode); 253 sb->s_root = d_make_root(root_inode);
255 if (!root_dentry) 254 if (!sb->s_root)
256 return -ENOMEM; 255 return -ENOMEM;
257 256
258 sb->s_root = root_dentry; 257 oprofile_create_files(sb, sb->s_root);
259
260 oprofile_create_files(sb, root_dentry);
261 258
262 // FIXME: verify kill_litter_super removes our dentries 259 // FIXME: verify kill_litter_super removes our dentries
263 return 0; 260 return 0;
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index bdaef8e36020..06c175aee6a3 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -454,7 +454,6 @@ static const struct super_operations usbfs_ops = {
454static int usbfs_fill_super(struct super_block *sb, void *data, int silent) 454static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
455{ 455{
456 struct inode *inode; 456 struct inode *inode;
457 struct dentry *root;
458 457
459 sb->s_blocksize = PAGE_CACHE_SIZE; 458 sb->s_blocksize = PAGE_CACHE_SIZE;
460 sb->s_blocksize_bits = PAGE_CACHE_SHIFT; 459 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
@@ -462,12 +461,11 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
462 sb->s_op = &usbfs_ops; 461 sb->s_op = &usbfs_ops;
463 sb->s_time_gran = 1; 462 sb->s_time_gran = 1;
464 inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0); 463 inode = usbfs_get_inode(sb, S_IFDIR | 0755, 0);
465 root = d_make_root(inode); 464 sb->s_root = d_make_root(inode);
466 if (!root) { 465 if (!sb->s_root) {
467 dbg("%s: could not get root dentry!",__func__); 466 dbg("%s: could not get root dentry!",__func__);
468 return -ENOMEM; 467 return -ENOMEM;
469 } 468 }
470 sb->s_root = root;
471 return 0; 469 return 0;
472} 470}
473 471
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index ec7d1fb6f35a..f37c32b94525 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -278,9 +278,7 @@ fail:
278 278
279int pstore_fill_super(struct super_block *sb, void *data, int silent) 279int pstore_fill_super(struct super_block *sb, void *data, int silent)
280{ 280{
281 struct inode *inode = NULL; 281 struct inode *inode;
282 struct dentry *root;
283 int err;
284 282
285 save_mount_options(sb, data); 283 save_mount_options(sb, data);
286 284
@@ -296,25 +294,17 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
296 parse_options(data); 294 parse_options(data);
297 295
298 inode = pstore_get_inode(sb, NULL, S_IFDIR | 0755, 0); 296 inode = pstore_get_inode(sb, NULL, S_IFDIR | 0755, 0);
299 if (!inode) { 297 if (inode) {
300 err = -ENOMEM; 298 /* override ramfs "dir" options so we catch unlink(2) */
301 goto fail; 299 inode->i_op = &pstore_dir_inode_operations;
302 }
303 /* override ramfs "dir" options so we catch unlink(2) */
304 inode->i_op = &pstore_dir_inode_operations;
305
306 root = d_make_root(inode);
307 sb->s_root = root;
308 if (!root) {
309 err = -ENOMEM;
310 goto fail;
311 } 300 }
301 sb->s_root = d_make_root(inode);
302 if (!sb->s_root)
303 return -ENOMEM;
312 304
313 pstore_get_records(0); 305 pstore_get_records(0);
314 306
315 return 0; 307 return 0;
316fail:
317 return err;
318} 308}
319 309
320static struct dentry *pstore_mount(struct file_system_type *fs_type, 310static struct dentry *pstore_mount(struct file_system_type *fs_type,
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index b6612d2ed718..a1fdabe21dec 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -209,21 +209,19 @@ static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts)
209int ramfs_fill_super(struct super_block *sb, void *data, int silent) 209int ramfs_fill_super(struct super_block *sb, void *data, int silent)
210{ 210{
211 struct ramfs_fs_info *fsi; 211 struct ramfs_fs_info *fsi;
212 struct inode *inode = NULL; 212 struct inode *inode;
213 int err; 213 int err;
214 214
215 save_mount_options(sb, data); 215 save_mount_options(sb, data);
216 216
217 fsi = kzalloc(sizeof(struct ramfs_fs_info), GFP_KERNEL); 217 fsi = kzalloc(sizeof(struct ramfs_fs_info), GFP_KERNEL);
218 sb->s_fs_info = fsi; 218 sb->s_fs_info = fsi;
219 if (!fsi) { 219 if (!fsi)
220 err = -ENOMEM; 220 return -ENOMEM;
221 goto fail;
222 }
223 221
224 err = ramfs_parse_options(data, &fsi->mount_opts); 222 err = ramfs_parse_options(data, &fsi->mount_opts);
225 if (err) 223 if (err)
226 goto fail; 224 return err;
227 225
228 sb->s_maxbytes = MAX_LFS_FILESIZE; 226 sb->s_maxbytes = MAX_LFS_FILESIZE;
229 sb->s_blocksize = PAGE_CACHE_SIZE; 227 sb->s_blocksize = PAGE_CACHE_SIZE;
@@ -234,16 +232,10 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
234 232
235 inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0); 233 inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0);
236 sb->s_root = d_make_root(inode); 234 sb->s_root = d_make_root(inode);
237 if (!sb->s_root) { 235 if (!sb->s_root)
238 err = -ENOMEM; 236 return -ENOMEM;
239 goto fail;
240 }
241 237
242 return 0; 238 return 0;
243fail:
244 kfree(fsi);
245 sb->s_fs_info = NULL;
246 return err;
247} 239}
248 240
249struct dentry *ramfs_mount(struct file_system_type *fs_type, 241struct dentry *ramfs_mount(struct file_system_type *fs_type,
diff --git a/mm/shmem.c b/mm/shmem.c
index 154243f0a27c..9bc4a2353944 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2175,7 +2175,6 @@ static void shmem_put_super(struct super_block *sb)
2175int shmem_fill_super(struct super_block *sb, void *data, int silent) 2175int shmem_fill_super(struct super_block *sb, void *data, int silent)
2176{ 2176{
2177 struct inode *inode; 2177 struct inode *inode;
2178 struct dentry *root;
2179 struct shmem_sb_info *sbinfo; 2178 struct shmem_sb_info *sbinfo;
2180 int err = -ENOMEM; 2179 int err = -ENOMEM;
2181 2180
@@ -2232,10 +2231,9 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
2232 goto failed; 2231 goto failed;
2233 inode->i_uid = sbinfo->uid; 2232 inode->i_uid = sbinfo->uid;
2234 inode->i_gid = sbinfo->gid; 2233 inode->i_gid = sbinfo->gid;
2235 root = d_make_root(inode); 2234 sb->s_root = d_make_root(inode);
2236 if (!root) 2235 if (!sb->s_root)
2237 goto failed; 2236 goto failed;
2238 sb->s_root = root;
2239 return 0; 2237 return 0;
2240 2238
2241failed: 2239failed: