From owner-svn-src-projects@FreeBSD.ORG Sun Apr 25 00:05:51 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3275106564A; Sun, 25 Apr 2010 00:05:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2E8F8FC12; Sun, 25 Apr 2010 00:05:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3P05p4u086638; Sun, 25 Apr 2010 00:05:51 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3P05pxN086636; Sun, 25 Apr 2010 00:05:51 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201004250005.o3P05pxN086636@svn.freebsd.org> From: Kirk McKusick Date: Sun, 25 Apr 2010 00:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207177 - projects/quota64/libexec/rpc.rquotad X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2010 00:05:52 -0000 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 =