|
@@ -775,57 +775,6 @@ public class FSDirectory implements Closeable {
|
|
|
return typeSpaceDeltas;
|
|
|
}
|
|
|
|
|
|
- /** Return the name of the path represented by inodes at [0, pos] */
|
|
|
- static String getFullPathName(INode[] inodes, int pos) {
|
|
|
- StringBuilder fullPathName = new StringBuilder();
|
|
|
- if (inodes[0].isRoot()) {
|
|
|
- if (pos == 0) return Path.SEPARATOR;
|
|
|
- } else {
|
|
|
- fullPathName.append(inodes[0].getLocalName());
|
|
|
- }
|
|
|
-
|
|
|
- for (int i=1; i<=pos; i++) {
|
|
|
- fullPathName.append(Path.SEPARATOR_CHAR).append(inodes[i].getLocalName());
|
|
|
- }
|
|
|
- return fullPathName.toString();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @return the relative path of an inode from one of its ancestors,
|
|
|
- * represented by an array of inodes.
|
|
|
- */
|
|
|
- private static INode[] getRelativePathINodes(INode inode, INode ancestor) {
|
|
|
- // calculate the depth of this inode from the ancestor
|
|
|
- int depth = 0;
|
|
|
- for (INode i = inode; i != null && !i.equals(ancestor); i = i.getParent()) {
|
|
|
- depth++;
|
|
|
- }
|
|
|
- INode[] inodes = new INode[depth];
|
|
|
-
|
|
|
- // fill up the inodes in the path from this inode to root
|
|
|
- for (int i = 0; i < depth; i++) {
|
|
|
- if (inode == null) {
|
|
|
- NameNode.stateChangeLog.warn("Could not get full path."
|
|
|
- + " Corresponding file might have deleted already.");
|
|
|
- return null;
|
|
|
- }
|
|
|
- inodes[depth-i-1] = inode;
|
|
|
- inode = inode.getParent();
|
|
|
- }
|
|
|
- return inodes;
|
|
|
- }
|
|
|
-
|
|
|
- private static INode[] getFullPathINodes(INode inode) {
|
|
|
- return getRelativePathINodes(inode, null);
|
|
|
- }
|
|
|
-
|
|
|
- /** Return the full path name of the specified inode */
|
|
|
- static String getFullPathName(INode inode) {
|
|
|
- INode[] inodes = getFullPathINodes(inode);
|
|
|
- // inodes can be null only when its called without holding lock
|
|
|
- return inodes == null ? "" : getFullPathName(inodes, inodes.length - 1);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Add the given child to the namespace.
|
|
|
* @param existing the INodesInPath containing all the ancestral INodes
|
|
@@ -877,9 +826,7 @@ public class FSDirectory implements Closeable {
|
|
|
try {
|
|
|
q.verifyQuota(deltas);
|
|
|
} catch (QuotaExceededException e) {
|
|
|
- List<INode> inodes = iip.getReadOnlyINodes();
|
|
|
- final String path = getFullPathName(inodes.toArray(new INode[inodes.size()]), i);
|
|
|
- e.setPathName(path);
|
|
|
+ e.setPathName(iip.getPath(i));
|
|
|
throw e;
|
|
|
}
|
|
|
}
|