linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "WeiFeng Liu" <weifeng.liu@hushmail.com>
To: "linux-btrfs" <linux-btrfs@vger.kernel.org>
Subject: Two questions about update_global_block_rsv()
Date: Thu, 07 Jun 2012 06:46:22 -0800	[thread overview]
Message-ID: <20120607144622.96FFDE674A@smtp.hushmail.com> (raw)

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


             reply	other threads:[~2012-06-07 14:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 14:46 WeiFeng Liu [this message]
2012-06-11  4:05 ` Two questions about update_global_block_rsv() Liu Bo
  -- strict thread matches above, loose matches on Subject: below --
2012-06-21 12:57 WeiFeng Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120607144622.96FFDE674A@smtp.hushmail.com \
    --to=weifeng.liu@hushmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).