readAllocationStats reads Btrfs allocation data for the current path.
(d string)
| 134 | |
| 135 | // readAllocationStats reads Btrfs allocation data for the current path. |
| 136 | func (r *reader) readAllocationStats(d string) (a *AllocationStats) { |
| 137 | // Create a reader for this subdirectory |
| 138 | sr := &reader{path: path.Join(r.path, d), devCount: r.devCount} |
| 139 | |
| 140 | // Get the stats |
| 141 | a = &AllocationStats{ |
| 142 | // Read basic allocation stats |
| 143 | MayUseBytes: sr.readValue("bytes_may_use"), |
| 144 | PinnedBytes: sr.readValue("bytes_pinned"), |
| 145 | ReadOnlyBytes: sr.readValue("bytes_readonly"), |
| 146 | ReservedBytes: sr.readValue("bytes_reserved"), |
| 147 | UsedBytes: sr.readValue("bytes_used"), |
| 148 | DiskUsedBytes: sr.readValue("disk_used"), |
| 149 | DiskTotalBytes: sr.readValue("disk_total"), |
| 150 | Flags: sr.readValue("flags"), |
| 151 | TotalBytes: sr.readValue("total_bytes"), |
| 152 | TotalPinnedBytes: sr.readValue("total_bytes_pinned"), |
| 153 | Layouts: sr.readLayouts(), |
| 154 | } |
| 155 | |
| 156 | // Pass any error back |
| 157 | r.err = sr.err |
| 158 | |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | // readLayouts reads all Btrfs layout statistics for the current path. |
| 163 | func (r *reader) readLayouts() map[string]*LayoutUsage { |
no test coverage detected