HDFS-11904. Reuse iip in unprotectedRemoveXAttrs calls.

This commit is contained in:
Xiao Chen 2017-06-01 14:13:57 -07:00
parent 6a3fc685a9
commit 219f4c199e
3 changed files with 5 additions and 5 deletions

View File

@ -242,7 +242,7 @@ private static List<XAttr> removeErasureCodingPolicyXAttr(
final List<XAttr> xattrs = Lists.newArrayListWithCapacity(1); final List<XAttr> xattrs = Lists.newArrayListWithCapacity(1);
xattrs.add(ecXAttr); xattrs.add(ecXAttr);
FSDirXAttrOp.unprotectedRemoveXAttrs(fsd, srcIIP.getPath(), xattrs); FSDirXAttrOp.unprotectedRemoveXAttrs(fsd, srcIIP, xattrs);
return xattrs; return xattrs;
} }

View File

@ -170,7 +170,7 @@ static FileStatus removeXAttr(
src = iip.getPath(); src = iip.getPath();
checkXAttrChangeAccess(fsd, iip, xAttr, pc); checkXAttrChangeAccess(fsd, iip, xAttr, pc);
List<XAttr> removedXAttrs = unprotectedRemoveXAttrs(fsd, src, xAttrs); List<XAttr> removedXAttrs = unprotectedRemoveXAttrs(fsd, iip, xAttrs);
if (removedXAttrs != null && !removedXAttrs.isEmpty()) { if (removedXAttrs != null && !removedXAttrs.isEmpty()) {
fsd.getEditLog().logRemoveXAttrs(src, removedXAttrs, logRetryCache); fsd.getEditLog().logRemoveXAttrs(src, removedXAttrs, logRetryCache);
} else { } else {
@ -184,10 +184,9 @@ static FileStatus removeXAttr(
} }
static List<XAttr> unprotectedRemoveXAttrs( static List<XAttr> unprotectedRemoveXAttrs(
FSDirectory fsd, final String src, final List<XAttr> toRemove) FSDirectory fsd, final INodesInPath iip, final List<XAttr> toRemove)
throws IOException { throws IOException {
assert fsd.hasWriteLock(); assert fsd.hasWriteLock();
INodesInPath iip = fsd.getINodesInPath(src, DirOp.WRITE);
INode inode = FSDirectory.resolveLastINode(iip); INode inode = FSDirectory.resolveLastINode(iip);
int snapshotId = iip.getLatestSnapshotId(); int snapshotId = iip.getLatestSnapshotId();
List<XAttr> existingXAttrs = XAttrStorage.readINodeXAttrs(inode); List<XAttr> existingXAttrs = XAttrStorage.readINodeXAttrs(inode);

View File

@ -931,7 +931,8 @@ private long applyEditLogOp(FSEditLogOp op, FSDirectory fsDir,
} }
case OP_REMOVE_XATTR: { case OP_REMOVE_XATTR: {
RemoveXAttrOp removeXAttrOp = (RemoveXAttrOp) op; RemoveXAttrOp removeXAttrOp = (RemoveXAttrOp) op;
FSDirXAttrOp.unprotectedRemoveXAttrs(fsDir, removeXAttrOp.src, INodesInPath iip = fsDir.getINodesInPath(removeXAttrOp.src, DirOp.WRITE);
FSDirXAttrOp.unprotectedRemoveXAttrs(fsDir, iip,
removeXAttrOp.xAttrs); removeXAttrOp.xAttrs);
if (toAddRetryCache) { if (toAddRetryCache) {
fsNamesys.addCacheEntry(removeXAttrOp.rpcClientId, fsNamesys.addCacheEntry(removeXAttrOp.rpcClientId,