1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * fs/hmdfs/server_writeback.h 4 * 5 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 6 */ 7 8 #ifndef SERVER_WRITEBACK_H 9 #define SERVER_WRITEBACK_H 10 11 #include "hmdfs.h" 12 13 #define HMDFS_MB_TO_PAGE_SHIFT (20 - HMDFS_PAGE_OFFSET) 14 15 struct hmdfs_server_writeback { 16 struct hmdfs_sb_info *sbi; 17 /* Enable hmdfs server dirty writeback control */ 18 bool dirty_writeback_control; 19 20 /* Current # of dirty pages from remote client in recent 1s */ 21 atomic_t dirty_nr_pages; 22 /* Current # of dirty pages to writeback */ 23 int dirty_nr_pages_to_wb; 24 /* Dirty thresh(Dirty data pages in 1s) to trigger wb */ 25 unsigned int dirty_thresh_pg; 26 /* Last reset timestamp(in jiffies) for @dirty_nr_pages */ 27 unsigned long last_reset_time; 28 29 struct workqueue_struct *dirty_writeback_wq; 30 /* Per-fs pages from client writeback work */ 31 struct work_struct dirty_sb_writeback_work; 32 }; 33 34 void hmdfs_server_check_writeback(struct hmdfs_server_writeback *hswb); 35 36 void hmdfs_destroy_server_writeback(struct hmdfs_sb_info *sbi); 37 38 int hmdfs_init_server_writeback(struct hmdfs_sb_info *sbi); 39 40 #endif 41