On Tue, Jun 18, 2019 at 08:28:07AM +0000, Naohiro Aota wrote:
> On 2019/06/13 23:07, Josef Bacik wrote:
> > On Fri, Jun 07, 2019 at 10:10:13PM +0900, Naohiro Aota wrote:
> >> @@ -9616,7 +9701,8 @@ static int inc_block_group_ro(struct 
> >> btrfs_block_group_cache *cache, int force)
> >>    }
> >>   
> >>    num_bytes = cache->key.offset - cache->reserved - cache->pinned -
> >> -              cache->bytes_super - btrfs_block_group_used(&cache->item);
> >> +              cache->bytes_super - cache->unusable -
> >> +              btrfs_block_group_used(&cache->item);
> >>    sinfo_used = btrfs_space_info_used(sinfo, true);
> >>   
> >>    if (sinfo_used + num_bytes + min_allocable_bytes <=
> >> @@ -9766,6 +9852,7 @@ void btrfs_dec_block_group_ro(struct 
> >> btrfs_block_group_cache *cache)
> >>    if (!--cache->ro) {
> >>            num_bytes = cache->key.offset - cache->reserved -
> >>                        cache->pinned - cache->bytes_super -
> >> +                      cache->unusable -
> >>                        btrfs_block_group_used(&cache->item);
> > 
> > You've done this in a few places, but not all the places, most notably
> > btrfs_space_info_used() which is used in the space reservation code a lot.
> 
> I added "unsable" to struct btrfs_block_group_cache, but added
> nothing to struct btrfs_space_info. Once extent is allocated and
> freed in an ALLOC_SEQ Block Group, such extent is never resued
> until we remove the BG. I'm accounting the size of such region
> in "cache->unusable" and in "space_info->bytes_readonly". So,
> btrfs_space_info_used() does not need the modify.
> 
> I admit it's confusing here. I can add "bytes_zone_unusable" to
> struct btrfs_space_info, if it's better.
> 

Ah you're right, sorry I just read it as space_info.  Yes please add
bytes_zone_unusable, I'd like to be as verbose as possible about where our space
actually is.  I know if I go to debug something and see a huge amount in
read_only I'll be confused.  Thanks,

Josef

Reply via email to