Greetings
[I'm not positive whether I should post this here or in the 'storage' forum]
I'm trying to get programmatic access to ZFS quotas, and I'm not finding my questions answered by what seem to be the relevant manpages -- specifically quotactl(2) on 14.0.
Puzzle 1 is that the manpage states bluntly that ‘Currently quotas are supported only for the "ufs" file system.’ But (a) bug 234413 from 2019/12.0, states that ‘ZFS implements quotactl(2) as of r336017; the man page needs to be updated.’ Also (b) quotactl does seem to work. Question: does this work only by accident? (ie, it's going to stop working unexpectedly!) Is there a manpage I'm missing? Should I just open up a docbug report?
The program below works, in the sense that it produces numbers which are right if the block-size is 512kB. But I can find nothing, neither in quotactl() nor in ufs/ufs/quota.h, which tells me that unequivocally, and in a way which I'm confident will work on a pool with a different ashift value.
[I'm not positive whether I should post this here or in the 'storage' forum]
I'm trying to get programmatic access to ZFS quotas, and I'm not finding my questions answered by what seem to be the relevant manpages -- specifically quotactl(2) on 14.0.
Puzzle 1 is that the manpage states bluntly that ‘Currently quotas are supported only for the "ufs" file system.’ But (a) bug 234413 from 2019/12.0, states that ‘ZFS implements quotactl(2) as of r336017; the man page needs to be updated.’ Also (b) quotactl does seem to work. Question: does this work only by accident? (ie, it's going to stop working unexpectedly!) Is there a manpage I'm missing? Should I just open up a docbug report?
The program below works, in the sense that it produces numbers which are right if the block-size is 512kB. But I can find nothing, neither in quotactl() nor in ufs/ufs/quota.h, which tells me that unequivocally, and in a way which I'm confident will work on a pool with a different ashift value.
Code:
...
#include <ufs/ufs/quota.h>
int main(int argc, char** argv)
{
struct dqblk quota_info;
int status = quotactl("/home/me",
QCMD(Q_GETQUOTA, USRQUOTA),
-1,
"a_info);
if (status != 0) {
perror(argv[0]);
exit(1);
}
printf("hard=%ld soft=%ld, used=%ld\n",
quota_info.dqb_bhardlimit,
quota_info.dqb_bsoftlimit,
quota_info.dqb_curblocks);
}