HDFS-5673: simplify iteration code
HDFS-5673: simplify mask calculator modified flag.