mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 15:01:13 +07:00
69eb5fa10e
When xfs is operating as the back-end of a pNFS block server, it prevents collisions between local and remote operations by requiring a lease to be held for remotely accessed blocks. Local filesystem operations break those leases before writing or mutating the extent map of the file. A similar mechanism is needed to prevent operations on pinned dax mappings, like device-DMA, from colliding with extent unmap operations. BREAK_WRITE and BREAK_UNMAP are introduced as two distinct levels of layout breaking. Layouts are broken in the BREAK_WRITE case to ensure that layout-holders do not collide with local writes. Additionally, layouts are broken in the BREAK_UNMAP case to make sure the layout-holder has a consistent view of the file's extent map. While BREAK_WRITE breaks can be satisfied be recalling FL_LAYOUT leases, BREAK_UNMAP breaks additionally require waiting for busy dax-pages to go idle while holding XFS_MMAPLOCK_EXCL. After this refactoring xfs_break_layouts() becomes the entry point for coordinating both types of breaks. Finally, xfs_break_leased_layouts() becomes just the BREAK_WRITE handler. Note that the unlock tracking is needed in a follow on change. That will coordinate retrying either break handler until both successfully test for a lease break while maintaining the lock state. Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: "Darrick J. Wong" <darrick.wong@oracle.com> Reported-by: Dave Chinner <david@fromorbit.com> Reported-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
22 lines
692 B
C
22 lines
692 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _XFS_PNFS_H
|
|
#define _XFS_PNFS_H 1
|
|
|
|
#ifdef CONFIG_EXPORTFS_BLOCK_OPS
|
|
int xfs_fs_get_uuid(struct super_block *sb, u8 *buf, u32 *len, u64 *offset);
|
|
int xfs_fs_map_blocks(struct inode *inode, loff_t offset, u64 length,
|
|
struct iomap *iomap, bool write, u32 *device_generation);
|
|
int xfs_fs_commit_blocks(struct inode *inode, struct iomap *maps, int nr_maps,
|
|
struct iattr *iattr);
|
|
|
|
int xfs_break_leased_layouts(struct inode *inode, uint *iolock,
|
|
bool *did_unlock);
|
|
#else
|
|
static inline int
|
|
xfs_break_leased_layouts(struct inode *inode, uint *iolock, bool *did_unlock)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_EXPORTFS_BLOCK_OPS */
|
|
#endif /* _XFS_PNFS_H */
|