Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1968487ima; Thu, 25 Oct 2018 07:43:14 -0700 (PDT) X-Google-Smtp-Source: AJdET5cnexoHSeNm35nm0IHqBAmouNT729Qh9ZOwhHJZ11yv+becSl9y3K0MWLFe4ckA75aPXp3c X-Received: by 2002:a65:4783:: with SMTP id e3-v6mr1727480pgs.12.1540478594571; Thu, 25 Oct 2018 07:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478594; cv=none; d=google.com; s=arc-20160816; b=fPO+BnCvCRPuztutGtTLvERQ6P0OBNzCfXnFaJzEJacZMbnHU4q/UXa15YMZ5EUDBC NtZ9BroVvnAHHLfjtBJZghIqDEKrz7VEBRYmKxgRW/FiLKuJogWVIHv0e7Mx+dNh8/eh qWCsCZv0Z7RXqQv3XpDceY77qeXNBKL3DMJgqSZrlflNpZNqQr0GOluJmQZQvl854GFD 6/L2RG3+aclJQX7/DSGZnVBUN5TirVvAhirvYpcB3pY4O4OFEHhGY4SgW0v8aZZkWjv5 rh1u6IdG+o/8ADJWofs7Dvb3UCUEmWkp84dharUtSSoioIplkmjyDtGTPxNhYftomQLx 4jCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Fn3/7cpID3/ABwtwZ0RA912baEzgZhcE9pwq4waNKKc=; b=MOQRpIkFUfWNHG3deB6d0Uwz2juVeWyiTyBBjbyfMZM/m7vM58fZRSr5i8Sq1u1vCE h6yBcFidze6WeBIhgv+TDagjFG0TU30XlNH/+3DJihuJ7uuE52oSNwkaIdl/xspxkhJt tyXtnCCK5kd8F6ma0uym4+3w/ZZxf4oF+Ckbc8dDXmL2KQ9jlTBkMCdcPaS+RtyRE9QY 6ylrXAJ6ftFdCHrEfJVwYE+IqbEuwJLAXdNrW6I1JKrEOWkgaBe81eNvDwvc4ZMncDo7 ZkMEWCHUOEGSQa/v+MgQ0NPr8+Sb8HSWBd2zwacORe8bsIVKyK0Z+JAxlhTjc36fEJRq B35Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uTb/lnwd"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h131-v6si8147464pgc.122.2018.10.25.07.42.36; Thu, 25 Oct 2018 07:43:14 -0700 (PDT) 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="uTb/lnwd"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728941AbeJYWsW (ORCPT + 99 others); Thu, 25 Oct 2018 18:48:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:56978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728919AbeJYWsV (ORCPT ); Thu, 25 Oct 2018 18:48:21 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 644D720869; Thu, 25 Oct 2018 14:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476925; bh=qb+k2B17M/VyiZNG6zG0rKK5nS8iq4aeY9XLtwMul3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTb/lnwdc/BdqzLz4rJZfFWUDLhqeUeB7x+QGLJRLlI99L5G2UzsrwrwLESK/3Ymi MITeTzxN01VgYzsnQ5u9DYTYx1WUhfzLgOEsuSKpZ+XW2J7Gwvhy0Jw1ye4ZVLd8/G 6UaJbQoxPl1Etm3SNp1hoe86lUpO6lztye0mN17o= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Liu Bo , David Sterba , Chris Mason , Sasha Levin Subject: [PATCH AUTOSEL 4.9 41/98] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io Date: Thu, 25 Oct 2018 10:13:26 -0400 Message-Id: <20181025141423.213774-41-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liu Bo [ Upstream commit 452e62b71fbbefe2646fad3a968371a026936c6d ] Before this, we use 'filled' mode here, ie. if all range has been filled with EXTENT_DEFRAG bits, get to clear it, but if the defrag range joins the adjacent delalloc range, then we'll have EXTENT_DEFRAG bits in extent_state until releasing this inode's pages, and that prevents extent_data from being freed. This clears the bit if any was found within the ordered extent. Signed-off-by: Liu Bo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Chris Mason Signed-off-by: Sasha Levin --- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index bd036557c6bc..5ebdb58079e1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2966,7 +2966,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) ret = test_range_bit(io_tree, ordered_extent->file_offset, ordered_extent->file_offset + ordered_extent->len - 1, - EXTENT_DEFRAG, 1, cached_state); + EXTENT_DEFRAG, 0, cached_state); if (ret) { u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item); if (0 && last_snapshot >= BTRFS_I(inode)->generation) -- 2.17.1