Skip to content

Commit

Permalink
nfsv3: simplify size3 object
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kofemann committed Feb 26, 2021
1 parent 11b19a6 commit 2056c67
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/dcache/nfs/v3/HimeraNfsUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -84,8 +84,8 @@ public static void fill_attributes(Stat stat, fattr3 at) {
// 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());
Expand All @@ -98,7 +98,7 @@ public static void fill_attributes(Stat stat, fattr3 at) {

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;
Expand Down Expand Up @@ -136,7 +136,7 @@ public static void set_sattr(Inode inode, VirtualFileSystem fs, sattr3 s) throws
}

if( s.size.set_it ) {
stat.setSize( s.size.size.value.value);
stat.setSize( s.size.size.value);
}

/* switch( s.atime.set_it ) {
Expand Down
14 changes: 7 additions & 7 deletions core/src/main/java/org/dcache/nfs/v3/NfsServerV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public FSINFO3res NFSPROC3_FSINFO_3(RpcCall call$, FSINFO3args arg1) {
// 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);
Expand Down Expand Up @@ -429,13 +429,13 @@ public FSSTAT3res NFSPROC3_FSSTAT_3(RpcCall call$, FSSTAT3args arg1) {
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);

Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/org/dcache/nfs/v3/xdr/size3.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand All @@ -26,12 +26,12 @@

public class size3 implements XdrAble {

public uint64 value;
public long value;

public size3() {
}

public size3(uint64 value) {
public size3(long value) {
this.value = value;
}

Expand All @@ -42,12 +42,12 @@ public size3(XdrDecodingStream xdr)

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();
}

}
Expand Down

0 comments on commit 2056c67

Please sign in to comment.