summaryrefslogtreecommitdiffstats
path: root/sys/cddl/compat
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-09-15 11:05:41 +0000
committeravg <avg@FreeBSD.org>2010-09-15 11:05:41 +0000
commit4e51477b36cc4638e5042d3f7de0cb10f1219def (patch)
tree1d99215d453c0058048f67ff897983a4402dd011 /sys/cddl/compat
parent23cfa76cb657f044e8e8fc40646566230d74deaa (diff)
downloadFreeBSD-src-4e51477b36cc4638e5042d3f7de0cb10f1219def.zip
FreeBSD-src-4e51477b36cc4638e5042d3f7de0cb10f1219def.tar.gz
zfs vn_has_cached_data: take into account v_object->cache != NULL
This mirrors code in tmpfs. This changge shouldn't affect much read path, it may cause unnecessary vm_page_lookup calls in the case where v_object has no active or inactive pages but has some cache pages. I believe this situation to be non-essential. In write path this change should allow us to properly detect the above case and free a cache page when we write to a range that corresponds to it. If this situation is undetected then we could have a discrepancy between data in page cache and in ARC or on disk. This change allows us to re-enable vn_has_cached_data() check in zfs_write. NOTE: strictly speaking resident_page_count and cache fields of v_object should be exmined under VM_OBJECT_LOCK, but for this particular usage we may get away with it. Discussed with: alc, kib Approved by: pjd Tested with: tools/regression/fsx MFC after: 3 weeks
Diffstat (limited to 'sys/cddl/compat')
-rw-r--r--sys/cddl/compat/opensolaris/sys/vnode.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/vnode.h b/sys/cddl/compat/opensolaris/sys/vnode.h
index 1d46956..bdf0623 100644
--- a/sys/cddl/compat/opensolaris/sys/vnode.h
+++ b/sys/cddl/compat/opensolaris/sys/vnode.h
@@ -69,7 +69,9 @@ vn_is_readonly(vnode_t *vp)
#define vn_vfsunlock(vp) do { } while (0)
#define vn_ismntpt(vp) ((vp)->v_type == VDIR && (vp)->v_mountedhere != NULL)
#define vn_mountedvfs(vp) ((vp)->v_mountedhere)
-#define vn_has_cached_data(vp) ((vp)->v_object != NULL && (vp)->v_object->resident_page_count > 0)
+#define vn_has_cached_data(vp) \
+ ((vp)->v_object != NULL && ((vp)->v_object->resident_page_count > 0 \
+ || (vp)->v_object->cache != NULL))
#define vn_exists(vp) do { } while (0)
#define vn_invalid(vp) do { } while (0)
#define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0)
OpenPOWER on IntegriCloud