Skip to contentSkip to conversation

btrfs-progs: Do not free dirty extent buffer

PATCH In review Naohiro Aota 2 participants 3 messages Aug 21, 2014 – Aug 25, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: Do not free dirty extent buffer

free_some_buffer() should not free dirty extent buffers. They should be left for later commit.

---
 extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extent_io.c +1 -1
index a127e54..8a668be 100644
@@ -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;
Signature · 1 line
2.0.4
#1 lore raw
Quoted 13 lines · Naohiro Aota

free_some_buffer() should not free dirty extent buffers. They should be left for later commit.

---
 extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extent_io.c +0 -0
index a127e54..8a668be 100644

extent_io.c static int free_some_buffers(struct extent_io_tree *tree) · line 555

Quoted 5 lines
extent_io.c +1 -1
@@ -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?

Quoted 9 lines
extent_io.c +0 -1
                        free_extent_buffer(eb);
                        if (tree->cache_size < cache_hard_max)
                                break;
--

2.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."
#2 lore raw

Hi,

Quoted 15 lines · Filipe David Manana
Quoted 14 lines · Naohiro Aota

free_some_buffer() should not free dirty extent buffers. They should be left for later commit.

---
 extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extent_io.c +0 -0
index a127e54..8a668be 100644
@@ -552,7 +552,7 @@ static int free_some_buffers(struct extent_io_tree *tree)
 
Quoted 8 lines

extent_io.c static int free_some_buffers(struct extent_io_tree *tree) · line 555

Quoted 4 lines
extent_io.c +1 -1
        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.

Quoted 1 line

From 0e1a49216d40b44909cdfacd5cd9a13aa796db41 Mon Sep 17 00:00:00 2001

From: Naohiro Aota <[email protected]>
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.

---
 extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
extent_io.c +1 -1
index a127e54..1df377d 100644
@@ -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;
Signature · 1 line
2.0.4