Lines Matching refs:hwb

34 	struct hmdfs_writeback *hwb = container_of(
37 try_to_writeback_inodes_sb(hwb->sbi->sb, WB_REASON_FS_FREE_SPACE);
44 struct hmdfs_writeback *hwb = container_of(
47 spin_lock(&hwb->inode_list_lock);
48 while (likely(!list_empty(&hwb->inode_list_head))) {
49 info = list_first_entry(&hwb->inode_list_head,
52 spin_unlock(&hwb->inode_list_lock);
57 spin_lock(&hwb->inode_list_lock);
59 spin_unlock(&hwb->inode_list_lock);
82 struct hmdfs_writeback *hwb = sbi->h_wb;
85 spin_lock(&hwb->inode_list_lock);
88 list_add_tail(&info->wb_list, &hwb->inode_list_head);
89 queue_delayed_work(hwb->dirty_inode_writeback_wq,
90 &hwb->dirty_inode_writeback_work, 0);
92 spin_unlock(&hwb->inode_list_lock);
154 void hmdfs_calculate_dirty_thresh(struct hmdfs_writeback *hwb)
156 hwb->dirty_fs_thresh = DIV_ROUND_UP(hwb->dirty_fs_bytes, PAGE_SIZE);
157 hwb->dirty_file_thresh = DIV_ROUND_UP(hwb->dirty_file_bytes, PAGE_SIZE);
158 hwb->dirty_fs_bg_thresh =
159 DIV_ROUND_UP(hwb->dirty_fs_bg_bytes, PAGE_SIZE);
160 hwb->dirty_file_bg_thresh =
161 DIV_ROUND_UP(hwb->dirty_file_bg_bytes, PAGE_SIZE);
163 hwb->fs_bg_ratio = hmdfs_thresh_ratio(hwb->dirty_fs_bg_thresh,
164 hwb->dirty_fs_thresh);
165 hwb->file_bg_ratio = hmdfs_thresh_ratio(hwb->dirty_file_bg_thresh,
166 hwb->dirty_file_thresh);
167 hwb->fs_file_ratio = hmdfs_thresh_ratio(hwb->dirty_file_thresh,
168 hwb->dirty_fs_thresh);
173 struct hmdfs_writeback *hwb = hdtc->hwb;
175 hdtc->fs_thresh = hdtc->hwb->dirty_fs_thresh;
176 hdtc->file_thresh = hdtc->hwb->dirty_file_thresh;
177 hdtc->fs_bg_thresh = hdtc->hwb->dirty_fs_bg_thresh;
178 hdtc->file_bg_thresh = hdtc->hwb->dirty_file_bg_thresh;
180 if (!hwb->dirty_auto_threshold)
187 if (hwb->bw_fs_thresh < hdtc->fs_thresh) {
188 hdtc->fs_thresh = hwb->bw_fs_thresh;
189 hdtc->fs_bg_thresh = hmdfs_ratio_thresh(hwb->fs_bg_ratio,
192 if (hwb->bw_file_thresh < hdtc->file_thresh) {
193 hdtc->file_thresh = hwb->bw_file_thresh;
194 hdtc->file_bg_thresh = hmdfs_ratio_thresh(hwb->file_bg_ratio,
206 struct hmdfs_writeback *hwb = hdtc->hwb;
207 struct bdi_writeback *wb = hwb->wb;
208 unsigned int time_limit = hwb->writeback_timelimit;
212 if (!hwb->dirty_auto_threshold)
215 spin_lock(&hwb->write_bandwidth_lock);
216 if (bw > hwb->max_write_bandwidth)
217 hwb->max_write_bandwidth = bw;
219 if (bw < hwb->min_write_bandwidth)
220 hwb->min_write_bandwidth = bw;
221 hwb->avg_write_bandwidth = bw;
222 spin_unlock(&hwb->write_bandwidth_lock);
228 bw = max(bw, hwb->bw_thresh_lowerlimit);
230 if (thresh >= hwb->dirty_fs_thresh) {
231 hdtc->fs_thresh = hwb->dirty_fs_thresh;
232 hdtc->file_thresh = hwb->dirty_file_thresh;
233 hdtc->fs_bg_thresh = hwb->dirty_fs_bg_thresh;
234 hdtc->file_bg_thresh = hwb->dirty_file_bg_thresh;
238 hdtc->fs_bg_thresh = hmdfs_ratio_thresh(hwb->fs_bg_ratio,
240 hdtc->file_thresh = hmdfs_ratio_thresh(hwb->fs_file_ratio,
242 hdtc->file_bg_thresh = hmdfs_ratio_thresh(hwb->file_bg_ratio,
246 hwb->bw_fs_thresh = hdtc->fs_thresh;
247 hwb->bw_file_thresh = hdtc->file_thresh;
252 void hmdfs_update_ratelimit(struct hmdfs_writeback *hwb)
254 struct hmdfs_dirty_throttle_control hdtc = {.hwb = hwb};
259 hwb->ratelimit_pages = hdtc.file_bg_thresh /
261 if (hwb->ratelimit_pages < HMDFS_MIN_RATELIMIT_PAGES)
262 hwb->ratelimit_pages = HMDFS_MIN_RATELIMIT_PAGES;
309 struct hmdfs_writeback *hwb = sbi->h_wb;
311 struct hmdfs_dirty_throttle_control hdtc = {.hwb = hwb};
317 if (hwb->dirty_writeback_interval != 0)
319 sb, hwb->dirty_writeback_interval * 10);
376 if (hwb->dirty_auto_threshold &&
397 if (dirty_exceeded && !hwb->dirty_exceeded)
398 hwb->dirty_exceeded = true;
413 if (!dirty_exceeded && hwb->dirty_exceeded)
414 hwb->dirty_exceeded = false;
427 struct hmdfs_writeback *hwb = sbi->h_wb;
431 if (!hwb->dirty_writeback_control)
435 if (hwb->dirty_writeback_interval != 0)
438 hwb->dirty_writeback_interval * 10);
441 if (hwb->dirty_exceeded)
452 bdp_ratelimits = this_cpu_ptr(hwb->bdp_ratelimits);
454 trace_hmdfs_balance_dirty_pages_ratelimited(sbi, hwb, *bdp_ratelimits);
458 } else if (unlikely(*bdp_ratelimits >= hwb->ratelimit_pages)) {
484 struct hmdfs_writeback *hwb;
488 hwb = kzalloc(sizeof(struct hmdfs_writeback), GFP_KERNEL);
489 if (!hwb)
492 hwb->sbi = sbi;
493 hwb->wb = &sbi->sb->s_bdi->wb;
494 hwb->dirty_writeback_control = true;
495 hwb->dirty_writeback_interval = HM_DEFAULT_WRITEBACK_INTERVAL;
496 hwb->dirty_file_bg_bytes = HMDFS_FILE_BG_WB_BYTES;
497 hwb->dirty_fs_bg_bytes = HMDFS_FS_BG_WB_BYTES;
498 hwb->dirty_file_bytes = HMDFS_FILE_WB_BYTES;
499 hwb->dirty_fs_bytes = HMDFS_FS_WB_BYTES;
500 hmdfs_calculate_dirty_thresh(hwb);
501 hwb->bw_file_thresh = hwb->dirty_file_thresh;
502 hwb->bw_fs_thresh = hwb->dirty_fs_thresh;
503 spin_lock_init(&hwb->inode_list_lock);
504 INIT_LIST_HEAD(&hwb->inode_list_head);
505 hwb->dirty_exceeded = false;
506 hwb->ratelimit_pages = HMDFS_DEF_RATELIMIT_PAGES;
507 hwb->dirty_auto_threshold = true;
508 hwb->writeback_timelimit = HMDFS_DEF_WB_TIMELIMIT;
509 hwb->bw_thresh_lowerlimit = HMDFS_BW_THRESH_DEF_LIMIT;
510 spin_lock_init(&hwb->write_bandwidth_lock);
511 hwb->avg_write_bandwidth = 0;
512 hwb->max_write_bandwidth = 0;
513 hwb->min_write_bandwidth = ULONG_MAX;
514 hwb->bdp_ratelimits = alloc_percpu(int);
515 if (!hwb->bdp_ratelimits)
519 hwb->dirty_inode_writeback_wq = create_singlethread_workqueue(name);
520 if (!hwb->dirty_inode_writeback_wq) {
525 hwb->dirty_sb_writeback_wq = create_singlethread_workqueue(name);
526 if (!hwb->dirty_sb_writeback_wq) {
530 INIT_DELAYED_WORK(&hwb->dirty_sb_writeback_work,
532 INIT_DELAYED_WORK(&hwb->dirty_inode_writeback_work,
534 sbi->h_wb = hwb;
537 destroy_workqueue(hwb->dirty_inode_writeback_wq);
539 free_percpu(hwb->bdp_ratelimits);
541 kfree(hwb);