Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2959804imu; Mon, 19 Nov 2018 08:38:49 -0800 (PST) X-Google-Smtp-Source: AJdET5dgjqmL5uOv1s55gLp+4rl6HLEWUjXABJxvfs9SVlt2NVCdlN2UzUPhlBJEQgjnTv3EyPjA X-Received: by 2002:a17:902:b60a:: with SMTP id b10mr21758023pls.303.1542645529538; Mon, 19 Nov 2018 08:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645529; cv=none; d=google.com; s=arc-20160816; b=G//s8jpCS54PCUtK1dwcK7a+rC0FQ2eJ2MUZKuyFuOdoSqhoSYgGx8rAtwKOWar271 TKZQwnM0YnOVhhONoou7M54cqJKZpLEbv0PgsCEthliAb8CBv7ZDX2n1UYMl1u3/0atE xrsbKIVnbmzHQjftT/3Fylo4Ya8tEzd3wVTs3A9AGKQs8JBEBj4AIni1vfMtDbW9p+/H OYwGMXGMBpzd/prurLLT1bMNNGQ023MqeqFKy7M+SGlHfomb5vYNkSgah17jmubwP9YG 8M9/PKMiYt7D60XlEWE+TttLMWxfUKc/sy8HwklvcudI248GN/y06nTnie2wSXETHpEs gxvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/8ROsMcMJ879uttdbkeW3MZ2RTBF6Q/d/DI9HvDl9+M=; b=UR5/Wx4gHqPMeWze30uaKvK8Fb9HFOA/+Lh+UwAvCStO50LcfrZNCt0D7JfamGZHYr OGRzkJ8MFM3+g+oyVw7TTu7YYyUIukIBq3DD+oj4M9OqHXTVvjOo04iE/+NyPBlNewS1 cEpfBjM15wkcshj+Ho79cmBYdOqJg/9fJSa2YkNHUAop334YzNcBsOhrv9n+ZALExs3n UxhN+JWnw+y3C46A3rlDnk7AvPbc1LqKtHLegmAVfybE2HlNVsMDmcubxupq9wEgIezv Jrrhd+WQJ17I0IbkLayHPqUp1F5Q6AOpdxPxChSvVEkU4qEe/cUKIc3nQYhy803iV9Xp jQJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JKdEIC0c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si38257872pgt.293.2018.11.19.08.38.34; Mon, 19 Nov 2018 08:38:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JKdEIC0c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732181AbeKTDBc (ORCPT + 99 others); Mon, 19 Nov 2018 22:01:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:33476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730931AbeKTDBc (ORCPT ); Mon, 19 Nov 2018 22:01:32 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA362206BA; Mon, 19 Nov 2018 16:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645443; bh=v4+j+deAcX0xLAqE12/sFr40GAghPTtpx/IsRLUFGVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JKdEIC0c2+uqS1aZDN7lamDwAudK+u3la8YJCsG703GS+G739A8oSujtTvDduGsu6 YH4tpi4d0WxrwKKZFHhUxosui+wramdEYP73pzUhTFZTZQQV9bAmrNGWkeMW67SBil PSnalFncuUqUITwONfC2Cph0+896BqKJZlCjsM3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher Subject: [PATCH 4.19 164/205] gfs2: Fix metadata read-ahead during truncate (2) Date: Mon, 19 Nov 2018 17:27:51 +0100 Message-Id: <20181119162639.848816749@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andreas Gruenbacher commit e7445ceddfc220c1aede6d42758a5acb8844e9c3 upstream. The previous attempt to fix for metadata read-ahead during truncate was incorrect: for files with a height > 2 (1006989312 bytes with a block size of 4096 bytes), read-ahead requests were not being issued for some of the indirect blocks discovered while walking the metadata tree, leading to significant slow-downs when deleting large files. Fix that. In addition, only issue read-ahead requests in the first pass through the meta-data tree, while deallocating data blocks. Fixes: c3ce5aa9b0 ("gfs2: Fix metadata read-ahead during truncate") Cc: stable@vger.kernel.org # v4.16+ Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/bmap.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -1908,10 +1908,16 @@ static int punch_hole(struct gfs2_inode if (ret < 0) goto out; - /* issue read-ahead on metadata */ - if (mp.mp_aheight > 1) { - for (; ret > 1; ret--) { - metapointer_range(&mp, mp.mp_aheight - ret, + /* On the first pass, issue read-ahead on metadata. */ + if (mp.mp_aheight > 1 && strip_h == ip->i_height - 1) { + unsigned int height = mp.mp_aheight - 1; + + /* No read-ahead for data blocks. */ + if (mp.mp_aheight - 1 == strip_h) + height--; + + for (; height >= mp.mp_aheight - ret; height--) { + metapointer_range(&mp, height, start_list, start_aligned, end_list, end_aligned, &start, &end);