Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/tmpfs/tmpfs_subr.c
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | |||||
static __inline int tmpfs_dirtree_cmp(struct tmpfs_dirent *a, | static __inline int tmpfs_dirtree_cmp(struct tmpfs_dirent *a, | ||||
struct tmpfs_dirent *b); | struct tmpfs_dirent *b); | ||||
RB_PROTOTYPE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_entries, tmpfs_dirtree_cmp); | RB_PROTOTYPE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_entries, tmpfs_dirtree_cmp); | ||||
size_t | size_t | ||||
tmpfs_mem_avail(void) | tmpfs_mem_avail(void) | ||||
{ | { | ||||
vm_ooffset_t avail; | size_t avail; | ||||
long reserved; | |||||
avail = swap_pager_avail + vm_free_count() - tmpfs_pages_reserved; | avail = swap_pager_avail + vm_free_count(); | ||||
if (__predict_false(avail < 0)) | reserved = atomic_load_long(&tmpfs_pages_reserved); | ||||
avail = 0; | if (__predict_false(avail < reserved)) | ||||
return (avail); | return (0); | ||||
return (avail - reserved); | |||||
} | } | ||||
size_t | size_t | ||||
tmpfs_pages_used(struct tmpfs_mount *tmp) | tmpfs_pages_used(struct tmpfs_mount *tmp) | ||||
{ | { | ||||
const size_t node_size = sizeof(struct tmpfs_node) + | const size_t node_size = sizeof(struct tmpfs_node) + | ||||
sizeof(struct tmpfs_dirent); | sizeof(struct tmpfs_dirent); | ||||
size_t meta_pages; | size_t meta_pages; | ||||
▲ Show 20 Lines • Show All 1,757 Lines • Show Last 20 Lines |