diff options
author | mckusick <mckusick@FreeBSD.org> | 2010-04-25 00:05:51 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2010-04-25 00:05:51 +0000 |
commit | f40c3a9dc50f808e512fcc9f9f738717013b483b (patch) | |
tree | 6bc6ff802ba7031f5951b92a7d6f6f11bed1ca04 /libexec/rpc.rquotad/rquotad.c | |
parent | f63b97928b6dff04ed1652eee2d75a7577479818 (diff) | |
download | FreeBSD-src-f40c3a9dc50f808e512fcc9f9f738717013b483b.zip FreeBSD-src-f40c3a9dc50f808e512fcc9f9f738717013b483b.tar.gz |
The NFS quota-reporting RPC uses 32-bit sized fields. We approximate
64-bit quota sizes by scaling down the sizes by the minimum amount
necessary to fit in a 32-bit field and then upscale the filesystem
block size to compensate. For example, if the hard block limit is
0x300000008 then we set the hard block limit to 0xA0000002 and claim
that the blocksize is 4 * DEV_BSIZE. This will lose the minimal
amount of information thus delivering nearly correct answers.
Diffstat (limited to 'libexec/rpc.rquotad/rquotad.c')
-rw-r--r-- | libexec/rpc.rquotad/rquotad.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libexec/rpc.rquotad/rquotad.c b/libexec/rpc.rquotad/rquotad.c index 3cd1292..d9ce06a 100644 --- a/libexec/rpc.rquotad/rquotad.c +++ b/libexec/rpc.rquotad/rquotad.c @@ -126,6 +126,7 @@ sendquota(struct svc_req *request, SVCXPRT *transp) struct getquota_rslt getq_rslt; struct dqblk dqblk; struct timeval timev; + int scale; bzero(&getq_args, sizeof(getq_args)); if (!svc_getargs(transp, (xdrproc_t)xdr_getquota_args, &getq_args)) { @@ -142,13 +143,15 @@ sendquota(struct svc_req *request, SVCXPRT *transp) gettimeofday(&timev, NULL); getq_rslt.status = Q_OK; getq_rslt.getquota_rslt_u.gqr_rquota.rq_active = TRUE; - getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize = DEV_BSIZE; + scale = 1 << flsll(dqblk.dqb_bhardlimit >> 32); + getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize = + DEV_BSIZE * scale; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit = - dqblk.dqb_bhardlimit; + dqblk.dqb_bhardlimit / scale; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit = - dqblk.dqb_bsoftlimit; + dqblk.dqb_bsoftlimit / scale; getq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks = - dqblk.dqb_curblocks; + dqblk.dqb_curblocks / scale; getq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit = dqblk.dqb_ihardlimit; getq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit = |