mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	btrfs: print available space for a block group when dumping a space info
When dumping a space info, we iterate over all its block groups and then print their size and the amounts of bytes used, reserved, pinned, etc. When debugging -ENOSPC problems it's also useful to know how much space is available (free), so calculate that and print it as well. Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									b92e8f5472
								
							
						
					
					
						commit
						e50b122b83
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -523,13 +523,18 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
 | 
			
		|||
	down_read(&info->groups_sem);
 | 
			
		||||
again:
 | 
			
		||||
	list_for_each_entry(cache, &info->block_groups[index], list) {
 | 
			
		||||
		u64 avail;
 | 
			
		||||
 | 
			
		||||
		spin_lock(&cache->lock);
 | 
			
		||||
		avail = cache->length - cache->used - cache->pinned -
 | 
			
		||||
			cache->reserved - cache->delalloc_bytes -
 | 
			
		||||
			cache->bytes_super - cache->zone_unusable;
 | 
			
		||||
		btrfs_info(fs_info,
 | 
			
		||||
"block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable %s",
 | 
			
		||||
"block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable (%llu bytes available) %s",
 | 
			
		||||
			   cache->start, cache->length, cache->used, cache->pinned,
 | 
			
		||||
			   cache->reserved, cache->delalloc_bytes,
 | 
			
		||||
			   cache->bytes_super, cache->zone_unusable,
 | 
			
		||||
			   cache->ro ? "[readonly]" : "");
 | 
			
		||||
			   avail, cache->ro ? "[readonly]" : "");
 | 
			
		||||
		spin_unlock(&cache->lock);
 | 
			
		||||
		btrfs_dump_free_space(cache, bytes);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue