diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-08 12:15:15 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-06-11 06:58:08 -0400 |
commit | c5444198ca210498e8ac0ba121b4cd3537aa12f7 (patch) | |
tree | c423d38fe1ac7f51a48e455a19ecbe2354811fca | |
parent | b8c2f3474f1077599ec6e90c2f263f17055cc3d8 (diff) |
writeback: simplify and split bdi_start_writeback
bdi_start_writeback now never gets a superblock passed, so we can just remove
that case. And to further untangle the code and flatten the call stack
split it into two trivial helpers for it's two callers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r-- | fs/fs-writeback.c | 32 | ||||
-rw-r--r-- | include/linux/backing-dev.h | 4 | ||||
-rw-r--r-- | mm/page-writeback.c | 5 |
3 files changed, 24 insertions, 17 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 4fcca4f74940..0079bf59b583 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -200,7 +200,6 @@ static void bdi_queue_work_onstack(struct wb_writeback_args *args) | |||
200 | /** | 200 | /** |
201 | * bdi_start_writeback - start writeback | 201 | * bdi_start_writeback - start writeback |
202 | * @bdi: the backing device to write from | 202 | * @bdi: the backing device to write from |
203 | * @sb: write inodes from this super_block | ||
204 | * @nr_pages: the number of pages to write | 203 | * @nr_pages: the number of pages to write |
205 | * | 204 | * |
206 | * Description: | 205 | * Description: |
@@ -209,25 +208,34 @@ static void bdi_queue_work_onstack(struct wb_writeback_args *args) | |||
209 | * completion. Caller need not hold sb s_umount semaphore. | 208 | * completion. Caller need not hold sb s_umount semaphore. |
210 | * | 209 | * |
211 | */ | 210 | */ |
212 | void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, | 211 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages) |
213 | long nr_pages) | ||
214 | { | 212 | { |
215 | struct wb_writeback_args args = { | 213 | struct wb_writeback_args args = { |
216 | .sb = sb, | ||
217 | .sync_mode = WB_SYNC_NONE, | 214 | .sync_mode = WB_SYNC_NONE, |
218 | .nr_pages = nr_pages, | 215 | .nr_pages = nr_pages, |
219 | .range_cyclic = 1, | 216 | .range_cyclic = 1, |
220 | }; | 217 | }; |
221 | 218 | ||
222 | /* | 219 | bdi_alloc_queue_work(bdi, &args); |
223 | * We treat @nr_pages=0 as the special case to do background writeback, | 220 | } |
224 | * ie. to sync pages until the background dirty threshold is reached. | ||
225 | */ | ||
226 | if (!nr_pages) { | ||
227 | args.nr_pages = LONG_MAX; | ||
228 | args.for_background = 1; | ||
229 | } | ||
230 | 221 | ||
222 | /** | ||
223 | * bdi_start_background_writeback - start background writeback | ||
224 | * @bdi: the backing device to write from | ||
225 | * | ||
226 | * Description: | ||
227 | * This does WB_SYNC_NONE background writeback. The IO is only | ||
228 | * started when this function returns, we make no guarentees on | ||
229 | * completion. Caller need not hold sb s_umount semaphore. | ||
230 | */ | ||
231 | void bdi_start_background_writeback(struct backing_dev_info *bdi) | ||
232 | { | ||
233 | struct wb_writeback_args args = { | ||
234 | .sync_mode = WB_SYNC_NONE, | ||
235 | .nr_pages = LONG_MAX, | ||
236 | .for_background = 1, | ||
237 | .range_cyclic = 1, | ||
238 | }; | ||
231 | bdi_alloc_queue_work(bdi, &args); | 239 | bdi_alloc_queue_work(bdi, &args); |
232 | } | 240 | } |
233 | 241 | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index aee5f6ce166e..9ae2889096b6 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -105,8 +105,8 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
105 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 105 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
106 | void bdi_unregister(struct backing_dev_info *bdi); | 106 | void bdi_unregister(struct backing_dev_info *bdi); |
107 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | 107 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); |
108 | void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, | 108 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); |
109 | long nr_pages); | 109 | void bdi_start_background_writeback(struct backing_dev_info *bdi); |
110 | int bdi_writeback_task(struct bdi_writeback *wb); | 110 | int bdi_writeback_task(struct bdi_writeback *wb); |
111 | int bdi_has_dirty_io(struct backing_dev_info *bdi); | 111 | int bdi_has_dirty_io(struct backing_dev_info *bdi); |
112 | void bdi_arm_supers_timer(void); | 112 | void bdi_arm_supers_timer(void); |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index bbd396ac9546..54f28bd493d3 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -597,7 +597,7 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
597 | (!laptop_mode && ((global_page_state(NR_FILE_DIRTY) | 597 | (!laptop_mode && ((global_page_state(NR_FILE_DIRTY) |
598 | + global_page_state(NR_UNSTABLE_NFS)) | 598 | + global_page_state(NR_UNSTABLE_NFS)) |
599 | > background_thresh))) | 599 | > background_thresh))) |
600 | bdi_start_writeback(bdi, NULL, 0); | 600 | bdi_start_background_writeback(bdi); |
601 | } | 601 | } |
602 | 602 | ||
603 | void set_page_dirty_balance(struct page *page, int page_mkwrite) | 603 | void set_page_dirty_balance(struct page *page, int page_mkwrite) |
@@ -705,9 +705,8 @@ void laptop_mode_timer_fn(unsigned long data) | |||
705 | * We want to write everything out, not just down to the dirty | 705 | * We want to write everything out, not just down to the dirty |
706 | * threshold | 706 | * threshold |
707 | */ | 707 | */ |
708 | |||
709 | if (bdi_has_dirty_io(&q->backing_dev_info)) | 708 | if (bdi_has_dirty_io(&q->backing_dev_info)) |
710 | bdi_start_writeback(&q->backing_dev_info, NULL, nr_pages); | 709 | bdi_start_writeback(&q->backing_dev_info, nr_pages); |
711 | } | 710 | } |
712 | 711 | ||
713 | /* | 712 | /* |