diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-08 12:15:07 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-06-11 06:58:07 -0400 |
commit | b8c2f3474f1077599ec6e90c2f263f17055cc3d8 (patch) | |
tree | aedccfc59c7fd5592311534395eacf8afd1c956f /fs/fs-writeback.c | |
parent | d19de7edf59cdd586777b009e0e8fbe5412dd35f (diff) |
writeback: simplify wakeup_flusher_threads
bdi_writeback_all only has one caller, so fold it to simplify the code and
flatten the call stack.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 68ece4b18916..4fcca4f74940 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -920,42 +920,32 @@ int bdi_writeback_task(struct bdi_writeback *wb) | |||
920 | } | 920 | } |
921 | 921 | ||
922 | /* | 922 | /* |
923 | * Schedule writeback for all backing devices. This does WB_SYNC_NONE | 923 | * Start writeback of `nr_pages' pages. If `nr_pages' is zero, write back |
924 | * writeback, for integrity writeback see bdi_queue_work_onstack(). | 924 | * the whole world. |
925 | */ | 925 | */ |
926 | static void bdi_writeback_all(struct super_block *sb, long nr_pages) | 926 | void wakeup_flusher_threads(long nr_pages) |
927 | { | 927 | { |
928 | struct backing_dev_info *bdi; | ||
928 | struct wb_writeback_args args = { | 929 | struct wb_writeback_args args = { |
929 | .sb = sb, | ||
930 | .nr_pages = nr_pages, | ||
931 | .sync_mode = WB_SYNC_NONE, | 930 | .sync_mode = WB_SYNC_NONE, |
932 | }; | 931 | }; |
933 | struct backing_dev_info *bdi; | ||
934 | 932 | ||
935 | rcu_read_lock(); | 933 | if (nr_pages) { |
934 | args.nr_pages = nr_pages; | ||
935 | } else { | ||
936 | args.nr_pages = global_page_state(NR_FILE_DIRTY) + | ||
937 | global_page_state(NR_UNSTABLE_NFS); | ||
938 | } | ||
936 | 939 | ||
940 | rcu_read_lock(); | ||
937 | list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) { | 941 | list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) { |
938 | if (!bdi_has_dirty_io(bdi)) | 942 | if (!bdi_has_dirty_io(bdi)) |
939 | continue; | 943 | continue; |
940 | |||
941 | bdi_alloc_queue_work(bdi, &args); | 944 | bdi_alloc_queue_work(bdi, &args); |
942 | } | 945 | } |
943 | |||
944 | rcu_read_unlock(); | 946 | rcu_read_unlock(); |
945 | } | 947 | } |
946 | 948 | ||
947 | /* | ||
948 | * Start writeback of `nr_pages' pages. If `nr_pages' is zero, write back | ||
949 | * the whole world. | ||
950 | */ | ||
951 | void wakeup_flusher_threads(long nr_pages) | ||
952 | { | ||
953 | if (nr_pages == 0) | ||
954 | nr_pages = global_page_state(NR_FILE_DIRTY) + | ||
955 | global_page_state(NR_UNSTABLE_NFS); | ||
956 | bdi_writeback_all(NULL, nr_pages); | ||
957 | } | ||
958 | |||
959 | static noinline void block_dump___mark_inode_dirty(struct inode *inode) | 949 | static noinline void block_dump___mark_inode_dirty(struct inode *inode) |
960 | { | 950 | { |
961 | if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) { | 951 | if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) { |