mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunlong Song <yunlong.song@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>
Cc: <miaoxie@huawei.com>, "Yuchao (T)" <yuchao0@huawei.com>,
	chao <chao@kernel.org>, <bintian.wang@huawei.com>,
	<shengyong1@huawei.com>, heyunlei <heyunlei@huawei.com>
Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: add reserved blocks for root user
Date: Fri, 5 Jan 2018 16:04:49 +0800	[thread overview]
Message-ID: <805948ce-6ce7-5fb3-ab8a-38494e6a6fb1@huawei.com> (raw)
In-Reply-To: <20180103185845.29953-2-jaegeuk@kernel.org>



On 2018/1/4 2:58, Jaegeuk Kim wrote:
> @@ -1590,11 +1598,17 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
>   	sbi->total_valid_block_count += (block_t)(*count);
>   	avail_user_block_count = sbi->user_block_count -
>   					sbi->current_reserved_blocks;
> +
> +	if (!(test_opt(sbi, RESERVE_ROOT) && capable(CAP_SYS_RESOURCE)))
> +		avail_user_block_count -= sbi->root_reserved_blocks;

Should better be:

+	if (test_opt(sbi, RESERVE_ROOT) && !capable(CAP_SYS_RESOURCE))
+		avail_user_block_count -= sbi->root_reserved_blocks;

> @@ -1783,9 +1797,13 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
>   
>   	spin_lock(&sbi->stat_lock);
>   
> -	valid_block_count = sbi->total_valid_block_count + 1;
> -	if (unlikely(valid_block_count + sbi->current_reserved_blocks >
> -						sbi->user_block_count)) {
> +	valid_block_count = sbi->total_valid_block_count +
> +					sbi->current_reserved_blocks + 1;
> +

> +	if (!(test_opt(sbi, RESERVE_ROOT) && capable(CAP_SYS_RESOURCE)))
> +		valid_block_count += sbi->root_reserved_blocks;
> +
should better be:

+	if (test_opt(sbi, RESERVE_ROOT) && !capable(CAP_SYS_RESOURCE))
+		valid_block_count += sbi->root_reserved_blocks;


> +	if (unlikely(valid_block_count > sbi->user_block_count)) {
>   		spin_unlock(&sbi->stat_lock);
>   		goto enospc;
>   	}
>

-- 
Thanks,
Yunlong Song

  parent reply	other threads:[~2018-01-05  8:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 18:58 [PATCH 1/2] f2fs: show precise # of blocks that user/root can use Jaegeuk Kim
2018-01-03 18:58 ` [PATCH 2/2] f2fs: add reserved blocks for root user Jaegeuk Kim
2018-01-04  6:51   ` [PATCH 2/2 v2] " Jaegeuk Kim
2018-01-04  7:21     ` [f2fs-dev] " Chao Yu
2018-01-05  4:43     ` [PATCH 2/2 v3] " Jaegeuk Kim
2018-01-05  8:04   ` Yunlong Song [this message]
2018-01-04  1:12 ` [f2fs-dev] [PATCH 1/2] f2fs: show precise # of blocks that user/root can use Chao Yu
2018-01-04  6:50 ` [PATCH 1/2 v2] " Jaegeuk Kim
2018-01-04  7:20   ` [f2fs-dev] " Chao Yu
2018-01-05  7:05 ` [f2fs-dev] [PATCH 1/2] " Yunlong Song
2018-01-08 11:23   ` Chao Yu

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=805948ce-6ce7-5fb3-ab8a-38494e6a6fb1@huawei.com \
    --to=yunlong.song@huawei.com \
    --cc=bintian.wang@huawei.com \
    --cc=chao@kernel.org \
    --cc=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=shengyong1@huawei.com \
    --cc=yuchao0@huawei.com \
    /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

all inboxes | Powered by JetHome®