mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 14:31:46 +00:00
writeback: implement WB_has_dirty_io wb_state flag
Currently, wb_has_dirty_io() determines whether a wb (bdi_writeback) has any dirty inode by testing all three IO lists on each invocation without actively keeping track. For cgroup writeback support, a single bdi will host multiple wb's each of which will host dirty inodes separately and we'll need to make bdi_has_dirty_io(), which currently only represents the root wb, aggregate has_dirty_io from all member wb's, which requires tracking transitions in has_dirty_io state on each wb. This patch introduces inode_wb_list_{move|del}_locked() to consolidate IO list operations leaving queue_io() the only other function which directly manipulates IO lists (via move_expired_inodes()). All three functions are updated to call wb_io_lists_[de]populated() which keep track of whether the wb has dirty inodes or not and record it using the new WB_has_dirty_io flag. inode_wb_list_moved_locked()'s return value indicates whether the wb had no dirty inodes before. mark_inode_dirty() is restructured so that the return value of inode_wb_list_move_locked() can be used for deciding whether to wake up the wb. While at it, change {bdi|wb}_has_dirty_io()'s return values to bool. These functions were returning 0 and 1 before. Also, add a comment explaining the synchronization of wb_state flags. v2: Updated to accommodate b_dirty_time. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
703c270887
commit
d6c10f1fc8
4 changed files with 91 additions and 30 deletions
|
@ -29,7 +29,7 @@ void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
|
|||
enum wb_reason reason);
|
||||
void bdi_start_background_writeback(struct backing_dev_info *bdi);
|
||||
void wb_workfn(struct work_struct *work);
|
||||
int bdi_has_dirty_io(struct backing_dev_info *bdi);
|
||||
bool bdi_has_dirty_io(struct backing_dev_info *bdi);
|
||||
void wb_wakeup_delayed(struct bdi_writeback *wb);
|
||||
|
||||
extern spinlock_t bdi_lock;
|
||||
|
@ -37,11 +37,9 @@ extern struct list_head bdi_list;
|
|||
|
||||
extern struct workqueue_struct *bdi_wq;
|
||||
|
||||
static inline int wb_has_dirty_io(struct bdi_writeback *wb)
|
||||
static inline bool wb_has_dirty_io(struct bdi_writeback *wb)
|
||||
{
|
||||
return !list_empty(&wb->b_dirty) ||
|
||||
!list_empty(&wb->b_io) ||
|
||||
!list_empty(&wb->b_more_io);
|
||||
return test_bit(WB_has_dirty_io, &wb->state);
|
||||
}
|
||||
|
||||
static inline void __add_wb_stat(struct bdi_writeback *wb,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue