diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-07-24 18:31:46 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:49:02 -0400 |
commit | dca332528bc69e05f67161e1ed59929633d5e63d (patch) | |
tree | 0ec5576d52bead57c73983d2412cfe71814b5f8d /fs/super.c | |
parent | 7a4dec53897ecd3367efb1e12fe8a4edc47dc0e9 (diff) |
no need for list_for_each_entry_safe()/resetting with superblock list
just delay __put_super() a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/fs/super.c b/fs/super.c index bd9eea4bb2bb..9674ab2c8718 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -363,10 +363,10 @@ EXPORT_SYMBOL(drop_super); | |||
363 | */ | 363 | */ |
364 | void sync_supers(void) | 364 | void sync_supers(void) |
365 | { | 365 | { |
366 | struct super_block *sb, *n; | 366 | struct super_block *sb, *p = NULL; |
367 | 367 | ||
368 | spin_lock(&sb_lock); | 368 | spin_lock(&sb_lock); |
369 | list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | 369 | list_for_each_entry(sb, &super_blocks, s_list) { |
370 | if (list_empty(&sb->s_instances)) | 370 | if (list_empty(&sb->s_instances)) |
371 | continue; | 371 | continue; |
372 | if (sb->s_op->write_super && sb->s_dirt) { | 372 | if (sb->s_op->write_super && sb->s_dirt) { |
@@ -379,11 +379,13 @@ void sync_supers(void) | |||
379 | up_read(&sb->s_umount); | 379 | up_read(&sb->s_umount); |
380 | 380 | ||
381 | spin_lock(&sb_lock); | 381 | spin_lock(&sb_lock); |
382 | /* lock was dropped, must reset next */ | 382 | if (p) |
383 | list_safe_reset_next(sb, n, s_list); | 383 | __put_super(p); |
384 | __put_super(sb); | 384 | p = sb; |
385 | } | 385 | } |
386 | } | 386 | } |
387 | if (p) | ||
388 | __put_super(p); | ||
387 | spin_unlock(&sb_lock); | 389 | spin_unlock(&sb_lock); |
388 | } | 390 | } |
389 | 391 | ||
@@ -397,10 +399,10 @@ void sync_supers(void) | |||
397 | */ | 399 | */ |
398 | void iterate_supers(void (*f)(struct super_block *, void *), void *arg) | 400 | void iterate_supers(void (*f)(struct super_block *, void *), void *arg) |
399 | { | 401 | { |
400 | struct super_block *sb, *n; | 402 | struct super_block *sb, *p = NULL; |
401 | 403 | ||
402 | spin_lock(&sb_lock); | 404 | spin_lock(&sb_lock); |
403 | list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | 405 | list_for_each_entry(sb, &super_blocks, s_list) { |
404 | if (list_empty(&sb->s_instances)) | 406 | if (list_empty(&sb->s_instances)) |
405 | continue; | 407 | continue; |
406 | sb->s_count++; | 408 | sb->s_count++; |
@@ -412,10 +414,12 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) | |||
412 | up_read(&sb->s_umount); | 414 | up_read(&sb->s_umount); |
413 | 415 | ||
414 | spin_lock(&sb_lock); | 416 | spin_lock(&sb_lock); |
415 | /* lock was dropped, must reset next */ | 417 | if (p) |
416 | list_safe_reset_next(sb, n, s_list); | 418 | __put_super(p); |
417 | __put_super(sb); | 419 | p = sb; |
418 | } | 420 | } |
421 | if (p) | ||
422 | __put_super(p); | ||
419 | spin_unlock(&sb_lock); | 423 | spin_unlock(&sb_lock); |
420 | } | 424 | } |
421 | 425 | ||
@@ -577,10 +581,10 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
577 | 581 | ||
578 | static void do_emergency_remount(struct work_struct *work) | 582 | static void do_emergency_remount(struct work_struct *work) |
579 | { | 583 | { |
580 | struct super_block *sb, *n; | 584 | struct super_block *sb, *p = NULL; |
581 | 585 | ||
582 | spin_lock(&sb_lock); | 586 | spin_lock(&sb_lock); |
583 | list_for_each_entry_safe(sb, n, &super_blocks, s_list) { | 587 | list_for_each_entry(sb, &super_blocks, s_list) { |
584 | if (list_empty(&sb->s_instances)) | 588 | if (list_empty(&sb->s_instances)) |
585 | continue; | 589 | continue; |
586 | sb->s_count++; | 590 | sb->s_count++; |
@@ -594,10 +598,12 @@ static void do_emergency_remount(struct work_struct *work) | |||
594 | } | 598 | } |
595 | up_write(&sb->s_umount); | 599 | up_write(&sb->s_umount); |
596 | spin_lock(&sb_lock); | 600 | spin_lock(&sb_lock); |
597 | /* lock was dropped, must reset next */ | 601 | if (p) |
598 | list_safe_reset_next(sb, n, s_list); | 602 | __put_super(p); |
599 | __put_super(sb); | 603 | p = sb; |
600 | } | 604 | } |
605 | if (p) | ||
606 | __put_super(p); | ||
601 | spin_unlock(&sb_lock); | 607 | spin_unlock(&sb_lock); |
602 | kfree(work); | 608 | kfree(work); |
603 | printk("Emergency Remount complete\n"); | 609 | printk("Emergency Remount complete\n"); |