mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]>
This commit is contained in:
parent
d8a8559cd7
commit
66f3b8e2e1
6 changed files with 165 additions and 84 deletions
|
|
@ -320,15 +320,13 @@ static void task_dirty_limit(struct task_struct *tsk, unsigned long *pdirty)
|
|||
/*
|
||||
*
|
||||
*/
|
||||
static DEFINE_SPINLOCK(bdi_lock);
|
||||
static unsigned int bdi_min_ratio;
|
||||
|
||||
int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&bdi_lock, flags);
|
||||
mutex_lock(&bdi_lock);
|
||||
if (min_ratio > bdi->max_ratio) {
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
|
|
@ -340,27 +338,26 @@ int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio)
|
|||
ret = -EINVAL;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&bdi_lock, flags);
|
||||
mutex_unlock(&bdi_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
if (max_ratio > 100)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&bdi_lock, flags);
|
||||
mutex_lock(&bdi_lock);
|
||||
if (bdi->min_ratio > max_ratio) {
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
bdi->max_ratio = max_ratio;
|
||||
bdi->max_prop_frac = (PROP_FRAC_BASE * max_ratio) / 100;
|
||||
}
|
||||
spin_unlock_irqrestore(&bdi_lock, flags);
|
||||
mutex_unlock(&bdi_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue