lkml.org 
[lkml]   [2018]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [f2fs-dev] [PATCH 2/2] f2fs: add reserved blocks for root user
From
Date


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


\
 
 \ /
  Last update: 2018-01-05 09:06    [W:0.075 / U:1.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site