mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
Linux: use filemap_range_has_page()
As of the 4.13 kernel filemap_range_has_page() can be used to check if there is a page mapped in a given file range. When available this interface should be used which eliminates the need for the zp->z_is_mapped boolean. Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #14493
This commit is contained in:
@@ -625,7 +625,6 @@ static int
|
||||
zpl_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct inode *ip = filp->f_mapping->host;
|
||||
znode_t *zp = ITOZ(ip);
|
||||
int error;
|
||||
fstrans_cookie_t cookie;
|
||||
|
||||
@@ -640,9 +639,12 @@ zpl_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
#if !defined(HAVE_FILEMAP_RANGE_HAS_PAGE)
|
||||
znode_t *zp = ITOZ(ip);
|
||||
mutex_enter(&zp->z_lock);
|
||||
zp->z_is_mapped = B_TRUE;
|
||||
mutex_exit(&zp->z_lock);
|
||||
#endif
|
||||
|
||||
return (error);
|
||||
}
|
||||
@@ -937,7 +939,7 @@ zpl_fadvise(struct file *filp, loff_t offset, loff_t len, int advice)
|
||||
case POSIX_FADV_SEQUENTIAL:
|
||||
case POSIX_FADV_WILLNEED:
|
||||
#ifdef HAVE_GENERIC_FADVISE
|
||||
if (zn_has_cached_data(zp))
|
||||
if (zn_has_cached_data(zp, offset, offset + len - 1))
|
||||
error = generic_fadvise(filp, offset, len, advice);
|
||||
#endif
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user