Commit 2056c670 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfsv3: simplify size3 object

Motivation:
size3 object is a wrap around uint64, which is by itself wrap around
long.

Modification:
simplify size3 by wrapping directly long

Result:
less load on GC.

Acked-by: Marina Sahakyan
Acked-by: Paul Millar
Target: master
parent 11b19a6d
Pipeline #3438 passed with stage
in 1 minute and 46 seconds
/*
* Copyright (c) 2009 - 2015 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -84,8 +84,8 @@ public class HimeraNfsUtils {
// Get some value for this file/dir
at.fileid = new fileid3(new uint64( stat.getFileId() ) );
at.size = new size3( new uint64( stat.getSize() ) );
at.used = new size3( new uint64( stat.getSize() ) );
at.size = new size3(stat.getSize());
at.used = new size3(stat.getSize());
//public nfstime atime;
at.atime = convertTimestamp(stat.getATime());
......@@ -98,7 +98,7 @@ public class HimeraNfsUtils {
public static void fill_attributes(Stat stat, wcc_attr at) {
at.size = new size3( new uint64( stat.getSize() ) );
at.size = new size3(stat.getSize());
//public nfstime mtime;
at.mtime = convertTimestamp(stat.getMTime());
//public nfstime ctime;
......@@ -136,7 +136,7 @@ public class HimeraNfsUtils {
}
if( s.size.set_it ) {
stat.setSize( s.size.size.value.value);
stat.setSize( s.size.size.value);
}
/* switch( s.atime.set_it ) {
......
......@@ -388,7 +388,7 @@ public class NfsServerV3 extends nfs3_protServerStub {
// preferred size of READDIR request
res.resok.dtpref = new uint32(8192);
// max size of a file of the file system
res.resok.maxfilesize = new size3(new uint64(4294967296L));
res.resok.maxfilesize = new size3(4294967296L);
// server time granularity -- accurate only to nearest second
nfstime3 time = new nfstime3();
time.seconds = new uint32(1);
......@@ -429,13 +429,13 @@ public class NfsServerV3 extends nfs3_protServerStub {
res.resok = new FSSTAT3resok();
FsStat fsStat = fs.getFsStat();
res.resok.tbytes = new size3(new uint64(fsStat.getTotalSpace()));
res.resok.fbytes = new size3(new uint64(fsStat.getTotalSpace() - fsStat.getUsedSpace()));
res.resok.abytes = new size3(new uint64(fsStat.getTotalSpace() - fsStat.getUsedSpace()));
res.resok.tbytes = new size3(fsStat.getTotalSpace());
res.resok.fbytes = new size3(fsStat.getTotalSpace() - fsStat.getUsedSpace());
res.resok.abytes = new size3(fsStat.getTotalSpace() - fsStat.getUsedSpace());
res.resok.tfiles = new size3(new uint64(fsStat.getTotalFiles()));
res.resok.ffiles = new size3(new uint64(fsStat.getTotalFiles() - fsStat.getUsedFiles()));
res.resok.afiles = new size3(new uint64(fsStat.getTotalFiles() - fsStat.getUsedFiles()));
res.resok.tfiles = new size3(fsStat.getTotalFiles());
res.resok.ffiles = new size3(fsStat.getTotalFiles() - fsStat.getUsedFiles());
res.resok.afiles = new size3(fsStat.getTotalFiles() - fsStat.getUsedFiles());
res.resok.invarsec = new uint32(0);
......
/*
* Copyright (c) 2009 - 2012 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -26,12 +26,12 @@ import java.io.IOException;
public class size3 implements XdrAble {
public uint64 value;
public long value;
public size3() {
}
public size3(uint64 value) {
public size3(long value) {
this.value = value;
}
......@@ -42,12 +42,12 @@ public class size3 implements XdrAble {
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
value.xdrEncode(xdr);
xdr.xdrEncodeLong(value);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
value = new uint64(xdr);
value = xdr.xdrDecodeLong();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment