diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-12-12 22:53:00 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:52:39 -0500 |
commit | a5166169f9b920cae3c503910cb66a3ac5dd846d (patch) | |
tree | ba62f9f2227c4eff9ad6d473f674f72443fba0fb /fs/super.c | |
parent | 5352d3b65ae6f38e71e16f704414c1db4b4f7228 (diff) |
vfs: convert fs_supers to hlist
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 26 |
1 files changed, 14 insertions, 12 deletions
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); |