diff mbox series

[v2] Btrfs: assert page dirty bit

Message ID 1536860768-42604-1-git-send-email-bo.liu@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series [v2] Btrfs: assert page dirty bit | expand

Commit Message

Liu Bo Sept. 13, 2018, 5:46 p.m. UTC
Just in case that someone breaks the rule that pages are dirty as long
as eb is dirty.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
v2: fix typo of CONFIG_BTRFS_DEBUG

 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Nikolay Borisov Sept. 14, 2018, 6:24 a.m. UTC | #1
On 13.09.2018 20:46, Liu Bo wrote:
> Just in case that someone breaks the rule that pages are dirty as long
> as eb is dirty.
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> v2: fix typo of CONFIG_BTRFS_DEBUG
> 
>  fs/btrfs/extent_io.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index fb2bf50134a1..f88231171009 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -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;
>  }
>  
>
David Sterba Sept. 14, 2018, 12:55 p.m. UTC | #2
On Fri, Sep 14, 2018 at 01:46:08AM +0800, Liu Bo wrote:
> Just in case that someone breaks the rule that pages are dirty as long
> as eb is dirty.
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>

Reviewed-by: David Sterba <dsterba@suse.com>

I've reordered the patches so the assert comes first, before the actual
conditional dirtying.
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index fb2bf50134a1..f88231171009 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -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;
 }