diff options
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 91013ff7dd5..e0fb2e78959 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -679,55 +679,6 @@ void sync_inodes_sb(struct super_block *sb, int wait) | |||
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | /** | 681 | /** |
| 682 | * sync_inodes - writes all inodes to disk | ||
| 683 | * @wait: wait for completion | ||
| 684 | * | ||
| 685 | * sync_inodes() goes through each super block's dirty inode list, writes the | ||
| 686 | * inodes out, waits on the writeout and puts the inodes back on the normal | ||
| 687 | * list. | ||
| 688 | * | ||
| 689 | * This is for sys_sync(). fsync_dev() uses the same algorithm. The subtle | ||
| 690 | * part of the sync functions is that the blockdev "superblock" is processed | ||
| 691 | * last. This is because the write_inode() function of a typical fs will | ||
| 692 | * perform no I/O, but will mark buffers in the blockdev mapping as dirty. | ||
| 693 | * What we want to do is to perform all that dirtying first, and then write | ||
| 694 | * back all those inode blocks via the blockdev mapping in one sweep. So the | ||
| 695 | * additional (somewhat redundant) sync_blockdev() calls here are to make | ||
| 696 | * sure that really happens. Because if we call sync_inodes_sb(wait=1) with | ||
| 697 | * outstanding dirty inodes, the writeback goes block-at-a-time within the | ||
| 698 | * filesystem's write_inode(). This is extremely slow. | ||
| 699 | */ | ||
| 700 | static void __sync_inodes(int wait) | ||
| 701 | { | ||
| 702 | struct super_block *sb; | ||
| 703 | |||
| 704 | spin_lock(&sb_lock); | ||
| 705 | restart: | ||
| 706 | list_for_each_entry(sb, &super_blocks, s_list) { | ||
| 707 | sb->s_count++; | ||
| 708 | spin_unlock(&sb_lock); | ||
| 709 | down_read(&sb->s_umount); | ||
| 710 | if (sb->s_root) { | ||
| 711 | sync_inodes_sb(sb, wait); | ||
| 712 | sync_blockdev(sb->s_bdev); | ||
| 713 | } | ||
| 714 | up_read(&sb->s_umount); | ||
| 715 | spin_lock(&sb_lock); | ||
| 716 | if (__put_super_and_need_restart(sb)) | ||
| 717 | goto restart; | ||
| 718 | } | ||
| 719 | spin_unlock(&sb_lock); | ||
| 720 | } | ||
| 721 | |||
| 722 | void sync_inodes(int wait) | ||
| 723 | { | ||
| 724 | __sync_inodes(0); | ||
| 725 | |||
| 726 | if (wait) | ||
| 727 | __sync_inodes(1); | ||
| 728 | } | ||
| 729 | |||
| 730 | /** | ||
| 731 | * write_inode_now - write an inode to disk | 682 | * write_inode_now - write an inode to disk |
| 732 | * @inode: inode to write to disk | 683 | * @inode: inode to write to disk |
| 733 | * @sync: whether the write should be synchronous or not | 684 | * @sync: whether the write should be synchronous or not |
