Skip to contentSkip to conversation

Btrfs: assert page dirty bit

PATCH Superseded Liu Bo 3 participants 6 messages Sep 12, 2018 – Sep 14, 2018 Btrfs file system

lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 Btrfs: assert page dirty bit

Just in case that someone breaks the rule that pages are dirty as long as eb is dirty.

---
 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/btrfs/extent_io.c +5 -0
index fb2bf50134a1..99895f196ecb 100644
@@ -5184,6 +5184,11 @@ bool set_extent_buffer_dirty(struct extent_buffer *eb)
 			set_page_dirty(eb->pages[i]);
 	}
 
+#ifdef BTRFS_DEBUG
+	for (i = 0; i < num_pages; i++)
+		ASSERT(PageDirty(eb->pages[i]));
+#endif
+
 	return was_dirty;
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 13 lines · Liu Bo

Just in case that someone breaks the rule that pages are dirty as long as eb is dirty.

---
 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/btrfs/extent_io.c +0 -0
index fb2bf50134a1..99895f196ecb 100644

fs/btrfs/extent_io.c bool set_extent_buffer_dirty(struct extent_buffer *eb) · line 5187

Quoted 4 lines
fs/btrfs/extent_io.c +1 -0
@@ -5184,6 +5184,11 @@ bool set_extent_buffer_dirty(struct extent_buffer *eb)
 			set_page_dirty(eb->pages[i]);
 	}
 
+#ifdef BTRFS_DEBUG

And this will never be compiled since the actual ifdef name is "CONFIG_BTRFS_DEBUG"

Quoted 8 lines
fs/btrfs/extent_io.c +4 -0
+	for (i = 0; i < num_pages; i++)
+		ASSERT(PageDirty(eb->pages[i]));
+#endif
+
 	return was_dirty;
 }
 
author
#2 lore raw
Quoted 19 lines · Nikolay Borisov
Quoted 16 lines · Liu Bo

Just in case that someone breaks the rule that pages are dirty as long as eb is dirty.

---
 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/btrfs/extent_io.c +0 -0
index fb2bf50134a1..99895f196ecb 100644
@@ -5184,6 +5184,11 @@ bool set_extent_buffer_dirty(struct extent_buffer *eb)
 			set_page_dirty(eb->pages[i]);
 	}
 
Quoted 5 lines

fs/btrfs/extent_io.c bool set_extent_buffer_dirty(struct extent_buffer *eb) · line 5187

Quoted 1 line
fs/btrfs/extent_io.c +1 -0
+#ifdef BTRFS_DEBUG

And this will never be compiled since the actual ifdef name is "CONFIG_BTRFS_DEBUG"

Oops, will fix it.

thanks,
-liubo

Quoted 8 lines
Quoted 8 lines
fs/btrfs/extent_io.c +4 -0
+	for (i = 0; i < num_pages; i++)
+		ASSERT(PageDirty(eb->pages[i]));
+#endif
+
 	return was_dirty;
 }
 
author
#3 lore raw

PATCH v2 1/1 Btrfs: assert page dirty bit

In reply to Liu Bo

Just in case that someone breaks the rule that pages are dirty as long as eb is dirty.

---
v2: fix typo of CONFIG_BTRFS_DEBUG

 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/btrfs/extent_io.c +5 -0
index fb2bf50134a1..f88231171009 100644
@@ -5184,6 +5184,11 @@ bool set_extent_buffer_dirty(struct extent_buffer *eb)
 			set_page_dirty(eb->pages[i]);
 	}
 
+#ifdef CONFIG_BTRFS_DEBUG
+	for (i = 0; i < num_pages; i++)
+		ASSERT(PageDirty(eb->pages[i]));
+#endif
+
 	return was_dirty;
 }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/1
#4 lore raw
Quoted 4 lines · Liu Bo

Just in case that someone breaks the rule that pages are dirty as long as eb is dirty.

Quoted 23 lines

---
v2: fix typo of CONFIG_BTRFS_DEBUG

 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/btrfs/extent_io.c +5 -0
index fb2bf50134a1..f88231171009 100644
@@ -5184,6 +5184,11 @@ bool set_extent_buffer_dirty(struct extent_buffer *eb)
 			set_page_dirty(eb->pages[i]);
 	}
 
+#ifdef CONFIG_BTRFS_DEBUG
+	for (i = 0; i < num_pages; i++)
+		ASSERT(PageDirty(eb->pages[i]));
+#endif
+
 	return was_dirty;
 }