On Mon, Feb 22, 2021 at 03:58:00PM +0800, Su Yue wrote:
> 
> On Mon 22 Feb 2021 at 14:33, Qu Wenruo <w...@suse.com> wrote:
> 
> > For btree_set_page_dirty(), we should also check the extent 
> > buffer
> > sanity for subpage support.
> >
> > Unlike the regular sector size case, since one page can contain 
> > multiple
> > extent buffers, we need to make sure there is at least one dirty 
> > extent
> > buffer in the page.
> >
> > So this patch will iterate through the 
> > btrfs_subpage::dirty_bitmap
> > to get the extent buffers, and check if any dirty extent buffer 
> > in the page
> > range has EXTENT_BUFFER_DIRTY and proper refs.
> >
> > Signed-off-by: Qu Wenruo <w...@suse.com>
> > ---
> >  fs/btrfs/disk-io.c | 47 
> >  ++++++++++++++++++++++++++++++++++++++++------
> >  1 file changed, 41 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> > index c2576c5fe62e..437e6b2163c7 100644
> > --- a/fs/btrfs/disk-io.c
> > +++ b/fs/btrfs/disk-io.c
> > @@ -42,6 +42,7 @@
> >  #include "discard.h"
> >  #include "space-info.h"
> >  #include "zoned.h"
> > +#include "subpage.h"
> >
> >  #define BTRFS_SUPER_FLAG_SUPP      (BTRFS_HEADER_FLAG_WRITTEN |\
> >                              BTRFS_HEADER_FLAG_RELOC |\
> > @@ -992,14 +993,48 @@ static void btree_invalidatepage(struct 
> > page *page, unsigned int offset,
> >  static int btree_set_page_dirty(struct page *page)
> >  {
> >  #ifdef DEBUG
> > +   struct btrfs_fs_info *fs_info = 
> > btrfs_sb(page->mapping->host->i_sb);
> > +   struct btrfs_subpage *subpage;
> >     struct extent_buffer *eb;
> > +   int cur_bit;
> >
> cur_bit is not initialized.

Indeed and it's strange that gcc does not warn about that, either by
default or with W=3.

Reply via email to