mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +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:
committed by
Tony Hutter
parent
9e5a297de6
commit
3ad6c1692f
@@ -62,7 +62,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
|
||||
__field(uint32_t, z_async_writes_cnt)
|
||||
__field(mode_t, z_mode)
|
||||
__field(boolean_t, z_is_sa)
|
||||
__field(boolean_t, z_is_mapped)
|
||||
__field(boolean_t, z_is_ctldir)
|
||||
|
||||
__field(uint32_t, i_uid)
|
||||
@@ -96,7 +95,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
|
||||
__entry->z_async_writes_cnt = zn->z_async_writes_cnt;
|
||||
__entry->z_mode = zn->z_mode;
|
||||
__entry->z_is_sa = zn->z_is_sa;
|
||||
__entry->z_is_mapped = zn->z_is_mapped;
|
||||
__entry->z_is_ctldir = zn->z_is_ctldir;
|
||||
|
||||
__entry->i_uid = KUID_TO_SUID(ZTOI(zn)->i_uid);
|
||||
@@ -119,8 +117,8 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
|
||||
"zn_prefetch %u blksz %u seq %u "
|
||||
"mapcnt %llu size %llu pflags %llu "
|
||||
"sync_cnt %u sync_writes_cnt %u async_writes_cnt %u "
|
||||
"mode 0x%x is_sa %d is_mapped %d is_ctldir %d inode { "
|
||||
"uid %u gid %u ino %lu nlink %u size %lli "
|
||||
"mode 0x%x is_sa %d is_ctldir %d "
|
||||
"inode { uid %u gid %u ino %lu nlink %u size %lli "
|
||||
"blkbits %u bytes %u mode 0x%x generation %x } } "
|
||||
"ace { type %u flags %u access_mask %u } mask_matched %u",
|
||||
__entry->z_id, __entry->z_unlinked, __entry->z_atime_dirty,
|
||||
@@ -128,9 +126,8 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
|
||||
__entry->z_seq, __entry->z_mapcnt, __entry->z_size,
|
||||
__entry->z_pflags, __entry->z_sync_cnt,
|
||||
__entry->z_sync_writes_cnt, __entry->z_async_writes_cnt,
|
||||
__entry->z_mode, __entry->z_is_sa, __entry->z_is_mapped,
|
||||
__entry->z_is_ctldir, __entry->i_uid,
|
||||
__entry->i_gid, __entry->i_ino, __entry->i_nlink,
|
||||
__entry->z_mode, __entry->z_is_sa, __entry->z_is_ctldir,
|
||||
__entry->i_uid, __entry->i_gid, __entry->i_ino, __entry->i_nlink,
|
||||
__entry->i_size, __entry->i_blkbits,
|
||||
__entry->i_bytes, __entry->i_mode, __entry->i_generation,
|
||||
__entry->z_type, __entry->z_flags, __entry->z_access_mask,
|
||||
|
||||
@@ -47,9 +47,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FILEMAP_RANGE_HAS_PAGE)
|
||||
#define ZNODE_OS_FIELDS \
|
||||
inode_timespec_t z_btime; /* creation/birth time (cached) */ \
|
||||
struct inode z_inode;
|
||||
#else
|
||||
#define ZNODE_OS_FIELDS \
|
||||
inode_timespec_t z_btime; /* creation/birth time (cached) */ \
|
||||
struct inode z_inode; \
|
||||
boolean_t z_is_mapped; /* we are mmap'ed */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert between znode pointers and inode pointers
|
||||
@@ -70,7 +77,14 @@ extern "C" {
|
||||
#define Z_ISDEV(type) (S_ISCHR(type) || S_ISBLK(type) || S_ISFIFO(type))
|
||||
#define Z_ISDIR(type) S_ISDIR(type)
|
||||
|
||||
#define zn_has_cached_data(zp) ((zp)->z_is_mapped)
|
||||
#if defined(HAVE_FILEMAP_RANGE_HAS_PAGE)
|
||||
#define zn_has_cached_data(zp, start, end) \
|
||||
filemap_range_has_page(ZTOI(zp)->i_mapping, start, end)
|
||||
#else
|
||||
#define zn_has_cached_data(zp, start, end) \
|
||||
((zp)->z_is_mapped)
|
||||
#endif
|
||||
|
||||
#define zn_flush_cached_data(zp, sync) write_inode_now(ZTOI(zp), sync)
|
||||
#define zn_rlimit_fsize(zp, uio) (0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user