diff options
-rw-r--r-- | fs/filesystems.c | 1 | ||||
-rw-r--r-- | fs/super.c | 26 | ||||
-rw-r--r-- | include/linux/fs.h | 4 |
3 files changed, 16 insertions, 15 deletions
diff --git a/fs/filesystems.c b/fs/filesystems.c index 0845f84f2a5f..96f24286667a 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -74,7 +74,6 @@ int register_filesystem(struct file_system_type * fs) | |||
74 | BUG_ON(strchr(fs->name, '.')); | 74 | BUG_ON(strchr(fs->name, '.')); |
75 | if (fs->next) | 75 | if (fs->next) |
76 | return -EBUSY; | 76 | return -EBUSY; |
77 | INIT_LIST_HEAD(&fs->fs_supers); | ||
78 | write_lock(&file_systems_lock); | 77 | write_lock(&file_systems_lock); |
79 | p = find_filesystem(fs->name, strlen(fs->name)); | 78 | p = find_filesystem(fs->name, strlen(fs->name)); |
80 | if (*p) | 79 | if (*p) |
diff --git a/fs/super.c b/fs/super.c index 66a12f9bfc20..bab11bad13ba 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -136,7 +136,7 @@ static struct super_block *alloc_super(struct file_system_type *type) | |||
136 | INIT_LIST_HEAD(&s->s_files); | 136 | INIT_LIST_HEAD(&s->s_files); |
137 | #endif | 137 | #endif |
138 | s->s_bdi = &default_backing_dev_info; | 138 | s->s_bdi = &default_backing_dev_info; |
139 | INIT_LIST_HEAD(&s->s_instances); | 139 | INIT_HLIST_NODE(&s->s_instances); |
140 | INIT_HLIST_BL_HEAD(&s->s_anon); | 140 | INIT_HLIST_BL_HEAD(&s->s_anon); |
141 | INIT_LIST_HEAD(&s->s_inodes); | 141 | INIT_LIST_HEAD(&s->s_inodes); |
142 | INIT_LIST_HEAD(&s->s_dentry_lru); | 142 | INIT_LIST_HEAD(&s->s_dentry_lru); |
@@ -328,7 +328,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock) | |||
328 | bool grab_super_passive(struct super_block *sb) | 328 | bool grab_super_passive(struct super_block *sb) |
329 | { | 329 | { |
330 | spin_lock(&sb_lock); | 330 | spin_lock(&sb_lock); |
331 | if (list_empty(&sb->s_instances)) { | 331 | if (hlist_unhashed(&sb->s_instances)) { |
332 | spin_unlock(&sb_lock); | 332 | spin_unlock(&sb_lock); |
333 | return false; | 333 | return false; |
334 | } | 334 | } |
@@ -400,7 +400,7 @@ void generic_shutdown_super(struct super_block *sb) | |||
400 | } | 400 | } |
401 | spin_lock(&sb_lock); | 401 | spin_lock(&sb_lock); |
402 | /* should be initialized for __put_super_and_need_restart() */ | 402 | /* should be initialized for __put_super_and_need_restart() */ |
403 | list_del_init(&sb->s_instances); | 403 | hlist_del_init(&sb->s_instances); |
404 | spin_unlock(&sb_lock); | 404 | spin_unlock(&sb_lock); |
405 | up_write(&sb->s_umount); | 405 | up_write(&sb->s_umount); |
406 | } | 406 | } |
@@ -420,13 +420,14 @@ struct super_block *sget(struct file_system_type *type, | |||
420 | void *data) | 420 | void *data) |
421 | { | 421 | { |
422 | struct super_block *s = NULL; | 422 | struct super_block *s = NULL; |
423 | struct hlist_node *node; | ||
423 | struct super_block *old; | 424 | struct super_block *old; |
424 | int err; | 425 | int err; |
425 | 426 | ||
426 | retry: | 427 | retry: |
427 | spin_lock(&sb_lock); | 428 | spin_lock(&sb_lock); |
428 | if (test) { | 429 | if (test) { |
429 | list_for_each_entry(old, &type->fs_supers, s_instances) { | 430 | hlist_for_each_entry(old, node, &type->fs_supers, s_instances) { |
430 | if (!test(old, data)) | 431 | if (!test(old, data)) |
431 | continue; | 432 | continue; |
432 | if (!grab_super(old)) | 433 | if (!grab_super(old)) |
@@ -462,7 +463,7 @@ retry: | |||
462 | s->s_type = type; | 463 | s->s_type = type; |
463 | strlcpy(s->s_id, type->name, sizeof(s->s_id)); | 464 | strlcpy(s->s_id, type->name, sizeof(s->s_id)); |
464 | list_add_tail(&s->s_list, &super_blocks); | 465 | list_add_tail(&s->s_list, &super_blocks); |
465 | list_add(&s->s_instances, &type->fs_supers); | 466 | hlist_add_head(&s->s_instances, &type->fs_supers); |
466 | spin_unlock(&sb_lock); | 467 | spin_unlock(&sb_lock); |
467 | get_filesystem(type); | 468 | get_filesystem(type); |
468 | register_shrinker(&s->s_shrink); | 469 | register_shrinker(&s->s_shrink); |
@@ -497,7 +498,7 @@ void sync_supers(void) | |||
497 | 498 | ||
498 | spin_lock(&sb_lock); | 499 | spin_lock(&sb_lock); |
499 | list_for_each_entry(sb, &super_blocks, s_list) { | 500 | list_for_each_entry(sb, &super_blocks, s_list) { |
500 | if (list_empty(&sb->s_instances)) | 501 | if (hlist_unhashed(&sb->s_instances)) |
501 | continue; | 502 | continue; |
502 | if (sb->s_op->write_super && sb->s_dirt) { | 503 | if (sb->s_op->write_super && sb->s_dirt) { |
503 | sb->s_count++; | 504 | sb->s_count++; |
@@ -533,7 +534,7 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) | |||
533 | 534 | ||
534 | spin_lock(&sb_lock); | 535 | spin_lock(&sb_lock); |
535 | list_for_each_entry(sb, &super_blocks, s_list) { | 536 | list_for_each_entry(sb, &super_blocks, s_list) { |
536 | if (list_empty(&sb->s_instances)) | 537 | if (hlist_unhashed(&sb->s_instances)) |
537 | continue; | 538 | continue; |
538 | sb->s_count++; | 539 | sb->s_count++; |
539 | spin_unlock(&sb_lock); | 540 | spin_unlock(&sb_lock); |
@@ -566,9 +567,10 @@ void iterate_supers_type(struct file_system_type *type, | |||
566 | void (*f)(struct super_block *, void *), void *arg) | 567 | void (*f)(struct super_block *, void *), void *arg) |
567 | { | 568 | { |
568 | struct super_block *sb, *p = NULL; | 569 | struct super_block *sb, *p = NULL; |
570 | struct hlist_node *node; | ||
569 | 571 | ||
570 | spin_lock(&sb_lock); | 572 | spin_lock(&sb_lock); |
571 | list_for_each_entry(sb, &type->fs_supers, s_instances) { | 573 | hlist_for_each_entry(sb, node, &type->fs_supers, s_instances) { |
572 | sb->s_count++; | 574 | sb->s_count++; |
573 | spin_unlock(&sb_lock); | 575 | spin_unlock(&sb_lock); |
574 | 576 | ||
@@ -607,7 +609,7 @@ struct super_block *get_super(struct block_device *bdev) | |||
607 | spin_lock(&sb_lock); | 609 | spin_lock(&sb_lock); |
608 | rescan: | 610 | rescan: |
609 | list_for_each_entry(sb, &super_blocks, s_list) { | 611 | list_for_each_entry(sb, &super_blocks, s_list) { |
610 | if (list_empty(&sb->s_instances)) | 612 | if (hlist_unhashed(&sb->s_instances)) |
611 | continue; | 613 | continue; |
612 | if (sb->s_bdev == bdev) { | 614 | if (sb->s_bdev == bdev) { |
613 | sb->s_count++; | 615 | sb->s_count++; |
@@ -647,7 +649,7 @@ struct super_block *get_active_super(struct block_device *bdev) | |||
647 | restart: | 649 | restart: |
648 | spin_lock(&sb_lock); | 650 | spin_lock(&sb_lock); |
649 | list_for_each_entry(sb, &super_blocks, s_list) { | 651 | list_for_each_entry(sb, &super_blocks, s_list) { |
650 | if (list_empty(&sb->s_instances)) | 652 | if (hlist_unhashed(&sb->s_instances)) |
651 | continue; | 653 | continue; |
652 | if (sb->s_bdev == bdev) { | 654 | if (sb->s_bdev == bdev) { |
653 | if (grab_super(sb)) /* drops sb_lock */ | 655 | if (grab_super(sb)) /* drops sb_lock */ |
@@ -667,7 +669,7 @@ struct super_block *user_get_super(dev_t dev) | |||
667 | spin_lock(&sb_lock); | 669 | spin_lock(&sb_lock); |
668 | rescan: | 670 | rescan: |
669 | list_for_each_entry(sb, &super_blocks, s_list) { | 671 | list_for_each_entry(sb, &super_blocks, s_list) { |
670 | if (list_empty(&sb->s_instances)) | 672 | if (hlist_unhashed(&sb->s_instances)) |
671 | continue; | 673 | continue; |
672 | if (sb->s_dev == dev) { | 674 | if (sb->s_dev == dev) { |
673 | sb->s_count++; | 675 | sb->s_count++; |
@@ -756,7 +758,7 @@ static void do_emergency_remount(struct work_struct *work) | |||
756 | 758 | ||
757 | spin_lock(&sb_lock); | 759 | spin_lock(&sb_lock); |
758 | list_for_each_entry(sb, &super_blocks, s_list) { | 760 | list_for_each_entry(sb, &super_blocks, s_list) { |
759 | if (list_empty(&sb->s_instances)) | 761 | if (hlist_unhashed(&sb->s_instances)) |
760 | continue; | 762 | continue; |
761 | sb->s_count++; | 763 | sb->s_count++; |
762 | spin_unlock(&sb_lock); | 764 | spin_unlock(&sb_lock); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index e0bc4ffb8e7f..ed17e54fd204 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1440,7 +1440,7 @@ struct super_block { | |||
1440 | struct block_device *s_bdev; | 1440 | struct block_device *s_bdev; |
1441 | struct backing_dev_info *s_bdi; | 1441 | struct backing_dev_info *s_bdi; |
1442 | struct mtd_info *s_mtd; | 1442 | struct mtd_info *s_mtd; |
1443 | struct list_head s_instances; | 1443 | struct hlist_node s_instances; |
1444 | struct quota_info s_dquot; /* Diskquota specific options */ | 1444 | struct quota_info s_dquot; /* Diskquota specific options */ |
1445 | 1445 | ||
1446 | int s_frozen; | 1446 | int s_frozen; |
@@ -1864,7 +1864,7 @@ struct file_system_type { | |||
1864 | void (*kill_sb) (struct super_block *); | 1864 | void (*kill_sb) (struct super_block *); |
1865 | struct module *owner; | 1865 | struct module *owner; |
1866 | struct file_system_type * next; | 1866 | struct file_system_type * next; |
1867 | struct list_head fs_supers; | 1867 | struct hlist_head fs_supers; |
1868 | 1868 | ||
1869 | struct lock_class_key s_lock_key; | 1869 | struct lock_class_key s_lock_key; |
1870 | struct lock_class_key s_umount_key; | 1870 | struct lock_class_key s_umount_key; |