lkml.org 
[lkml]   [2014]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -v2] f2fs: Remove lock from check_valid_map
Hi,

On Sun, Sep 07, 2014 at 11:38:30AM +0800, Huang Ying wrote:
> Only one bit is read in check_valid_map, holding a lock to do that
> doesn't help anything except decreasing performance.
>
> Signed-off-by: Huang, Ying <ying.huang@intel.com>
> ---
>
> v2: Fixed a build warning.
>
> ---
> fs/f2fs/gc.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -378,14 +378,11 @@ static void put_gc_inode(struct list_hea
> static int check_valid_map(struct f2fs_sb_info *sbi,
> unsigned int segno, int offset)
> {
> - struct sit_info *sit_i = SIT_I(sbi);
> struct seg_entry *sentry;
> int ret;
>
> - mutex_lock(&sit_i->sentry_lock);
> sentry = get_seg_entry(sbi, segno);
> ret = f2fs_test_bit(offset, sentry->cur_valid_map);
> - mutex_unlock(&sit_i->sentry_lock);
> return ret;

The f2fs_test_bit is not atomic, so I'm not sure this is a good approach.
How about introducing rw_semaphore?

> }
>


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