Messages in this thread | | | Date | Sat, 28 Aug 2004 02:34:36 -0700 | From | Andrew Morton <> | Subject | Re: [2/4] consolidate bit waiting code patterns |
| |
William Lee Irwin III <wli@holomorphy.com> wrote: > > +int __sched __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, > + void *word, int bit, > + int (*wait)(void *), unsigned mode) > +{ > + int ret; > + > + while (test_and_set_bit(bit, word)) { > + prepare_to_wait_exclusive(wq, &q->wait, mode); > + if (test_bit(bit, word)) { > + if ((ret = (*wait)(word))) > + return ret; > + } > + } > + finish_wait(wq, &q->wait); > + return 0; > +}
Some comments over this thing would be nice.
The `wait' argument seems to be misnamed. It typically points at sync_page(), yes? Maybe it should be called `action' or `kick' or something.
If (*wait)() returns non-zero then it looks to me like the callers will get confused, thinking that the page did come unlocked?
If (*wait)() returns non-zero then we need to run finish_wait(), no? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |