Thanks Zhe Zhang for review..
The behavior of shared directories is worth more discussions. The current patch returns 0 if the directory is shared. Since the purpose of this new metric is for local storage planning / provisioning, shall we report size of shared dirs as well?
Do we have any interface to get size of shared dirs in namenode ?.
The temporary nnDirSizeMap is not necessary. I think we can directly clear and add to nameDirSizeMap.
This I did purposefully. Getting size for all the dir and updating in map will take some time because it is I/O call. Suppose we updated size for one dir and in-between some one read that map then he will get incomplete info.