From: Alex Lyashkov <Alexey.Lyashkov@Sun.COM>
To: lustre-devel@lists.lustre.org
Subject: [Lustre-devel] 2 primitives for the NRS
Date: Sat, 05 Jan 2008 14:19:42 +0200 [thread overview]
Message-ID: <1199535582.16449.6.camel@bear.shadowland> (raw)
In-Reply-To: <00d501c84ed6$e4fb2010$0281a8c0@ebpc>
On Fri, 2008-01-04 at 13:37 +0000, Eric Barton wrote:
> Any suggestions for improving the API appreciated...
>
> #ifndef __LIBCFS_BHEAP_H__
> #define __LIBCFS_BHEAP_H__
>
> /* Auto-array
> * A sparse 1D contiguous array of pointers which uses single, double and
> * triple indirection maps and avoids allocating large contiguous memory.
> *
> * FIXME: CAA_SHIFT should be defined automatically so that
> */
>
> #define CAA_SHIFT 10
> #define CAA_SIZE (1 << CAA_SHIFT) /* # ptrs per level */
> #define CAA_MASK (CAA_SIZE - 1)
> #define CAA_NOB (CAA_SIZE * sizeof(void *))
>
> typedef struct
> {
> void ****aa_3d; /* Triple indirect */
> void ***aa_2d; /* double indirect */
> void **aa_1d; /* single indirect */
> } cfs_autoarray_t;
>
> void cfs_aa_init(cfs_autoarray_t *aa); /* setup */
> void cfs_aa_fini(cfs_autoarray_t *aa); /* free all allocated mem */
>
> /* effectively &aa[idx] but you MUST know &aa[idx] exists */
> void **cfs_aa_index(cfs_autoarray_t *aa, unsigned int idx);
>
> /* effectively &aa[idx] - return NULL if &aa[idx] doesn't exist and 'grow' is
> * FALSE */
> void **cfs_aa_lookup(cfs_autoarray_t *aa, unsigned int idx, int grow);
>
why not move obdclass/class_hash into libcfs and use for lnet also ?
now it really generic code and can be easy moved info libcfs.
also if lookup algorithm in class_hash not good for work with 10^6
elements, this need to be adjusted for all usages.
--
Alex Lyashkov <Alexey.lyashkov@sun.com>
Lustre Group, Sun Microsystems
prev parent reply other threads:[~2008-01-05 12:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-04 13:37 [Lustre-devel] 2 primitives for the NRS Eric Barton
2008-01-04 17:00 ` Weikuan Yu
2008-01-04 18:19 ` Eric Barton
2008-01-04 17:40 ` Lee Ward
2008-01-04 17:51 ` Eric Barton
2008-01-04 18:36 ` Eric Barton
2008-01-05 0:36 ` Lee Ward
2008-01-05 12:19 ` Alex Lyashkov [this message]
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=1199535582.16449.6.camel@bear.shadowland \
--to=alexey.lyashkov@sun.com \
--cc=lustre-devel@lists.lustre.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.