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>
This commit is contained in:
+4
-7
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user