First, struct file size is 80 bytes. There is an unused field at the end added in 2005:
```
ommit d2c9006fb572d62b689561459965dc5b05674746
Author: rwatson <rwatson@FreeBSD.org>
Date: Wed Feb 2 10:55:32 2005 +0000
Add a place-holder f_label void * for a future struct label pointer
required for the port of SELinux FLASK/TE to FreeBSD using the MAC
Framework.
diff --git a/sys/sys/file.h b/sys/sys/file.h
index d3a9e9f2df1..febbf4d9d27 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -131,6 +131,7 @@ struct file {
off_t f_nextoff; /*
* offset of next expected read or write
*/
+ void *f_label; /* Place-holder for struct label pointer. */
};
#endif /* _KERNEL */
```
With this removed we can expand f_count from int to long with keeping the total size of 80 bytes (with 4 bytes of padding). Some fields can be made smaller but not enough to fit the extra 4 bytes.
Motivation for the change is 2 fold:
- range changes were added to account for legitimate overflows. 32-bit should be more than big enough for 32-bit machines, while 64-bit is of course way more than necessary to aovid overflows
- the refcount API grows extra features which not only add work for this consumer (which does not use them), but also reduce the range
With the switch to pure long-sized atomics full range is restored (and more) and there is less work to do.