Description
1.
removeBlocks(collectedBlocks);
should be after logSync, as we do in other FSN places (rename, delete, write with overwrite), the reason is discussed in HDFS-2815 and https://issues.apache.org/jira/browse/HDFS-6871?focusedCommentId=14110068&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14110068
2.
stat = FSDirStatAndListingOp.getFileInfo(dir, src, false, FSDirectory.isReservedRawName(src), true);
We'd better to use dir.getAuditFileInfo, since it's only for audit log. If audit log is not on, we don't need to get the file info.
3.
In truncateInternal,
INodeFile file = iip.getLastINode().asFile();
is not necessary.