Date: Sun, 25 Apr 2010 00:05:51 +0000 (UTC) From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r207177 - projects/quota64/libexec/rpc.rquotad Message-ID: <201004250005.o3P05pxN086636@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mckusick Date: Sun Apr 25 00:05:51 2010 New Revision: 207177 URL: http://svn.freebsd.org/changeset/base/207177 Log: 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. Modified: projects/quota64/libexec/rpc.rquotad/rquotad.c Modified: projects/quota64/libexec/rpc.rquotad/rquotad.c ============================================================================== --- projects/quota64/libexec/rpc.rquotad/rquotad.c Sat Apr 24 23:32:24 2010 (r207176) +++ projects/quota64/libexec/rpc.rquotad/rquotad.c Sun Apr 25 00:05:51 2010 (r207177) @@ -126,6 +126,7 @@ sendquota(struct svc_req *request, SVCXP 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, SVCXP 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 =
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004250005.o3P05pxN086636>