From patchwork Fri Nov 22 10:51:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 180000 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp36870ilf; Fri, 22 Nov 2019 02:53:37 -0800 (PST) X-Google-Smtp-Source: APXvYqyc4jo7mzcWMqGsLIgRSGpuKlIlmOiYUEXL7OZWsE98hgzjewloqWx9v58kC5vprH/y6uvg X-Received: by 2002:a17:907:43ef:: with SMTP id ol23mr3460678ejb.264.1574419916544; Fri, 22 Nov 2019 02:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574419916; cv=none; d=google.com; s=arc-20160816; b=YkAavJLPHoXpu3Ky7QNrYeeFiQLmEBAipbBiBgHc574nQkG7hQXBsYzNzZtAh5BWOy EAvjNkHm+kpIw5Qf8XY4tmFo2Fw0jAg0AkYiZtYTVz5a+SCt3xdIL08lfCsAHWNsZoww MgGRn0MbFh3i79Z5kRYW8LM4m8mebrvN/HrukM2pZ/qeNwMHN9N0w6wrcN0XFq6cu0YS kBGbMSZaTq5iGmAbC+9JxkfGb+S/gG/HBh2YHTRTIM4VHKCrkM0hZ5u/zc2BcrFnnDEN 4t0CG3SWoLHgav9h+6v8RVR/4zs4GgFSOP6r1KOIqINmv7E7Pp3g44o5Bl240G22Niq+ eFMg== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=IYvLW8dFLd2i3abuhtpQEsje/E4kH68QhKyD7uWKyBc=; b=VX2MDa26ZhaVilWPeFa0q2zQGZuU4su2Ej6oOi3rm2RmQep0S5KKsr77g+HY7icXr0 4Q0BQDhzAtLzKNm9GeknMsQAOT1u8XXzkDwIHhTZGuvRggGhfv9J/fQp66WjlbSZXIa3 D1gAnXJXBQkVi8PjuuVzA98mqzQNOGhGnsSlbyTgRnkLMuvmPvsaiwQV7Rvar/vDvAQk HeK39XaYR+7/3ORKEXouO/68pIYPTaSzailUrzT96SMXjW/wUqkCUaBpEt58K5RX6H9x IcNsnWB+9F5QH85MF17MjksbxF2sy3TGsr5ZwA+U9PWgaxQh5KPeR0j11gSRCHUNfNes e+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mizHDut5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si547902ejy.259.2019.11.22.02.51.54; Fri, 22 Nov 2019 02:51:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=mizHDut5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730009AbfKVKvr (ORCPT + 15 others); Fri, 22 Nov 2019 05:51:47 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36812 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730030AbfKVKvq (ORCPT ); Fri, 22 Nov 2019 05:51:46 -0500 Received: by mail-wm1-f67.google.com with SMTP id n188so5121796wme.1 for ; Fri, 22 Nov 2019 02:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IYvLW8dFLd2i3abuhtpQEsje/E4kH68QhKyD7uWKyBc=; b=mizHDut5vTuyzETw7KbpwD+bz1bUNIbTnGzACpyTFp33vtbIm/uniwWpJeYuRxNVU9 J2B+URcM2A9bQ31Le9jHZsthBuQPGDTNYuKLQNtgt1WFXyy2eUGiiwY3GtQw0MC1oOlV fgPLDhZn1iMbY7/ynH6B2ciGxNy5a8qlenfdAJcrfBNfhi/YdQ8MlIMJNfVVv7uW/hSR 8MW5SMcuLOwRW2FT7zYPtlOzEbDkWXkxy6mKYMpBNNZBTIN4wNnuWWD98tDs6RFMpxgX tJQa3SM3a+aFBSInP59S50GfDs0bFIXNcYCYZV5XuJvgX4LzckElhLKv4jybyw77LaeB o2uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IYvLW8dFLd2i3abuhtpQEsje/E4kH68QhKyD7uWKyBc=; b=NgFy8K3rMfiOkBex1EsGn/tELaohyPEl08LUDmGPmCx9AlbbK9eAVIwpPVHLPBRYhH 4gUM25Lc+RP9AOlq3p+QYqYfgTLeNx0qOqSqygrQHa73/Ynn59GLKvnFsHhUliFK14FH M/xmbGrWmZwW8ykDcfh6g+bPab1ZrdUh0icVGRo0SSv0xDrdoA0YSCOLKmHWR1eBqOz5 S/+IM41ejo7qudqo/p7dBroVcwjTNiStCFQn4By0paKaDXpvTyECF1hS80jOQBpmRjnP h2GtxZ4hOfX8VriCx7zgdTBS7DRB8SzkwO+1W4oQQJxdGks22Gk+oZ/sCXAI6IEaVZah /Klg== X-Gm-Message-State: APjAAAXmELdjFFxa7z9t+X4Sq5FWt3K8fxEEMnb52gw3fgBRrexTRRp2 aSjGFD3SKTC/TOvWkRFG0Q/cpbXlQ4A= X-Received: by 2002:a1c:5603:: with SMTP id k3mr16874605wmb.150.1574419904536; Fri, 22 Nov 2019 02:51:44 -0800 (PST) Received: from localhost.localdomain ([2.27.35.135]) by smtp.gmail.com with ESMTPSA id w4sm2894338wmk.29.2019.11.22.02.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 02:51:44 -0800 (PST) From: Lee Jones To: lee.jones@linaro.org, gregkh@google.com, stable@vger.kernel.org Subject: [PATCH 4.4 9/9] ext4: avoid unnecessary stalls in ext4_evict_inode() Date: Fri, 22 Nov 2019 10:51:13 +0000 Message-Id: <20191122105113.11213-9-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122105113.11213-1-lee.jones@linaro.org> References: <20191122105113.11213-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jan Kara [ Upstream commit 3abb1a0fc2871f2db52199e1748a1d48a54a3427 ] These days inode reclaim calls evict_inode() only when it has no pages in the mapping. In that case it is not necessary to wait for transaction commit in ext4_evict_inode() as there can be no pages waiting to be committed. So avoid unnecessary transaction waiting in that case. We still have to keep the check for the case where ext4_evict_inode() gets called from other paths (e.g. umount) where inode still can have some page cache pages. Reported-by: Johannes Weiner Signed-off-by: Jan Kara Signed-off-by: Theodore Ts'o Signed-off-by: Lee Jones --- fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.24.0 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3557c5717c8d..821349149726 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -212,7 +212,8 @@ void ext4_evict_inode(struct inode *inode) */ if (inode->i_ino != EXT4_JOURNAL_INO && ext4_should_journal_data(inode) && - (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { + (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && + inode->i_data.nrpages) { journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;