lkml.org 
[lkml]   [2013]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/11] writeback: periodically trim the writeback list
On Wed 31-07-13 14:15:46, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Inodes are removed lazily from the bdi writeback list, so in the
> absence of sync(2) work inodes will build up on the bdi writback
> list even though they are no longer under IO. Use the periodic
> kupdate work check to remove inodes no longer under IO from the
> writeback list.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/fs-writeback.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 638f122..7c9bbf0 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -962,6 +962,23 @@ static long wb_check_background_flush(struct bdi_writeback *wb)
> return 0;
> }
>
> +/*
> + * clean out writeback list for all inodes that don't have IO in progress
> + */
> +static void wb_trim_writeback_list(struct bdi_writeback *wb)
> +{
> + struct inode *inode;
> + struct inode *tmp;
> +
> + spin_lock(&wb->list_lock);
> + list_for_each_entry_safe(inode, tmp, &wb->b_writeback, i_wb_list) {
> + if (!mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK))
> + list_del_init(&inode->i_wb_list);
> + }
Oo, and here you manipulate i_wb_list without mapping->tree_lock so that
can race with the list_empty() check in bdi_mark_inode_writeback().

Honza

> + spin_unlock(&wb->list_lock);
> +
> +}
> +
> static long wb_check_old_data_flush(struct bdi_writeback *wb)
> {
> unsigned long expired;
> @@ -978,6 +995,8 @@ static long wb_check_old_data_flush(struct bdi_writeback *wb)
> if (time_before(jiffies, expired))
> return 0;
>
> + wb_trim_writeback_list(wb);
> +
> wb->last_old_flush = jiffies;
> nr_pages = get_nr_dirty_pages();
>
> --
> 1.8.3.2
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR


\
 
 \ /
  Last update: 2013-08-01 00:21    [W:0.652 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site