From patchwork Mon Aug 25 05:09:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 4772541 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7DF37C0338 for ; Mon, 25 Aug 2014 05:09:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA05C20121 for ; Mon, 25 Aug 2014 05:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4237A2011E for ; Mon, 25 Aug 2014 05:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753430AbaHYFJP (ORCPT ); Mon, 25 Aug 2014 01:09:15 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:54992 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025AbaHYFJO (ORCPT ); Mon, 25 Aug 2014 01:09:14 -0400 Received: by mail-pd0-f170.google.com with SMTP id g10so19534916pdj.29 for ; Sun, 24 Aug 2014 22:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=fN9rdW0U7DX5FCDr8QFgzIKQet/Oky62GvPAsxqEdDE=; b=hwC5Y4/hxEO+pbSNn3OiQuMI1yjwL7ObomMAizpb0Pmms0oSHCN/o1C4nW8Ps0ujK/ 0F23sJLqxgNqueO8p0Wyrrctw7y/ugr4HcAbliA+OOJ9QIkykRiEsJt/KzQinbN4VCAw hfpvOdbfNRsGDpCudInAQYJydXf438ESDvzFVFjkh0IpELxljy/TdQ1xU41wO1AQahMn brJIY2X8m5FdjndGeOTpL9df2CTneVdJXdtnts5OB2FB2QnN1ZVAKex9KensEYVPOzsE NEhZSXZ6aimEEYR1xsbRroz+hP/viB0Rs73pO9y8LtIBb4c52XCqpC+dmjO01Rjzatp4 DKew== X-Received: by 10.68.136.100 with SMTP id pz4mr8316963pbb.119.1408943354292; Sun, 24 Aug 2014 22:09:14 -0700 (PDT) Received: from ako (sslab-relay.ics.keio.ac.jp. [131.113.126.173]) by mx.google.com with ESMTPSA id cf2sm36073198pbb.68.2014.08.24.22.09.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 24 Aug 2014 22:09:13 -0700 (PDT) From: Naohiro Aota To: fdmanana@gmail.com Cc: "linux-btrfs\@vger.kernel.org" Subject: Re: [PATCH] btrfs-progs: Do not free dirty extent buffer References: <87mway82qp.fsf@elisp.net> Date: Mon, 25 Aug 2014 14:09:07 +0900 In-Reply-To: (Filipe David Manana's message of "Sat, 23 Aug 2014 19:45:22 +0100") Message-ID: <8761hh5f64.fsf@elisp.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 Hi, Filipe David Manana writes: > On Thu, Aug 21, 2014 at 1:07 PM, Naohiro Aota wrote: >> free_some_buffer() should not free dirty extent buffers. They should be >> left for later commit. >> >> Signed-off-by: Naohiro Aota >> --- >> extent_io.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/extent_io.c b/extent_io.c >> index a127e54..8a668be 100644 >> --- a/extent_io.c >> +++ b/extent_io.c >> @@ -552,7 +552,7 @@ static int free_some_buffers(struct extent_io_tree *tree) >> >> list_for_each_safe(node, next, &tree->lru) { >> eb = list_entry(node, struct extent_buffer, lru); >> - if (eb->refs == 1) { >> + if (eb->refs == 1 && !(eb->flags && EXTENT_DIRTY)) { > > Hi, > > Did you meant bitwise and (&) and not logical and (&&) right? Oops, you're right. Following is the new patch. From 0e1a49216d40b44909cdfacd5cd9a13aa796db41 Mon Sep 17 00:00:00 2001 From: Naohiro Aota Date: Mon, 25 Aug 2014 14:03:59 +0900 Subject: [PATCH] btrfs-progs: Do not free dirty extent buffer free_some_buffer() should not free dirty extent buffers. They are left to be committed. Signed-off-by: Naohiro Aota --- extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extent_io.c b/extent_io.c index a127e54..1df377d 100644 --- a/extent_io.c +++ b/extent_io.c @@ -552,7 +552,7 @@ static int free_some_buffers(struct extent_io_tree *tree) list_for_each_safe(node, next, &tree->lru) { eb = list_entry(node, struct extent_buffer, lru); - if (eb->refs == 1) { + if (eb->refs == 1 && !(eb->flags & EXTENT_DIRTY)) { free_extent_buffer(eb); if (tree->cache_size < cache_hard_max) break;