Re: [PATCH 1/7] btrfs: subpagesize-blocksize: Define extent_buffer_head

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-12-16 at 14:32 +0200, saeed bishara wrote:
> On Thu, Dec 12, 2013 at 1:38 AM, Chandra Seetharaman
> <sekharan@xxxxxxxxxx> wrote:
> > In order to handle multiple extent buffers per page, first we
> > need to create a way to handle all the extent buffers that
> > are attached to a page.
> >
> > This patch creates a new data structure eb_head, and moves
> > fields that are common to all extent buffers in a page from
> > extent buffer to eb_head.
> >
> > This also adds changes that are needed to handle multiple
> > extent buffers per page case.
> >
> > Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
> > ---

<snip>

> > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> > index 54ab861..02de448 100644
> > --- a/fs/btrfs/ctree.h
> > +++ b/fs/btrfs/ctree.h
> > @@ -2106,14 +2106,16 @@ static inline void btrfs_set_token_##name(struct extent_buffer *eb,     \
> >  #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits)            \
> >  static inline u##bits btrfs_##name(struct extent_buffer *eb)           \
> >  {                                                                      \
> > -       type *p = page_address(eb->pages[0]);                           \
> > +       type *p = page_address(eb_head(eb)->pages[0]) +                 \
> > +                               (eb->start & (PAGE_CACHE_SIZE -1));     \
> you can use PAGE_CACHE_MASK instead of PAGE_CACHE_SIZE - 1

PAGE_CACHE_MASK get the page part of the value, not the offset in the
page, i.e it is defined as

#define PAGE_MASK (~(PAGE_SIZE-1))

> >         u##bits res = le##bits##_to_cpu(p->member);                     \
> >         return res;                                                     \

<snip>
> > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> > index ff43802..a1a849b 100644
> > --- a/fs/btrfs/extent_io.c
> > +++ b/fs/btrfs/extent_io.c

<snip>

> > @@ -3367,17 +3376,27 @@ static int lock_extent_buffer_for_io(struct extent_buffer *eb,
> >          * under IO since we can end up having no IO bits set for a short period
> >          * of time.
> >          */
> > -       spin_lock(&eb->refs_lock);
> > -       if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &eb->bflags)) {
> > -               set_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags);
> > -               spin_unlock(&eb->refs_lock);
> > -               btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
> > -               __percpu_counter_add(&fs_info->dirty_metadata_bytes,
> > -                                    -eb->len,
> > +       spin_lock(&ebh->refs_lock);
> > +       for (i = 0; i < MAX_EXTENT_BUFFERS_PER_PAGE; i++) {
> > +               ebtemp = &ebh->extent_buf[i];
> > +               dirty_arr[i] |= test_and_clear_bit(EXTENT_BUFFER_DIRTY, &ebtemp->ebflags);
> dirty_arr wasn't initialized, changing the "|=" to = fixed a crash
> issue when doing writes

Realized after posting the patch, not fixed in my tree.

Thanks
> > +               dirty = dirty || dirty_arr[i];
> > +       }
> > + 

<snip>
> > 1.7.12.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux