lkml.org 
[lkml]   [2016]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/3] radix-tree: support locking of individual exception entries.
On Sun, Feb 28 2016, NeilBrown <neilb@suse.com> wrote:

> +static int wake_slot_function(wait_queue_t *wait, unsigned mode, int sync,
> + void *arg)
> +{
> + struct wait_bit_key *key = arg;
> + struct wait_slot_queue *wait_slot =
> + container_of(wait, struct wait_slot_queue, wait);
> + void **slot;
> +
> + if (wait_slot->root != key->flags ||
> + wait_slot->index != key->timeout)
> + /* Not waking this waiter */
> + return 0;
> + if (wait_slot->state != SLOT_WAITING)
> + /* Should be impossible.... */
> + return 1;
> + if (key->bit_nr == -3)
> + /* Was just deleted, no point in doing a lookup */
> + wait_slot = NULL;
> + else
> + wait_slot->ret = __radix_tree_lookup(
> + wait_slot->root, wait_slot->index, NULL, &slot);
> + if (!wait_slot->ret || !radix_tree_exceptional_entry(wait_slot->ret)) {
> + wait_slot->state = SLOT_GONE;
> + return 1;
> + }
> + if (slot_locked(slot))
> + /* still locked */
> + return 0;
> + wait_slot->ret = lock_slot(slot);
> + wait_slot->state = SLOT_LOCKED;
> + return 1;
> +}

Sorry, just realized that this should:
return autoremove_wake_function(wait, mode, sync, arg);

instead of "return 1;"

NeilBrown
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-02-28 08:01    [W:0.176 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site