diff options
author | Eric van Gyzen <vangyzen@FreeBSD.org> | 2020-09-18 16:48:08 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2020-09-18 16:48:08 +0000 |
commit | f9cc8410e16ab0870c218b7a9541464ef10a8d34 (patch) | |
tree | 70cab1a48a5c749a8b8d98b017db20d8f4dd42a7 /sys/fs/tmpfs/tmpfs_subr.c | |
parent | 6dadc5d1cdec44cad788c3cc5135ddb858885212 (diff) | |
download | src-f9cc8410e16ab0870c218b7a9541464ef10a8d34.tar.gz src-f9cc8410e16ab0870c218b7a9541464ef10a8d34.zip |
vm_ooffset_t is now unsigned
vm_ooffset_t is now unsigned. Remove some tests for negative values,
or make other adjustments accordingly.
Reported by: Coverity
Reviewed by: kib markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26214
Notes
Notes:
svn path=/head/; revision=365886
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_subr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 0068656968b5..e454f45a089f 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -178,12 +178,14 @@ RB_PROTOTYPE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_entries, tmpfs_dirtree_cmp); size_t tmpfs_mem_avail(void) { - vm_ooffset_t avail; + size_t avail; + long reserved; - avail = swap_pager_avail + vm_free_count() - tmpfs_pages_reserved; - if (__predict_false(avail < 0)) - avail = 0; - return (avail); + avail = swap_pager_avail + vm_free_count(); + reserved = atomic_load_long(&tmpfs_pages_reserved); + if (__predict_false(avail < reserved)) + return (0); + return (avail - reserved); } size_t |