Browse code

Do not calculate size for local volumes with mount

Local volumes support mount options which, when in use, can mount
external file systems. We don't really need to enumerate these external
filesystems which may be a very slow process.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Brian Goff authored on 2017/06/10 07:25:05
Showing 1 changed files
... ...
@@ -65,6 +65,13 @@ func (daemon *Daemon) SystemDiskUsage(ctx context.Context) (*types.DiskUsage, er
65 65
 		case <-ctx.Done():
66 66
 			return ctx.Err()
67 67
 		default:
68
+			if d, ok := v.(volume.DetailedVolume); ok {
69
+				// skip local volumes with mount options since these could have external
70
+				// mounted filesystems that will be slow to enumerate.
71
+				if len(d.Options()) > 0 {
72
+					return nil
73
+				}
74
+			}
68 75
 			name := v.Name()
69 76
 			refs := daemon.volumes.Refs(v)
70 77