Skip to content

Commit

Permalink
nfsv41: simplify internal Transfer class
Browse files Browse the repository at this point in the history
Acked-by: Gerd Behrmann
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Dec 19, 2013
1 parent ce9d61d commit d07d1bb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 36 deletions.
Expand Up @@ -378,16 +378,15 @@ public Layout layoutGet(CompoundContext context, Inode nfsInode, int ioMode, sta
*/
deviceid = MDS_ID;
} else {
InetSocketAddress remote = context.getRpcCall().getTransport().getRemoteSocketAddress();
PnfsId pnfsId = new PnfsId(inode.toString());
Transfer.initSession();
NfsTransfer transfer = new NfsTransfer(_pnfsHandler, Subjects.ROOT,
context.getRpcCall().getCredential().getSubject(),
remote, stateid);
final InetSocketAddress remote = context.getRpcCall().getTransport().getRemoteSocketAddress();
final PnfsId pnfsId = new PnfsId(inode.toString());
final NFS4ProtocolInfo protocolInfo = new NFS4ProtocolInfo(remote, stateid, new CellPath(getCellAddress()));

NFS4ProtocolInfo protocolInfo = transfer.getProtocolInfoForPool();
protocolInfo.door(new CellPath(getCellAddress()));
Transfer.initSession();
final NfsTransfer transfer = new NfsTransfer(_pnfsHandler,
context.getRpcCall().getCredential().getSubject());

transfer.setProtocolInfo(protocolInfo);
transfer.setCellName(this.getCellName());
transfer.setDomainName(this.getCellDomainName());
transfer.setBillingStub(_billingStub);
Expand Down Expand Up @@ -504,12 +503,7 @@ public void getInfo(PrintWriter pw) {
pw.println();
pw.println(" Known movers (layouts):");
for (NfsTransfer io : _ioMessages.values()) {
pw.println(String.format(" %s : %s@%s, OS=%s,cl=[%s]",
io.getPnfsId(),
io.getMoverId(),
io.getPool(),
io.getProtocolInfoForPool().stateId(),
io.getProtocolInfoForPool().getSocketAddress().getAddress().getHostAddress()));
pw.println(io);
}

pw.println();
Expand Down Expand Up @@ -593,26 +587,20 @@ public String toString() {

private static class NfsTransfer extends RedirectedTransfer<PoolDS> {

private final stateid4 _stateid;
private final NFS4ProtocolInfo _protocolInfo;

NfsTransfer(PnfsHandler pnfs, Subject namespaceSubject, Subject ioSubject, InetSocketAddress client,
stateid4 stateid) {
super(pnfs, namespaceSubject, ioSubject, new FsPath("/"));
_stateid = stateid;
_protocolInfo = new NFS4ProtocolInfo(client, _stateid);
NfsTransfer(PnfsHandler pnfs, Subject ioSubject) {
super(pnfs, Subjects.ROOT, ioSubject, new FsPath("/"));
}

@Override
protected NFS4ProtocolInfo getProtocolInfoForPoolManager() {
return _protocolInfo;
}

@Override
protected NFS4ProtocolInfo getProtocolInfoForPool() {
return _protocolInfo;
}
public String toString() {
return String.format(" %s : %s@%s, OS=%s,cl=[%s]",
getPnfsId(),
getMoverId(),
getPool(),
((NFS4ProtocolInfo)getProtocolInfoForPool()).stateId(),
((NFS4ProtocolInfo)getProtocolInfoForPool()).getSocketAddress().getAddress().getHostAddress());
}
}

/**
* To allow the transfer monitoring in the httpd cell to recognize us
Expand Down
Expand Up @@ -19,12 +19,14 @@ public class NFS4ProtocolInfo implements IpProtocolInfo {
private static final int _minor = 1;
private static final int _major = 4;
private final stateid4 _stateId;
private CellPath _door;
private final CellPath _door;
private final InetSocketAddress _socketAddress;

public NFS4ProtocolInfo(InetSocketAddress clientSocketAddress, stateid4 stateId) {
public NFS4ProtocolInfo(InetSocketAddress clientSocketAddress,
stateid4 stateId, CellPath door) {
_stateId = stateId;
_socketAddress = clientSocketAddress;
_door = door;
}

//
Expand Down Expand Up @@ -58,10 +60,6 @@ public CellPath door() {
return _door;
}

public void door(CellPath door) {
_door = door;
}

public stateid4 stateId() {
return _stateId;
}
Expand Down

0 comments on commit d07d1bb

Please sign in to comment.