Help two questions about update_global_block_rsv()

update_global_block_rsv(fs_info) {

...
block_rsv = &fs_info->global_block_rsv;
sinfo = block_rsv->space_info;

num_bytes = sinfo->bytes_used + sinfo->bytes_pinned +
            sinfo->bytes_reserved + sinfo->bytes_readonly +
            sinfo->bytes_may_use;
 
if (sinfo->total_bytes > num_bytes) {
                num_bytes = sinfo->total_bytes - num_bytes;
                block_rsv->reserved += num_bytes;
                sinfo->bytes_may_use += num_bytes;
}
...
}

1. I don't quite understand the lines:
        block_rsv->reserved += num_bytes;
        sinfo->bytes_may_use += num_bytes;
        
why aren't they like these?
        block_rsv->reserved = num_bytes;
        sinfo->bytes_may_use = num_bytes;

assuming that nothing else is changed, and we just call
update_global_block_rsv() for several times, then block_rsv->reserved will
increase constantly, and so sinfo->bytes_may_use; can anyone tell me what it
means? I mean if nothing else is changed the two variables should keep their
values unchanged also, is that right? a bit puzzlement to me.

2. Is the meaning of sinfo->bytes_may_use that bytes which is available for use
or that bytes which will likely/unlikely be used?

thanks

WeiFeng Liu

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to