Skip to content

Commit

Permalink
HDFS-11904. Reuse iip in unprotectedRemoveXAttrs calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiao-chen committed Jun 1, 2017
1 parent 6a3fc68 commit 219f4c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -242,7 +242,7 @@ private static List<XAttr> removeErasureCodingPolicyXAttr(

final List<XAttr> xattrs = Lists.newArrayListWithCapacity(1);
xattrs.add(ecXAttr);
FSDirXAttrOp.unprotectedRemoveXAttrs(fsd, srcIIP.getPath(), xattrs);
FSDirXAttrOp.unprotectedRemoveXAttrs(fsd, srcIIP, xattrs);
return xattrs;
}

Expand Down
Expand Up @@ -170,7 +170,7 @@ static FileStatus removeXAttr(
src = iip.getPath();
checkXAttrChangeAccess(fsd, iip, xAttr, pc);

List<XAttr> removedXAttrs = unprotectedRemoveXAttrs(fsd, src, xAttrs);
List<XAttr> removedXAttrs = unprotectedRemoveXAttrs(fsd, iip, xAttrs);
if (removedXAttrs != null && !removedXAttrs.isEmpty()) {
fsd.getEditLog().logRemoveXAttrs(src, removedXAttrs, logRetryCache);
} else {
Expand All @@ -184,10 +184,9 @@ static FileStatus removeXAttr(
}

static List<XAttr> unprotectedRemoveXAttrs(
FSDirectory fsd, final String src, final List<XAttr> toRemove)
FSDirectory fsd, final INodesInPath iip, final List<XAttr> toRemove)
throws IOException {
assert fsd.hasWriteLock();
INodesInPath iip = fsd.getINodesInPath(src, DirOp.WRITE);
INode inode = FSDirectory.resolveLastINode(iip);
int snapshotId = iip.getLatestSnapshotId();
List<XAttr> existingXAttrs = XAttrStorage.readINodeXAttrs(inode);
Expand Down
Expand Up @@ -931,7 +931,8 @@ private long applyEditLogOp(FSEditLogOp op, FSDirectory fsDir,
}
case OP_REMOVE_XATTR: {
RemoveXAttrOp removeXAttrOp = (RemoveXAttrOp) op;
FSDirXAttrOp.unprotectedRemoveXAttrs(fsDir, removeXAttrOp.src,
INodesInPath iip = fsDir.getINodesInPath(removeXAttrOp.src, DirOp.WRITE);
FSDirXAttrOp.unprotectedRemoveXAttrs(fsDir, iip,
removeXAttrOp.xAttrs);
if (toAddRetryCache) {
fsNamesys.addCacheEntry(removeXAttrOp.rpcClientId,
Expand Down

0 comments on commit 219f4c1

Please sign in to comment.