Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

posix-timers: convert to idr_alloc()

Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Tejun Heo and committed by
Linus Torvalds
ee94d523 0e9c3be2

+8 -10
+8 -10
kernel/posix-timers.c
··· 552 552 return -EAGAIN; 553 553 554 554 spin_lock_init(&new_timer->it_lock); 555 - retry: 556 - if (unlikely(!idr_pre_get(&posix_timers_id, GFP_KERNEL))) { 557 - error = -EAGAIN; 558 - goto out; 559 - } 555 + 556 + idr_preload(GFP_KERNEL); 560 557 spin_lock_irq(&idr_lock); 561 - error = idr_get_new(&posix_timers_id, new_timer, &new_timer_id); 558 + error = idr_alloc(&posix_timers_id, new_timer, 0, 0, GFP_NOWAIT); 562 559 spin_unlock_irq(&idr_lock); 563 - if (error) { 564 - if (error == -EAGAIN) 565 - goto retry; 560 + idr_preload_end(); 561 + if (error < 0) { 566 562 /* 567 563 * Weird looking, but we return EAGAIN if the IDR is 568 564 * full (proper POSIX return value for this) 569 565 */ 570 - error = -EAGAIN; 566 + if (error == -ENOSPC) 567 + error = -EAGAIN; 571 568 goto out; 572 569 } 570 + new_timer_id = error; 573 571 574 572 it_id_set = IT_ID_SET; 575 573 new_timer->it_id = (timer_t) new_timer_id;