Re: [Question] st_blocks of shm is number of pages, not 512B blocks
David Timber <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.file-systems |
|---|---|
| Message-ID | <[email protected]> |
On 8/2/26 22:54, Konstantin Belousov wrote: > The page size as st_blocks multiplier is natural because shm is allocated > in pages. I wanted to return the number of large pages for st_blocks for > the largepage shmfds as well, but somebody argued against it AFAIR. Perhaps shm can implement fstatfs() and return whatever largepage decided in f_bsize? Just a thought. Seems to me that the information is lost from userspace after creating the shm. I wonder if there's a standard interface to query it back after creating it. If not, f_bsize seems to be the candidate. Just a thought. Anyway, I wasn't really nitpicking why FreeBSD does things the way it does. I was just wondering if there's actual use case in userspace where returning st_blocks in system page size unit makes more sense. By that I mean, yes, the page size IS the allocation unit so it makes perfect sense. It saves division and multiplication to do the alignment dance. Me thinks that not being aligned to the usual 512-byte unit with the rest of the implementation does more harm than good... Davo