lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090502105823.bf27bf22.akpm@linux-foundation.org>
Date:	Sat, 2 May 2009 10:58:23 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Lars Ellenberg <lars.ellenberg@...bit.com>
Cc:	Philipp Reisner <philipp.reisner@...bit.com>,
	linux-kernel@...r.kernel.org, Jens Axboe <jens.axboe@...cle.com>,
	Greg KH <gregkh@...e.de>, Neil Brown <neilb@...e.de>,
	James Bottomley <James.Bottomley@...senPartnership.com>,
	Sam Ravnborg <sam@...nborg.org>, Dave Jones <davej@...hat.com>,
	Nikanth Karthikesan <knikanth@...e.de>,
	Lars Marowsky-Bree <lmb@...e.de>,
	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>,
	Kyle Moffett <kyle@...fetthome.net>,
	Bart Van Assche <bart.vanassche@...il.com>
Subject: Re: [PATCH 02/16] DRBD: lru_cache

On Sat, 2 May 2009 17:26:20 +0200 Lars Ellenberg <lars.ellenberg@...bit.com> wrote:

> in memory structure is
> 
> struct lru_cache {
>         struct list_head active;
>         struct list_head quiet;
>         struct list_head free;
>         size_t element_size;          <-- parameter to "lc_alloc"
>         unsigned int  nr_elements;    <-- parameter to "lc_alloc"
>         unsigned int  new_number;
> 
>         unsigned int used;
>         unsigned long flags;
>         unsigned long hits, misses, starving, dirty, changed;
> 
>         struct lc_element *changing_element; /* just for paranoia */
> 
>         const char *name;
> 
>         struct hlist_head slot[0];
>         /* hash colision chains here, then element storage. */
> };
> 
> so we have fixed size list heads,
> size of a single such "element", to allow the user
> to add small payload;
> number of hash slots and "elements" following this header;
> some counters;
> hlist_slot[0];
> }
> following:
> struct hlist_head[nr_elements];
> array of element_size blobs[nr_elements];
> 
> these "blobs" start with the struct lru_element,
> possibly followed by some user payload.
> 
> the "index" you are asking about later is
> index into that "blob" array,
> and is used primarily to initialize the state of this thing
> from an on-disk representation (the "activity log", "AL"),
> for crash recovery purposes.
> 
> the typecasting is necessary to get from the slot[0] to the "elements"
> skipping the hash slots.
> using "container of" or something like that would obscure the fact that,
> as currently implemented, the "lru_element" _must_ be the first member
> of any payload structure.

I still don't see why the lru_element must be the first member of the
user's outer, containing structure.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ