code: private static void processNameDirectories(Configuration conf,
        InstanceId instanceId) {
      if (instanceId == InstanceId.NODEONE || instanceId == InstanceId.NODEZERO) {
        String instance = (instanceId == InstanceId.NODEZERO) ? "zero" : "one";
  
        // Edits directory.
        String editDirs = getWildcardDir(instance, conf,
            FSConstants.DFS_NAMENODE_EDITS_DIR_KEY);
        conf.set(FSConstants.DFS_NAMENODE_EDITS_DIR_KEY, editDirs);
  
        // Image directory.
        String imageDirs = getWildcardDir(instance, conf,
            FSConstants.DFS_NAMENODE_NAME_DIR_KEY);
        conf.set(FSConstants.DFS_NAMENODE_NAME_DIR_KEY, imageDirs);
      }
    }
docs: When avatarone and avatarzero both write to the filer in the case where the
  filer is not the shared directory (when we use QJM). We need both the nodes
  to write to different directories. For this purpose we configure
  dfs.name.dir and dfs.name.edits.dir as follows
  
  <property>
  <name>dfs.name.dir</name>
  <value>/hadoop/<cluster>/,/mnt/fsimage/<cluster>/%</value>
  </property>
  
  Then depending upon the instance we replace '%' with zero or one in this
  function to ensure both nodes write to different locations.