aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-06-08 12:15:15 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-06-11 06:58:08 -0400
commitc5444198ca210498e8ac0ba121b4cd3537aa12f7 (patch)
treec423d38fe1ac7f51a48e455a19ecbe2354811fca /fs
parentb8c2f3474f1077599ec6e90c2f263f17055cc3d8 (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>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs-writeback.c32
1 files changed, 20 insertions, 12 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 */
212void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, 211void 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 */
231void 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