All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arne Jansen <sensille@gmx.net>
To: Andi Kleen <andi@firstfloor.org>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v0 07/18] btrfs: generic data structure to build unique lists
Date: Fri, 07 Oct 2011 10:12:18 +0200	[thread overview]
Message-ID: <4E8EB462.7000908@gmx.net> (raw)
In-Reply-To: <m2y5wx3loj.fsf@firstfloor.org>

On 06.10.2011 22:33, Andi Kleen wrote:
> Arne Jansen <sensille@gmx.net> writes:
> 
>> 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 subvolume quota to translate recursions into iterative
>> loops.
> 
> Hmm, sounds like a job for lib/idr.c 
> 
> What do your ulists do that idr doesn't?
> Ok idr doesn't have merge, but that should be simple
> enough to add.
> 

This is indeed a part I'm not feeling particularly well about, adding a
generic data structure to btrfs instead of to the core. If I'm not the
only one feeling this data structure might be handy outside of btrfs, I
can move it, if someone points me to the right place.
Since I built it, I found many applications for it, so I have some hopes
I won't stay the only one to like it. Of course the current version is
not very optimized, though on small sets it should work well.

As to the differences to idr:
 - as David pointed out, idr works on int, while I always need u64 to
   represent btrfs logical addresses.
 - as I understand idr (though I never used it), it is designed to manage
   small consecutive integers, while ulists hold completely unrelated
   numbers, e.g. btrfs logical adresses. For small sets ulists might be
   much faster than idr
 - ulists as used here are very short lived. I don't know if idr handles
   this case well
 - the purpose of ulists is to add a specific number, and not to find a
   free one. I don't see a direct interface for this in idr.

-Arne

> -Andi


  parent reply	other threads:[~2011-10-07  8:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 15:54 [PATCH v0 00/18] btfs: Subvolume Quota Groups Arne Jansen
2011-10-06 15:54 ` [PATCH v0 01/18] btrfs: mark delayed refs as for cow Arne Jansen
2011-10-06 15:54 ` [PATCH v0 02/18] btrfs: always save ref_root in delayed refs Arne Jansen
2011-10-06 15:54 ` [PATCH v0 03/18] btrfs: add nested locking mode for paths Arne Jansen
2011-10-06 20:36   ` Andi Kleen
     [not found]     ` <CANvN+ems8D+wB_YPzoNpsqxZ8on-z7xCEXQuQ0LgoF_T=gw+Yw@mail.gmail.com>
     [not found]       ` <CANvN+emRvTQD-epGJrELs_WAF06zuuBb0ELpSFrGazzAbo29gg@mail.gmail.com>
2011-10-06 20:50         ` Andi Kleen
     [not found]           ` <CANvN+e=GtjwG9+G1BggsbQOwe+iP4DzqQUvjDP=rw_+FuPZM7w@mail.gmail.com>
2011-10-07  8:39             ` Arne Jansen
2011-10-06 15:54 ` [PATCH v0 04/18] btrfs: qgroup on-disk format Arne Jansen
2011-10-06 15:54 ` [PATCH v0 05/18] btrfs: add helper for tree enumeration Arne Jansen
2011-10-06 15:54 ` [PATCH v0 06/18] btrfs: check the root passed to btrfs_end_transaction Arne Jansen
2011-10-06 15:54 ` [PATCH v0 07/18] btrfs: generic data structure to build unique lists Arne Jansen
2011-10-06 20:33   ` Andi Kleen
2011-10-06 22:19     ` David Sterba
2011-10-07  8:12     ` Arne Jansen [this message]
2011-10-07 15:07       ` Andi Kleen
2011-10-06 15:54 ` [PATCH v0 08/18] btrfs: added helper to create new trees Arne Jansen
2011-10-06 15:54 ` [PATCH v0 09/18] btrfs: qgroup state and initialization Arne Jansen
2011-10-06 15:54 ` [PATCH v0 10/18] btrfs: Test code to change the order of delayed-ref processing Arne Jansen
2011-10-06 15:54 ` [PATCH v0 11/18] btrfs: add sequence numbers to delayed refs Arne Jansen
2011-10-06 15:54 ` [PATCH v0 12/18] btrfs: put back delayed refs that are too new Arne Jansen
2011-10-06 15:54 ` [PATCH v0 13/18] btrfs: qgroup implementation and prototypes Arne Jansen
2011-10-06 15:54 ` [PATCH v0 14/18] btrfs: quota tree support and startup Arne Jansen
2011-10-06 15:54 ` [PATCH v0 15/18] btrfs: hooks for qgroup to record delayed refs Arne Jansen
2011-10-06 15:54 ` [PATCH v0 16/18] btrfs: hooks to reserve qgroup space Arne Jansen
2011-10-06 15:54 ` [PATCH v0 17/18] btrfs: add qgroup ioctls Arne Jansen
2011-10-06 20:40   ` Andi Kleen
2011-10-06 15:54 ` [PATCH v0 18/18] btrfs: add qgroup inheritance Arne Jansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8EB462.7000908@gmx.net \
    --to=sensille@gmx.net \
    --cc=andi@firstfloor.org \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.