From patchwork Tue Jan 9 06:24:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changwei Ge X-Patchwork-Id: 10150997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E89D603ED for ; Tue, 9 Jan 2018 06:28:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12DB7286EB for ; Tue, 9 Jan 2018 06:28:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0623928765; Tue, 9 Jan 2018 06:28:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9DB81286EB for ; Tue, 9 Jan 2018 06:28:25 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w096QkoG013178; Tue, 9 Jan 2018 06:28:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : date : message-id : mime-version : cc : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : content-type : content-transfer-encoding : sender; s=corp-2017-10-26; bh=Y7Ln13nxlBh1VO0mgl3DCazxzFnyxPttGN7GE+kDjhQ=; b=SRPosLWzGHq6BJi6j9SkshYiu/gjqscIxvfO9/W06uTlfz4242VZQzuOSf9j/GV34xg5 wMwl2+Yn+mFRYS+eg2yt3bZenGRBwKu+HJJpExyf54PFqcDASwOwOQOURZWsVOHro0b5 7FV8uFAaChBcD+oBhxn//v0FaETwEFfI4e7qQwIiOR4vwOMHtLsEGlfXC19lvrN192tK mSrr16J2Rgq55Hvq2hitNRrivNNGEXtEUvc+jHaqzB9t7KjKs3cFMMiK7V80xmGvX6Ks oWKiY7VLKUslZo2c7WidutuS35v99Y7lZvStVm8Td9jRRf5onuEv+p9Vs2YcjOUZozRR 2A== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2fcp8p0d7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Jan 2018 06:28:06 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w096S3lT010327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Jan 2018 06:28:04 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eYnOF-0003ey-72; Mon, 08 Jan 2018 22:28:03 -0800 Received: from aserv0021.oracle.com ([141.146.126.233]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eYnOD-0003ep-Cv for ocfs2-devel@oss.oracle.com; Mon, 08 Jan 2018 22:28:01 -0800 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w096S1B0009781 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Tue, 9 Jan 2018 06:28:01 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w096S0Nt004001 for ; Tue, 9 Jan 2018 06:28:00 GMT Received: from h3cmg01-ex.h3c.com (smtp.h3c.com [60.191.123.56]) by userp2030.oracle.com with ESMTP id 2fcfangt5s-1 for ; Tue, 09 Jan 2018 06:28:00 +0000 Received: from BJHUB01-EX.srv.huawei-3com.com (unknown [10.63.20.169]) by h3cmg01-ex.h3c.com with smtp id 62b8_085f_0325f1ca_ced7_4068_8de6_1121d08673c4; Tue, 09 Jan 2018 14:24:17 +0800 Received: from localhost.localdomain (10.125.136.231) by rndsmtp.h3c.com (10.63.20.174) with Microsoft SMTP Server id 14.3.248.2; Tue, 9 Jan 2018 14:24:08 +0800 From: Changwei Ge To: Date: Tue, 9 Jan 2018 14:24:29 +0800 Message-ID: <1515479070-32653-1-git-send-email-ge.changwei@h3c.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.125.136.231] X-CLX-Shades: MLX X-CLX-Response: 1TFkXGxIaEQpMehcaEQpZTRdnZnIRCllJFxpxGhAadwYbHBpxGRMQGncGGBo GGhEKWV4XaG55EQpJRhdFWEtJRk91WlhFTl9JXkNFRBl1T0sRCkNOF10HT3kbUmNTZFhdHkFFGn 9YfXl/Y314Em5dX19HHhtjEQpYXBcfBBoEGxgYBxxLSEtPHhwaBRsaBBsaGgQeEgQbEBseGh8aE QpeWRd4Q019ZhEKTVwXGB8cEQpMWhdoaUJNexEKTU4XaBEKQ1oXHBoEGxMbBBsYGQQfHBEKQl4X GxEKREkXHREKQkYXZ3N+BUVvWGlNEkYRCkJcFxoRCkJFF24ZWExeYQFwUkxhEQpCThdkQnxaRUR BYh1kUBEKQkwXb35dTRgFXWYaUnsRCkJsF2RhT0tgQkgSeB1nEQpCQBdiRUZjYXhsWn9bSBEKQl gXYn1veQFPGBlwcHsRCk1eFxsRClpYFxgRCnBoF2dcSHlEfBNcTR9zEBoRCnBoF2McSWVZf1wcX n8bEBoRCnBoF258WFkTYUlpUxlvEBoRCnBoF2EFAV9NSxxAbXsaEBoRCnBoF21gb21uY3Nacn0c EBoRCnBsF21OG29TAUdSSB1zEBkaEQptfhcbEQpYTRdLESA= X-PDR: PASS X-Source-IP: 60.191.123.56 X-ServerName: smtp.h3c.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:60.191.123.56 ip4:60.191.123.50 ip4:221.12.31.13 ip4:221.12.31.56 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8768 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=0 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=180 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=805 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801090091 X-Spam: Clean Cc: ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH RESEND v3 1/2] ocfs2: make metadata estimation accurate and clear X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8768 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801090091 X-Virus-Scanned: ClamAV using ClamSMTP For Andrew's convenience, resend this patch Current code assume that ::w_unwritten_list always has only one item on. This is not right and hard to get understood. So improve how to count unwritten item. Reported-by: John Lightsey Signed-off-by: Changwei Ge --- fs/ocfs2/aops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 88a31e9..77ec9b4 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -784,6 +784,7 @@ struct ocfs2_write_ctxt { struct ocfs2_cached_dealloc_ctxt w_dealloc; struct list_head w_unwritten_list; + unsigned int w_unwritten_count; }; void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages) @@ -1373,6 +1374,7 @@ static int ocfs2_unwritten_check(struct inode *inode, desc->c_clear_unwritten = 0; list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list); list_add_tail(&new->ue_node, &wc->w_unwritten_list); + wc->w_unwritten_count++; new = NULL; unlock: spin_unlock(&oi->ip_lock); @@ -2246,7 +2248,7 @@ static int ocfs2_dio_get_block(struct inode *inode, sector_t iblock, ue->ue_phys = desc->c_phys; list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list); - dwc->dw_zero_count++; + dwc->dw_zero_count += wc->w_unwritten_count; } ret = ocfs2_write_end_nolock(inode->i_mapping, pos, len, len, wc);