12 Apr, 2018

1 commit


17 Feb, 2017

3 commits


11 Jun, 2015

1 commit

  • This function will delete unode with given (val,aux) pair.
    And with this patch, seqnum for debug usage doesn't have any meaning
    now, so remove them.

    This is used by later patches to skip snapshot root.

    Signed-off-by: Qu Wenruo
    Signed-off-by: Chris Mason

    Qu Wenruo
     

15 Aug, 2014

1 commit

  • We've got bug reports that btrfs crashes when quota is enabled on
    32bit kernel, typically with the Oops like below:
    BUG: unable to handle kernel NULL pointer dereference at 00000004
    IP: [] find_parent_nodes+0x360/0x1380 [btrfs]
    *pde = 00000000
    Oops: 0000 [#1] SMP
    CPU: 0 PID: 151 Comm: kworker/u8:2 Tainted: G S W 3.15.2-1.gd43d97e-default #1
    Workqueue: btrfs-qgroup-rescan normal_work_helper [btrfs]
    task: f1478130 ti: f147c000 task.ti: f147c000
    EIP: 0060:[] EFLAGS: 00010213 CPU: 0
    EIP is at find_parent_nodes+0x360/0x1380 [btrfs]
    EAX: f147dda8 EBX: f147ddb0 ECX: 00000011 EDX: 00000000
    ESI: 00000000 EDI: f147dda4 EBP: f147ddf8 ESP: f147dd38
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    CR0: 8005003b CR2: 00000004 CR3: 00bf3000 CR4: 00000690
    Stack:
    00000000 00000000 f147dda4 00000050 00000001 00000000 00000001 00000050
    00000001 00000000 d3059000 00000001 00000022 000000a8 00000000 00000000
    00000000 000000a1 00000000 00000000 00000001 00000000 00000000 11800000
    Call Trace:
    [] __btrfs_find_all_roots+0x9d/0xf0 [btrfs]
    [] btrfs_qgroup_rescan_worker+0x401/0x760 [btrfs]
    [] normal_work_helper+0xc8/0x270 [btrfs]
    [] process_one_work+0x11b/0x390
    [] worker_thread+0x101/0x340
    [] kthread+0x9b/0xb0
    [] ret_from_kernel_thread+0x21/0x30
    [] kthread_create_on_node+0x110/0x110

    This indicates a NULL corruption in prefs_delayed list. The further
    investigation and bisection pointed that the call of ulist_add_merge()
    results in the corruption.

    ulist_add_merge() takes u64 as aux and writes a 64bit value into
    old_aux. The callers of this function in backref.c, however, pass a
    pointer of a pointer to old_aux. That is, the function overwrites
    64bit value on 32bit pointer. This caused a NULL in the adjacent
    variable, in this case, prefs_delayed.

    Here is a quick attempt to band-aid over this: a new function,
    ulist_add_merge_ptr() is introduced to pass/store properly a pointer
    value instead of u64. There are still ugly void ** cast remaining
    in the callers because void ** cannot be taken implicitly. But, it's
    safer than explicit cast to u64, anyway.

    Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=887046
    Cc: [v3.11+]
    Signed-off-by: Takashi Iwai
    Signed-off-by: Chris Mason

    Takashi Iwai
     

29 Jan, 2014

2 commits

  • There are not any users that use ulist except Btrfs,don't
    export them.

    Signed-off-by: Wang Shilong
    Reviewed-by: David Sterba
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Wang Shilong
     
  • We are really suffering from now ulist's implementation, some developers
    gave their try, and i just gave some of my ideas for things:

    1. use list+rb_tree instead of arrary+rb_tree

    2. add cur_list to iterator rather than ulist structure.

    3. add seqnum into every node when they are added, this is
    used to do selfcheck when iterating node.

    I noticed Zach Brown's comments before, long term is to kick off
    ulist implementation, however, for now, we need at least avoid
    arrary from ulist.

    Cc: Liu Bo
    Cc: Josef Bacik
    Cc: Zach Brown
    Signed-off-by: Wang Shilong
    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Wang Shilong
     

07 May, 2013

1 commit

  • Walking backref tree and btrfs quota rely on ulist very much.
    This patch tries to use rb_tree to speed up search time.

    The original code always checks whether an element
    exists before adding a new element, however it costs O(n).

    I try to add a rb_tree in the ulist,this is only used to speed up
    search. I also do some measurements with quota enabled.

    fsstress -p 4 -n 10000

    Without this path:
    real 0m51.058s 2m4.745s 1m28.222s 1m5.137s
    user 0m0.035s 0m0.041s 0m0.105s 0m0.100s
    sys 0m12.009s 0m11.246s 0m10.901s 0m10.999s 0m11.287s

    With this path:
    real 0m55.295s 0m50.960s 1m2.214s 0m48.273s
    user 0m0.053s 0m0.095s 0m0.135s 0m0.107s
    sys 0m7.766s 0m6.013s 0m6.319s 0m6.030s 0m6.532s

    After applying the patch,the execute time is down by ~42%.(11.287s->6.532s)

    Signed-off-by: Wang Shilong
    Reviewed-by: Miao Xie
    Reviewed-by: Jan Schmidt
    Signed-off-by: Josef Bacik

    Wang Shilong
     

02 Oct, 2012

1 commit


01 Jun, 2012

2 commits


30 May, 2012

1 commit


26 May, 2012

1 commit

  • ulist_next gets the pointer to the previously returned element to find the
    next element from there. However, when we call ulist_add while iteration
    with ulist_next is in progress (ulist explicitly supports this), we can
    realloc the ulist internal memory, which makes the pointer to the previous
    element useless.

    Instead, we now use an iterator parameter that's independent from the
    internal pointers.

    Reported-by: Alexander Block
    Signed-off-by: Jan Schmidt

    Jan Schmidt
     

22 Dec, 2011

1 commit

  • ulist is a generic data structures to hold a collection of unique u64
    values. The only operations it supports is adding to the list and
    enumerating it.

    It is possible to store an auxiliary value along with the key. The
    implementation is preliminary and can probably be sped up significantly.

    It is used by btrfs_find_all_roots() quota to translate recursions into
    iterative loops.

    Signed-off-by: Arne Jansen
    Signed-off-by: Jan Schmidt

    Arne Jansen