Commit cd87e8a
committed
fs: expose frsize field in statfs results
Node.js statfs() exposes bsize (optimal I/O block size) but not frsize
(fundamental filesystem block size). Per POSIX, block counts (blocks,
bfree, bavail) are in units of frsize, not bsize. libuv already reads
f_frsize from the kernel — it was simply not mapped to JavaScript.
On most native filesystems bsize == frsize, so the omission was
harmless. However, on FUSE mounts (e.g. Docker Desktop on macOS with
VirtioFS or gRPC FUSE), they can differ by orders of magnitude
(bsize=2MiB vs frsize=16KiB), causing applications that compute disk
space as bsize*blocks to report wildly inflated values.
This commit adds the frsize property to the StatFs object returned by
fs.statfs(), fs.statfsSync(), and fsPromises.statfs(), in both normal
and bigint modes.1 parent bdf75a6 commit cd87e8a
File tree
6 files changed
+25
-4
lines changed- doc/api
- lib/internal/fs
- src
- test/parallel
6 files changed
+25
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7899 | 7899 | | |
7900 | 7900 | | |
7901 | 7901 | | |
7902 | | - | |
| 7902 | + | |
| 7903 | + | |
7903 | 7904 | | |
7904 | 7905 | | |
7905 | 7906 | | |
| |||
7913 | 7914 | | |
7914 | 7915 | | |
7915 | 7916 | | |
7916 | | - | |
| 7917 | + | |
| 7918 | + | |
7917 | 7919 | | |
7918 | 7920 | | |
7919 | 7921 | | |
| |||
7989 | 7991 | | |
7990 | 7992 | | |
7991 | 7993 | | |
| 7994 | + | |
| 7995 | + | |
| 7996 | + | |
| 7997 | + | |
| 7998 | + | |
| 7999 | + | |
| 8000 | + | |
| 8001 | + | |
| 8002 | + | |
| 8003 | + | |
| 8004 | + | |
| 8005 | + | |
| 8006 | + | |
| 8007 | + | |
7992 | 8008 | | |
7993 | 8009 | | |
7994 | 8010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | | - | |
| 574 | + | |
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| 582 | + | |
582 | 583 | | |
583 | 584 | | |
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
587 | 588 | | |
| 589 | + | |
588 | 590 | | |
589 | 591 | | |
590 | 592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments