diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-09-02 03:19:46 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-09-11 03:20:25 -0400 |
commit | 66f3b8e2e103a0b93b945764d98e9ba46cb926dd (patch) | |
tree | 442bf5664214f0a1448e4010b09868cc58fdd3d1 /mm/page-writeback.c | |
parent | d8a8559cd7a9ccac98d5f6f13297a2ff68a43627 (diff) |
writeback: move dirty inodes from super_block to backing_dev_info
This is a first step at introducing per-bdi flusher threads. We should
have no change in behaviour, although sb_has_dirty_inodes() is now
ridiculously expensive, as there's no easy way to answer that question.
Not a huge problem, since it'll be deleted in subsequent patches.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r-- | mm/page-writeback.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 81627ebcd313..f8341b6019bf 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -320,15 +320,13 @@ static void task_dirty_limit(struct task_struct *tsk, unsigned long *pdirty) | |||
320 | /* | 320 | /* |
321 | * | 321 | * |
322 | */ | 322 | */ |
323 | static DEFINE_SPINLOCK(bdi_lock); | ||
324 | static unsigned int bdi_min_ratio; | 323 | static unsigned int bdi_min_ratio; |
325 | 324 | ||
326 | int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) | 325 | int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) |
327 | { | 326 | { |
328 | int ret = 0; | 327 | int ret = 0; |
329 | unsigned long flags; | ||
330 | 328 | ||
331 | spin_lock_irqsave(&bdi_lock, flags); | 329 | mutex_lock(&bdi_lock); |
332 | if (min_ratio > bdi->max_ratio) { | 330 | if (min_ratio > bdi->max_ratio) { |
333 | ret = -EINVAL; | 331 | ret = -EINVAL; |
334 | } else { | 332 | } else { |
@@ -340,27 +338,26 @@ int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) | |||
340 | ret = -EINVAL; | 338 | ret = -EINVAL; |
341 | } | 339 | } |
342 | } | 340 | } |
343 | spin_unlock_irqrestore(&bdi_lock, flags); | 341 | mutex_unlock(&bdi_lock); |
344 | 342 | ||
345 | return ret; | 343 | return ret; |
346 | } | 344 | } |
347 | 345 | ||
348 | int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) | 346 | int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) |
349 | { | 347 | { |
350 | unsigned long flags; | ||
351 | int ret = 0; | 348 | int ret = 0; |
352 | 349 | ||
353 | if (max_ratio > 100) | 350 | if (max_ratio > 100) |
354 | return -EINVAL; | 351 | return -EINVAL; |
355 | 352 | ||
356 | spin_lock_irqsave(&bdi_lock, flags); | 353 | mutex_lock(&bdi_lock); |
357 | if (bdi->min_ratio > max_ratio) { | 354 | if (bdi->min_ratio > max_ratio) { |
358 | ret = -EINVAL; | 355 | ret = -EINVAL; |
359 | } else { | 356 | } else { |
360 | bdi->max_ratio = max_ratio; | 357 | bdi->max_ratio = max_ratio; |
361 | bdi->max_prop_frac = (PROP_FRAC_BASE * max_ratio) / 100; | 358 | bdi->max_prop_frac = (PROP_FRAC_BASE * max_ratio) / 100; |
362 | } | 359 | } |
363 | spin_unlock_irqrestore(&bdi_lock, flags); | 360 | mutex_unlock(&bdi_lock); |
364 | 361 | ||
365 | return ret; | 362 | return ret; |
366 | } | 363 | } |