mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	writeback: wbc_attach_fdatawrite_inode out of line
This allows exporting this high-level interface only while keeping wbc_attach_and_unlock_inode private in fs-writeback.c and unexporting __inode_attach_wb. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20241112054403.1470586-3-hch@lst.de Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
		
							parent
							
								
									4d7485cff5
								
							
						
					
					
						commit
						8182a8b39a
					
				
					 2 changed files with 29 additions and 30 deletions
				
			
		| 
						 | 
					@ -290,7 +290,6 @@ void __inode_attach_wb(struct inode *inode, struct folio *folio)
 | 
				
			||||||
	if (unlikely(cmpxchg(&inode->i_wb, NULL, wb)))
 | 
						if (unlikely(cmpxchg(&inode->i_wb, NULL, wb)))
 | 
				
			||||||
		wb_put(wb);
 | 
							wb_put(wb);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(__inode_attach_wb);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * inode_cgwb_move_to_attached - put the inode onto wb->b_attached list
 | 
					 * inode_cgwb_move_to_attached - put the inode onto wb->b_attached list
 | 
				
			||||||
| 
						 | 
					@ -731,7 +730,7 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb)
 | 
				
			||||||
 * writeback completion, wbc_detach_inode() should be called.  This is used
 | 
					 * writeback completion, wbc_detach_inode() should be called.  This is used
 | 
				
			||||||
 * to track the cgroup writeback context.
 | 
					 * to track the cgroup writeback context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
 | 
					static void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
 | 
				
			||||||
		struct inode *inode)
 | 
							struct inode *inode)
 | 
				
			||||||
	__releases(&inode->i_lock)
 | 
						__releases(&inode->i_lock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -763,7 +762,24 @@ void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
 | 
				
			||||||
	if (unlikely(wb_dying(wbc->wb) && !css_is_dying(wbc->wb->memcg_css)))
 | 
						if (unlikely(wb_dying(wbc->wb) && !css_is_dying(wbc->wb->memcg_css)))
 | 
				
			||||||
		inode_switch_wbs(inode, wbc->wb_id);
 | 
							inode_switch_wbs(inode, wbc->wb_id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(wbc_attach_and_unlock_inode);
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * wbc_attach_fdatawrite_inode - associate wbc and inode for fdatawrite
 | 
				
			||||||
 | 
					 * @wbc: writeback_control of interest
 | 
				
			||||||
 | 
					 * @inode: target inode
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This function is to be used by __filemap_fdatawrite_range(), which is an
 | 
				
			||||||
 | 
					 * alternative entry point into writeback code, and first ensures @inode is
 | 
				
			||||||
 | 
					 * associated with a bdi_writeback and attaches it to @wbc.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void wbc_attach_fdatawrite_inode(struct writeback_control *wbc,
 | 
				
			||||||
 | 
							struct inode *inode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						spin_lock(&inode->i_lock);
 | 
				
			||||||
 | 
						inode_attach_wb(inode, NULL);
 | 
				
			||||||
 | 
						wbc_attach_and_unlock_inode(wbc, inode);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL_GPL(wbc_attach_fdatawrite_inode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * wbc_detach_inode - disassociate wbc from inode and perform foreign detection
 | 
					 * wbc_detach_inode - disassociate wbc from inode and perform foreign detection
 | 
				
			||||||
| 
						 | 
					@ -1228,6 +1244,13 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
 | 
				
			||||||
 | 
										       struct inode *inode)
 | 
				
			||||||
 | 
						__releases(&inode->i_lock)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						spin_unlock(&inode->i_lock);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif	/* CONFIG_CGROUP_WRITEBACK */
 | 
					#endif	/* CONFIG_CGROUP_WRITEBACK */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -213,9 +213,6 @@ static inline void wait_on_inode(struct inode *inode)
 | 
				
			||||||
#include <linux/bio.h>
 | 
					#include <linux/bio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void __inode_attach_wb(struct inode *inode, struct folio *folio);
 | 
					void __inode_attach_wb(struct inode *inode, struct folio *folio);
 | 
				
			||||||
void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
 | 
					 | 
				
			||||||
				 struct inode *inode)
 | 
					 | 
				
			||||||
	__releases(&inode->i_lock);
 | 
					 | 
				
			||||||
void wbc_detach_inode(struct writeback_control *wbc);
 | 
					void wbc_detach_inode(struct writeback_control *wbc);
 | 
				
			||||||
void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page,
 | 
					void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page,
 | 
				
			||||||
			      size_t bytes);
 | 
								      size_t bytes);
 | 
				
			||||||
| 
						 | 
					@ -254,22 +251,8 @@ static inline void inode_detach_wb(struct inode *inode)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					void wbc_attach_fdatawrite_inode(struct writeback_control *wbc,
 | 
				
			||||||
 * wbc_attach_fdatawrite_inode - associate wbc and inode for fdatawrite
 | 
							struct inode *inode);
 | 
				
			||||||
 * @wbc: writeback_control of interest
 | 
					 | 
				
			||||||
 * @inode: target inode
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This function is to be used by __filemap_fdatawrite_range(), which is an
 | 
					 | 
				
			||||||
 * alternative entry point into writeback code, and first ensures @inode is
 | 
					 | 
				
			||||||
 * associated with a bdi_writeback and attaches it to @wbc.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static inline void wbc_attach_fdatawrite_inode(struct writeback_control *wbc,
 | 
					 | 
				
			||||||
					       struct inode *inode)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	spin_lock(&inode->i_lock);
 | 
					 | 
				
			||||||
	inode_attach_wb(inode, NULL);
 | 
					 | 
				
			||||||
	wbc_attach_and_unlock_inode(wbc, inode);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * wbc_init_bio - writeback specific initializtion of bio
 | 
					 * wbc_init_bio - writeback specific initializtion of bio
 | 
				
			||||||
| 
						 | 
					@ -303,13 +286,6 @@ static inline void inode_detach_wb(struct inode *inode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
 | 
					 | 
				
			||||||
					       struct inode *inode)
 | 
					 | 
				
			||||||
	__releases(&inode->i_lock)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	spin_unlock(&inode->i_lock);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static inline void wbc_attach_fdatawrite_inode(struct writeback_control *wbc,
 | 
					static inline void wbc_attach_fdatawrite_inode(struct writeback_control *wbc,
 | 
				
			||||||
					       struct inode *inode)
 | 
										       struct inode *inode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue