mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	inode: port __I_LRU_ISOLATING to var event
Port the __I_LRU_ISOLATING mechanism to use the new var event mechanism. Link: https://lore.kernel.org/r/20240823-work-i_state-v3-5-5cd5fd207a57@kernel.org Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
		
							parent
							
								
									0fe340a98b
								
							
						
					
					
						commit
						f469e6e6f5
					
				
					 1 changed files with 20 additions and 9 deletions
				
			
		
							
								
								
									
										29
									
								
								fs/inode.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								fs/inode.c
									
									
									
									
									
								
							|  | @ -511,24 +511,35 @@ static void inode_unpin_lru_isolating(struct inode *inode) | ||||||
| 	spin_lock(&inode->i_lock); | 	spin_lock(&inode->i_lock); | ||||||
| 	WARN_ON(!(inode->i_state & I_LRU_ISOLATING)); | 	WARN_ON(!(inode->i_state & I_LRU_ISOLATING)); | ||||||
| 	inode->i_state &= ~I_LRU_ISOLATING; | 	inode->i_state &= ~I_LRU_ISOLATING; | ||||||
| 	smp_mb(); | 	/* Called with inode->i_lock which ensures memory ordering. */ | ||||||
| 	wake_up_bit(&inode->i_state, __I_LRU_ISOLATING); | 	inode_wake_up_bit(inode, __I_LRU_ISOLATING); | ||||||
| 	spin_unlock(&inode->i_lock); | 	spin_unlock(&inode->i_lock); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void inode_wait_for_lru_isolating(struct inode *inode) | static void inode_wait_for_lru_isolating(struct inode *inode) | ||||||
| { | { | ||||||
| 	lockdep_assert_held(&inode->i_lock); | 	struct wait_bit_queue_entry wqe; | ||||||
| 	if (inode->i_state & I_LRU_ISOLATING) { | 	struct wait_queue_head *wq_head; | ||||||
| 		DEFINE_WAIT_BIT(wq, &inode->i_state, __I_LRU_ISOLATING); |  | ||||||
| 		wait_queue_head_t *wqh; |  | ||||||
| 
 | 
 | ||||||
| 		wqh = bit_waitqueue(&inode->i_state, __I_LRU_ISOLATING); | 	lockdep_assert_held(&inode->i_lock); | ||||||
|  | 	if (!(inode->i_state & I_LRU_ISOLATING)) | ||||||
|  | 		return; | ||||||
|  | 
 | ||||||
|  | 	wq_head = inode_bit_waitqueue(&wqe, inode, __I_LRU_ISOLATING); | ||||||
|  | 	for (;;) { | ||||||
|  | 		prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE); | ||||||
|  | 		/*
 | ||||||
|  | 		 * Checking I_LRU_ISOLATING with inode->i_lock guarantees | ||||||
|  | 		 * memory ordering. | ||||||
|  | 		 */ | ||||||
|  | 		if (!(inode->i_state & I_LRU_ISOLATING)) | ||||||
|  | 			break; | ||||||
| 		spin_unlock(&inode->i_lock); | 		spin_unlock(&inode->i_lock); | ||||||
| 		__wait_on_bit(wqh, &wq, bit_wait, TASK_UNINTERRUPTIBLE); | 		schedule(); | ||||||
| 		spin_lock(&inode->i_lock); | 		spin_lock(&inode->i_lock); | ||||||
| 		WARN_ON(inode->i_state & I_LRU_ISOLATING); |  | ||||||
| 	} | 	} | ||||||
|  | 	finish_wait(wq_head, &wqe.wq_entry); | ||||||
|  | 	WARN_ON(inode->i_state & I_LRU_ISOLATING); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Christian Brauner
						Christian Brauner