mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	xfs: Implement xfs_filemap_pfn_mkwrite() using __xfs_filemap_fault()
xfs_filemap_pfn_mkwrite() duplicates a lot of __xfs_filemap_fault(). It will also need to handle flushing for synchronous page faults. So just make that function use __xfs_filemap_fault(). Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
		
							parent
							
								
									b8a6176c21
								
							
						
					
					
						commit
						7b565c9f96
					
				
					 2 changed files with 4 additions and 27 deletions
				
			
		|  | @ -1085,37 +1085,16 @@ xfs_filemap_page_mkwrite( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * pfn_mkwrite was originally inteneded to ensure we capture time stamp |  * pfn_mkwrite was originally intended to ensure we capture time stamp updates | ||||||
|  * updates on write faults. In reality, it's need to serialise against |  * on write faults. In reality, it needs to serialise against truncate and | ||||||
|  * truncate similar to page_mkwrite. Hence we cycle the XFS_MMAPLOCK_SHARED |  * prepare memory for writing so handle is as standard write fault. | ||||||
|  * to ensure we serialise the fault barrier in place. |  | ||||||
|  */ |  */ | ||||||
| static int | static int | ||||||
| xfs_filemap_pfn_mkwrite( | xfs_filemap_pfn_mkwrite( | ||||||
| 	struct vm_fault		*vmf) | 	struct vm_fault		*vmf) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| 	struct inode		*inode = file_inode(vmf->vma->vm_file); | 	return __xfs_filemap_fault(vmf, PE_SIZE_PTE, true); | ||||||
| 	struct xfs_inode	*ip = XFS_I(inode); |  | ||||||
| 	int			ret = VM_FAULT_NOPAGE; |  | ||||||
| 	loff_t			size; |  | ||||||
| 
 |  | ||||||
| 	trace_xfs_filemap_pfn_mkwrite(ip); |  | ||||||
| 
 |  | ||||||
| 	sb_start_pagefault(inode->i_sb); |  | ||||||
| 	file_update_time(vmf->vma->vm_file); |  | ||||||
| 
 |  | ||||||
| 	/* check if the faulting page hasn't raced with truncate */ |  | ||||||
| 	xfs_ilock(ip, XFS_MMAPLOCK_SHARED); |  | ||||||
| 	size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; |  | ||||||
| 	if (vmf->pgoff >= size) |  | ||||||
| 		ret = VM_FAULT_SIGBUS; |  | ||||||
| 	else if (IS_DAX(inode)) |  | ||||||
| 		ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, &xfs_iomap_ops); |  | ||||||
| 	xfs_iunlock(ip, XFS_MMAPLOCK_SHARED); |  | ||||||
| 	sb_end_pagefault(inode->i_sb); |  | ||||||
| 	return ret; |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static const struct vm_operations_struct xfs_file_vm_ops = { | static const struct vm_operations_struct xfs_file_vm_ops = { | ||||||
|  |  | ||||||
|  | @ -688,8 +688,6 @@ DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag); | ||||||
| DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag); | DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag); | ||||||
| DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid); | DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid); | ||||||
| 
 | 
 | ||||||
| DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite); |  | ||||||
| 
 |  | ||||||
| TRACE_EVENT(xfs_filemap_fault, | TRACE_EVENT(xfs_filemap_fault, | ||||||
| 	TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size, | 	TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size, | ||||||
| 		 bool write_fault), | 		 bool write_fault), | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Jan Kara
						Jan Kara