From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754736AbbCPLns (ORCPT ); Mon, 16 Mar 2015 07:43:48 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38673 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754633AbbCPLnm (ORCPT ); Mon, 16 Mar 2015 07:43:42 -0400 Date: Mon, 16 Mar 2015 12:43:37 +0100 From: Jan Kara To: Josef Bacik Cc: linux-fsdevel@vger.kernel.org, david@fromorbit.com, viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, Dave Chinner Subject: Re: [PATCH 7/9] writeback: periodically trim the writeback list Message-ID: <20150316114337.GI4934@quack.suse.cz> References: <1426016724-23912-1-git-send-email-jbacik@fb.com> <1426016724-23912-8-git-send-email-jbacik@fb.com> <20150316101608.GG4934@quack.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150316101608.GG4934@quack.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 16-03-15 11:16:08, Jan Kara wrote: > On Tue 10-03-15 15:45:22, Josef Bacik wrote: > > From: Dave Chinner > > > > 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 > Looks good. You can add: > Reviewed-by: Jan Kara BTW, it would be nice to add here some numbers showing how sync was speeded up with the last two patches. The change makes a lot of sense but it would be nice as a sanity check... Honza > > --- > > fs/fs-writeback.c | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > > index 82b0f43..aa0de0f 100644 > > --- a/fs/fs-writeback.c > > +++ b/fs/fs-writeback.c > > @@ -1037,6 +1037,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); > > + } > > + spin_unlock(&wb->list_lock); > > + > > +} > > + > > static long wb_check_old_data_flush(struct bdi_writeback *wb) > > { > > unsigned long expired; > > @@ -1053,6 +1070,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.9.3 > > > -- > Jan Kara > SUSE Labs, CR -- Jan Kara SUSE Labs, CR