git: 7f055843ac50 - main - tmpfs: change return type of tmpfs_pages_check_avail() to bool
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 19 Oct 2022 17:24:17 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f055843ac50a8c800f7a1b87641bec5919a46a8 commit 7f055843ac50a8c800f7a1b87641bec5919a46a8 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-10-17 14:25:10 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-10-19 17:24:07 +0000 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 --- sys/fs/tmpfs/tmpfs_subr.c | 12 ++++++------ 1 file 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);