2.3.51: NFSv3 uses multiplication with u64

From: Horst von Brand (vonbrand@pincoya.inf.utfsm.cl)
Date: Tue Mar 14 2000 - 15:31:10 EST


The build of the kernel on SPARC fails when linking due to use of _muldi3
in nfs3svc_encode_fsstatres (file fs/nfsd/nfs3xdr.c):

nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd3_fsstatres *resp)
{
        struct statfs *s = &resp->stats;
        u64 bs = s->f_bsize;

        *p++ = xdr_zero; /* no post_op_attr */

        if (resp->status == 0) {
                p = xdr_encode_hyper(p, bs * s->f_blocks); /* total bytes */
                p = xdr_encode_hyper(p, bs * s->f_bfree); /* free bytes */ p = xdr_encode_hyper(p, bs * s->f_bavail); /* user available bytes */
                p = xdr_encode_hyper(p, s->f_files); /* total inodes */
                p = xdr_encode_hyper(p, s->f_ffree); /* free inodes */
                p = xdr_encode_hyper(p, s->f_ffree); /* user available inodes */
                *p++ = htonl(resp->invarsec); /* mean unchanged time */
        }
        return xdr_ressize_check(rqstp, p);
}

I assume bs is block size; a block size that needs a u64 to keep would be
nice, but a bit impractical right now. In particular, the three
multiplications above get the kernel not to link on SPARC.

Checking include/asm-*/statfs.h, everybody seems to agree it is a long,
except alpha (int), and sparc64 has int in statfs32 and long in statfs.
This should fix it (as long as there are no files > 2Gb). In the long run,
f_bsize is always a power of 2, or isn't it? If so, this (and perhaps other
such operations) should be replaced by shifts.

--- fs/nfsd/nfs3xdr.c.dist-2.3.51 Tue Mar 14 16:24:03 2000
+++ fs/nfsd/nfs3xdr.c Tue Mar 14 16:24:16 2000
@@ -775,7 +775,7 @@
         if (resp->status == 0) {
                 p = xdr_encode_hyper(p, (u64) bs * s->f_blocks); /* total bytes */
                 p = xdr_encode_hyper(p, (u64) bs * s->f_bfree); /* free bytes */- p = xdr_encode_hyper(p, bs * s->f_bavail); /* user available bytes */
+ p = xdr_encode_hyper(p, (u64) bs * s->f_bavail); /* user available bytes */
                 p = xdr_encode_hyper(p, s->f_files); /* total inodes */
                 p = xdr_encode_hyper(p, s->f_ffree); /* free inodes */
                 p = xdr_encode_hyper(p, s->f_ffree); /* user available inodes */

-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:27 EST