aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-10-17 14:25:10 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-10-19 17:24:07 +0000
commit7f055843ac50a8c800f7a1b87641bec5919a46a8 (patch)
tree34e6f84d6b63d4d8bee2338b7a382dddb46b5f75
parentd05e43bc0d5705919d057793aaa3e6d3df65f815 (diff)
downloadsrc-7f055843ac50a8c800f7a1b87641bec5919a46a8.tar.gz
src-7f055843ac50a8c800f7a1b87641bec5919a46a8.zip
tmpfs: change return type of tmpfs_pages_check_avail() to bool
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37024
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 7d589b1c193d..adf31132f82c 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -350,17 +350,17 @@ tmpfs_pages_used(struct tmpfs_mount *tmp)
return (meta_pages + tmp->tm_pages_used);
}
-static size_t
+static bool
tmpfs_pages_check_avail(struct tmpfs_mount *tmp, size_t req_pages)
{
if (tmpfs_mem_avail() < req_pages)
- return (0);
+ return (false);
if (tmp->tm_pages_max != ULONG_MAX &&
tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp))
- return (0);
+ return (false);
- return (1);
+ return (true);
}
static int
@@ -468,7 +468,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type,
if (tmp->tm_nodes_inuse >= tmp->tm_nodes_max)
return (ENOSPC);
- if (tmpfs_pages_check_avail(tmp, 1) == 0)
+ if (!tmpfs_pages_check_avail(tmp, 1))
return (ENOSPC);
if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) {
@@ -1737,7 +1737,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, boolean_t ignerr)
}
if (newpages > oldpages &&
- tmpfs_pages_check_avail(tmp, newpages - oldpages) == 0)
+ !tmpfs_pages_check_avail(tmp, newpages - oldpages))
return (ENOSPC);
VM_OBJECT_WLOCK(uobj);