forked from mirrors/linux
		
	closures: closure_nr_remaining()
Factor out a new helper, which returns the number of events outstanding. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
		
							parent
							
								
									ced58fc7ab
								
							
						
					
					
						commit
						48b7935722
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -172,6 +172,11 @@ void __closure_wake_up(struct closure_waitlist *list); | ||||||
| bool closure_wait(struct closure_waitlist *list, struct closure *cl); | bool closure_wait(struct closure_waitlist *list, struct closure *cl); | ||||||
| void __closure_sync(struct closure *cl); | void __closure_sync(struct closure *cl); | ||||||
| 
 | 
 | ||||||
|  | static inline unsigned closure_nr_remaining(struct closure *cl) | ||||||
|  | { | ||||||
|  | 	return atomic_read(&cl->remaining) & CLOSURE_REMAINING_MASK; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /**
 | /**
 | ||||||
|  * closure_sync - sleep until a closure a closure has nothing left to wait on |  * closure_sync - sleep until a closure a closure has nothing left to wait on | ||||||
|  * |  * | ||||||
|  | @ -180,7 +185,7 @@ void __closure_sync(struct closure *cl); | ||||||
|  */ |  */ | ||||||
| static inline void closure_sync(struct closure *cl) | static inline void closure_sync(struct closure *cl) | ||||||
| { | { | ||||||
| 	if ((atomic_read(&cl->remaining) & CLOSURE_REMAINING_MASK) != 1) | 	if (closure_nr_remaining(cl) != 1) | ||||||
| 		__closure_sync(cl); | 		__closure_sync(cl); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Kent Overstreet
						Kent Overstreet