/// <summary>Get lists of blocks on the disk sorted by blockId, per blockpool</summary>
        private IDictionary <string, DirectoryScanner.ScanInfo[]> GetDiskReport()
        {
            // First get list of data directories
            IList <FsVolumeSpi> volumes = dataset.GetVolumes();

            // Use an array since the threads may return out of order and
            // compilersInProgress#keySet may return out of order as well.
            DirectoryScanner.ScanInfoPerBlockPool[] dirReports = new DirectoryScanner.ScanInfoPerBlockPool
                                                                 [volumes.Count];
            IDictionary <int, Future <DirectoryScanner.ScanInfoPerBlockPool> > compilersInProgress
                = new Dictionary <int, Future <DirectoryScanner.ScanInfoPerBlockPool> >();

            for (int i = 0; i < volumes.Count; i++)
            {
                if (IsValid(dataset, volumes[i]))
                {
                    DirectoryScanner.ReportCompiler reportCompiler = new DirectoryScanner.ReportCompiler
                                                                         (datanode, volumes[i]);
                    Future <DirectoryScanner.ScanInfoPerBlockPool> result = reportCompileThreadPool.Submit
                                                                                (reportCompiler);
                    compilersInProgress[i] = result;
                }
            }
            foreach (KeyValuePair <int, Future <DirectoryScanner.ScanInfoPerBlockPool> > report in
                     compilersInProgress)
            {
                try
                {
                    dirReports[report.Key] = report.Value.Get();
                }
                catch (Exception ex)
                {
                    Log.Error("Error compiling report", ex);
                    // Propagate ex to DataBlockScanner to deal with
                    throw new RuntimeException(ex);
                }
            }
            // Compile consolidated report for all the volumes
            DirectoryScanner.ScanInfoPerBlockPool list = new DirectoryScanner.ScanInfoPerBlockPool
                                                             ();
            for (int i_1 = 0; i_1 < volumes.Count; i_1++)
            {
                if (IsValid(dataset, volumes[i_1]))
                {
                    // volume is still valid
                    list.AddAll(dirReports[i_1]);
                }
            }
            return(list.ToSortedArrays());
        }
 /// <summary>
 /// Merges
 /// <paramref name="that"/>
 /// ScanInfoPerBlockPool into this one
 /// </summary>
 public virtual void AddAll(DirectoryScanner.ScanInfoPerBlockPool that)
 {
     if (that == null)
     {
         return;
     }
     foreach (KeyValuePair <string, List <DirectoryScanner.ScanInfo> > entry in that)
     {
         string bpid = entry.Key;
         List <DirectoryScanner.ScanInfo> list = entry.Value;
         if (this.Contains(bpid))
         {
             //merge that per-bpid linked list with this one
             Sharpen.Collections.AddAll(this[bpid], list);
         }
         else
         {
             //add that new bpid and its linked list to this
             this[bpid] = list;
         }
     }
 }