From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753381AbbCJTqm (ORCPT ); Tue, 10 Mar 2015 15:46:42 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:25599 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbbCJTqi (ORCPT ); Tue, 10 Mar 2015 15:46:38 -0400 From: Josef Bacik To: , , , , CC: Dave Chinner Subject: [PATCH 7/9] writeback: periodically trim the writeback list Date: Tue, 10 Mar 2015 15:45:22 -0400 Message-ID: <1426016724-23912-8-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1426016724-23912-1-git-send-email-jbacik@fb.com> References: <1426016724-23912-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.54.13] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-10_07:2015-03-10,2015-03-10,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.925924926977281 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.925924926977281 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.925924926977281 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1503100201 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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