diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-10-23 05:03:02 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-25 21:26:09 -0400 |
commit | cffbc8aa334f55c9ed42d25202eb3ebf3a97c195 (patch) | |
tree | dab046695754e2cec1a7ab7a64b236e976d94360 /fs/fs-writeback.c | |
parent | be1a16a0ae29a7c90081a657b64aa51cb1a65a27 (diff) |
fs: Convert nr_inodes and nr_unused to per-cpu counters
The number of inodes allocated does not need to be tied to the
addition or removal of an inode to/from a list. If we are not tied
to a list lock, we could update the counters when inodes are
initialised or destroyed, but to do that we need to convert the
counters to be per-cpu (i.e. independent of a lock). This means that
we have the freedom to change the list/locking implementation
without needing to care about the counters.
Based on a patch originally from Eric Dumazet.
[AV: cleaned up a bit, fixed build breakage on weird configs
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 39f44f2e709a..f04d04af84f2 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -723,7 +723,7 @@ static long wb_check_old_data_flush(struct bdi_writeback *wb) | |||
723 | wb->last_old_flush = jiffies; | 723 | wb->last_old_flush = jiffies; |
724 | nr_pages = global_page_state(NR_FILE_DIRTY) + | 724 | nr_pages = global_page_state(NR_FILE_DIRTY) + |
725 | global_page_state(NR_UNSTABLE_NFS) + | 725 | global_page_state(NR_UNSTABLE_NFS) + |
726 | (inodes_stat.nr_inodes - inodes_stat.nr_unused); | 726 | get_nr_dirty_inodes(); |
727 | 727 | ||
728 | if (nr_pages) { | 728 | if (nr_pages) { |
729 | struct wb_writeback_work work = { | 729 | struct wb_writeback_work work = { |
@@ -1090,8 +1090,7 @@ void writeback_inodes_sb(struct super_block *sb) | |||
1090 | 1090 | ||
1091 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); | 1091 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); |
1092 | 1092 | ||
1093 | work.nr_pages = nr_dirty + nr_unstable + | 1093 | work.nr_pages = nr_dirty + nr_unstable + get_nr_dirty_inodes(); |
1094 | (inodes_stat.nr_inodes - inodes_stat.nr_unused); | ||
1095 | 1094 | ||
1096 | bdi_queue_work(sb->s_bdi, &work); | 1095 | bdi_queue_work(sb->s_bdi, &work); |
1097 | wait_for_completion(&done); | 1096 | wait_for_completion(&done); |