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 |
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; > } > >
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 --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; }
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(+)