From patchwork Wed Jun 24 03:24:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 6665451 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CFAECC05AC for ; Wed, 24 Jun 2015 03:24:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A94BC205DF for ; Wed, 24 Jun 2015 03:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCD61205D8 for ; Wed, 24 Jun 2015 03:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933252AbbFXDYo (ORCPT ); Tue, 23 Jun 2015 23:24:44 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:39977 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932233AbbFXDYj (ORCPT ); Tue, 23 Jun 2015 23:24:39 -0400 Received: from pps.filterd (m0004348 [127.0.0.1]) by m0004348.ppops.net (8.14.5/8.14.5) with SMTP id t5O3Nq1x025267; Tue, 23 Jun 2015 20:24:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=IrGcGwrlwv2HNo5KjYNQwA1iiN2EnXbLOLakblXCVb8=; b=bKGfuIHzkI4Jj0hBj4kUO50tAH6KcacvBQThL9LJttojE20SlMTsmafPYvnQ3EL4CDhT qP15JgaOkSZIHqXOGct+RymU2/S6G60WquItaq1I34Q+7anOoUCeVKegw0KwHD9zyB8Z Tg0AZMYh87KI+6pJVUInQLUuLWfyujJmxBI= Received: from mail.thefacebook.com ([199.201.64.23]) by m0004348.ppops.net with ESMTP id 1v7g78gdkv-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 23 Jun 2015 20:24:15 -0700 Received: from localhost (192.168.54.13) by mail.thefacebook.com (192.168.16.20) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 23 Jun 2015 20:24:10 -0700 From: Josef Bacik To: , , , , , CC: Dave Chinner Subject: [PATCH 7/8] writeback: periodically trim the writeback list Date: Tue, 23 Jun 2015 20:24:01 -0700 Message-ID: <1435116242-27495-8-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435116242-27495-1-git-send-email-jbacik@fb.com> References: <1435116242-27495-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-06-24_01:2015-06-23, 2015-06-24, 1970-01-01 signatures=0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Josef Bacik Reviewed-by: Jan Kara Tested-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 5c005ad..a2cd363 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1060,6 +1060,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; @@ -1076,6 +1093,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();