diff options
author | delphij <delphij@FreeBSD.org> | 2007-06-25 18:46:13 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2007-06-25 18:46:13 +0000 |
commit | a78e2646a20f6b90a2414784899e11a72320701a (patch) | |
tree | d75982c3b0bd235189ed127edaf20c9ab228f399 /sys/fs/tmpfs/tmpfs.h | |
parent | a79676fb6d4640f4add118efa52a7ddb92c08245 (diff) | |
download | FreeBSD-src-a78e2646a20f6b90a2414784899e11a72320701a.zip FreeBSD-src-a78e2646a20f6b90a2414784899e11a72320701a.tar.gz |
MFp4: Several clean-ups and improvements over tmpfs:
- Remove tmpfs_zone_xxx KPI, the uma(9) wrapper, since
they does not bring any value now.
- Use |= instead of = when applying VV_ROOT flag.
- Remove tm_avariable_nodes list. Use uma to hold the
released nodes.
- init/destory interlock mutex of node when init/fini
instead of ctor/dtor.
- Change memory computing using u_int to fix negative
value in 2G mem machine.
- Remove unnecessary bzero's
- Rely uma logic to make file id allocation harder to
guess.
- Fix some unsigned/signed related things. Make sure
we respect -o size=xxxx
- Use wire instead of hold a page.
- Pass allocate_zero to obtain zeroed pages upon first
use.
Submitted by: Howard Su
Approved by: re (tmpfs blanket, kensmith)
Diffstat (limited to 'sys/fs/tmpfs/tmpfs.h')
-rw-r--r-- | sys/fs/tmpfs/tmpfs.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 2947b9b..61999e1 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -314,7 +314,6 @@ struct tmpfs_mount { * they will go into the available list, remaining alive until the * file system is unmounted. */ struct tmpfs_node_list tm_nodes_used; - struct tmpfs_node_list tm_nodes_avail; /* All node lock to protect the node list and tmp_pages_used */ struct mtx allnode_lock; @@ -470,10 +469,14 @@ TMPFS_PAGES_MAX(struct tmpfs_mount *tmp) } /* Returns the available space for the given file system. */ -#define TMPFS_META_SIZE(tmp) ((tmp)->tm_nodes_inuse * (sizeof(struct tmpfs_node) \ - + sizeof(struct dirent))) -#define TMPFS_PAGES_AVAIL(tmp) (TMPFS_PAGES_MAX(tmp) - (tmp)->tm_pages_used - \ - TMPFS_META_SIZE(tmp) / PAGE_SIZE - 1) +#define TMPFS_META_PAGES(tmp) ((tmp)->tm_nodes_inuse * (sizeof(struct tmpfs_node) \ + + sizeof(struct tmpfs_dirent))/PAGE_SIZE + 1) +#define TMPFS_FILE_PAGES(tmp) ((tmp)->tm_pages_used) + +#define TMPFS_PAGES_AVAIL(tmp) (TMPFS_PAGES_MAX(tmp) > \ + TMPFS_META_PAGES(tmp)+TMPFS_FILE_PAGES(tmp)? \ + TMPFS_PAGES_MAX(tmp) - TMPFS_META_PAGES(tmp) \ + - TMPFS_FILE_PAGES(tmp):0) #endif |