diff mbox series

Btrfs: assert page dirty bit

Message ID 1536703587-94565-2-git-send-email-bo.liu@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series Btrfs: assert page dirty bit | expand

Commit Message

Liu Bo Sept. 11, 2018, 10:06 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>
---
 fs/btrfs/extent_io.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Nikolay Borisov Sept. 12, 2018, 6:38 a.m. UTC | #1
On 12.09.2018 01:06, 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>
> ---
>  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..99895f196ecb 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 BTRFS_DEBUG

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

> +	for (i = 0; i < num_pages; i++)
> +		ASSERT(PageDirty(eb->pages[i]));
> +#endif
> +
>  	return was_dirty;
>  }
>  
>
Liu Bo Sept. 12, 2018, 7:28 p.m. UTC | #2
On Wed, Sep 12, 2018 at 09:38:49AM +0300, Nikolay Borisov wrote:
> 
> 
> On 12.09.2018 01:06, 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>
> > ---
> >  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..99895f196ecb 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 BTRFS_DEBUG
> 
> And this will never be compiled since the actual ifdef name is
> "CONFIG_BTRFS_DEBUG"
>

Oops, will fix it.

thanks,
-liubo

> > +	for (i = 0; i < num_pages; i++)
> > +		ASSERT(PageDirty(eb->pages[i]));
> > +#endif
> > +
> >  	return was_dirty;
> >  }
> >  
> >
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index fb2bf50134a1..99895f196ecb 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 BTRFS_DEBUG
+	for (i = 0; i < num_pages; i++)
+		ASSERT(PageDirty(eb->pages[i]));
+#endif
+
 	return was_dirty;
 }