git: bd6dcf438e70 - stable/13 - tmpfs: change return type of tmpfs_pages_check_avail() to bool
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Oct 2022 00:44:02 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd6dcf438e706d712647d68f0bcb469d6edda75e commit bd6dcf438e706d712647d68f0bcb469d6edda75e Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-10-17 14:25:10 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-10-26 00:43:43 +0000 tmpfs: change return type of tmpfs_pages_check_avail() to bool (cherry picked from commit 7f055843ac50a8c800f7a1b87641bec5919a46a8) --- 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 f60dc81c648c..c278261c9453 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) { @@ -1745,7 +1745,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);