Re: [f2fs-dev] [PATCH] f2fs: check all ones or zeros bitmap with integer data type for better mount performance

2013-10-23 Thread Chao Yu
Hi Kim,

> -Original Message-
> From: Jaegeuk Kim [mailto:jaegeuk@samsung.com]
> Sent: Wednesday, October 23, 2013 5:32 PM
> To: Chao Yu
> Cc: linux-f2fs-devel@lists.sourceforge.net; linux-fsde...@vger.kernel.org;
> linux-ker...@vger.kernel.org; '谭姝'
> Subject: RE: [f2fs-dev] [PATCH] f2fs: check all ones or zeros bitmap with 
> integer
> data type for better mount performance
> 
> Hi,
> 
> 2013-10-23 (수), 11:23 +0800, Chao Yu:
> > Hi, Kim:
> >
> > > -Original Message-
> > > From: Jaegeuk Kim [mailto:jaegeuk@samsung.com]
> > > Sent: Tuesday, October 22, 2013 8:24 PM
> > > To: Chao Yu
> > > Cc: linux-f2fs-devel@lists.sourceforge.net;
> > > linux-fsde...@vger.kernel.org; linux-ker...@vger.kernel.org; 谭姝
> > > Subject: Re: [f2fs-dev] [PATCH] f2fs: check all ones or zeros bitmap
> > > with integer data type for better mount performance
> > >
> > > Hi,
> > >
> > > 2013-10-22 (화), 17:28 +0800, Chao Yu:
> > > > Previously, check_block_count check valid_map with bit data type
> > > > in common scenario that sit has all ones or zeros bitmap, it makes
> > > > low mount performance.
> > > > So let's check the special bitmap with integer data type instead
> > > > of the bit one.
> > > >
> > > > Signed-off-by: Tan Shu 
> > > > Signed-off-by: Yu Chao 
> > > > ---
> > > >  fs/f2fs/segment.h |   13 +
> > > >  1 file changed, 13 insertions(+)
> > > >
> > > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index
> > > > 7f94d78..d43ab9f 100644
> > > > --- a/fs/f2fs/segment.h
> > > > +++ b/fs/f2fs/segment.h
> > > > @@ -543,6 +543,7 @@ static inline void check_block_count(struct
> > > > f2fs_sb_info *sbi,  {
> > > > struct f2fs_sm_info *sm_info = SM_I(sbi);
> > > > unsigned int end_segno = sm_info->segment_count - 1;
> > > > +   int *valid_map = (int *)raw_sit->valid_map;
> > > > int valid_blocks = 0;
> > > > int i;
> > > >
> > > > @@ -552,6 +553,19 @@ static inline void check_block_count(struct
> > > > f2fs_sb_info *sbi,
> > > > /* check boundary of a given segment number */
> > > > BUG_ON(segno > end_segno);
> > > >
> > > > +   /* check all ones or zeros valid_map */
> > > > +   if (GET_SIT_VBLOCKS(raw_sit) == 0) {
> > > > +   for (i = 0; i < SIT_VBLOCK_MAP_SIZE / sizeof(int); i++)
> > >
> > > We cannot guarantee all the time that SIT_VBLOCK_MAP_SIZE is
> > > multiple of sizeof(int).
> > Well, It's really large changes for f2fs if SIT_VBLOCK_MAP_SIZE value is 
> > being
> modified.
> 
> But, it can be changed.
> Please do not add any unnecessary assumption.
Got it, sorry for the unmeaning assumption.

> 
> >
> > > How about using memcmp() with __u8?
> > Do you mean that we can alloc all zeros or ones memory in
> > SIT_VBLOCK_MAP_SIZE size, then memcmp() it with sit bitmap by __u8?
> 
> Yap.
> Ah, but there is another one.
> It would be better to use find_next_bit_le() and find_next_zero_bit_le().
> Any idea?
Good point.
I try to use memcmp(bitmap, bitmap+1, size-1) and bitmap[0], 
But yours got better performance and readable.
Thanks.

> 
> >
> > >
> > > > +   if (unlikely(valid_map[i] != 0))
> > > > +   BUG();
> > > > +   return;
> > > > +   } else if (GET_SIT_VBLOCKS(raw_sit) == sbi->blocks_per_seg) {
> > > > +   for (i = 0; i < SIT_VBLOCK_MAP_SIZE / sizeof(int); i++)
> > > > +   if (unlikely(valid_map[i] != -1))
> > > > +   BUG();
> > > > +   return;
> > > > +   }
> > > > +
> > > > /* check bitmap with valid block count */
> > > > for (i = 0; i < sbi->blocks_per_seg; i++)
> > > > if (f2fs_test_bit(i, raw_sit->valid_map))
> > > > ---
> > > >
> > > > --
> > > > To unsubscribe from this list: send the line "unsubscribe
> > > > linux-fsdevel" in the body of a message to
> > > > majord...@vger.kernel.org More majordomo info at
> > > > http://vger.kernel.org/majordomo-info.html
> > >
> > > --
> > > Jaegeuk Kim
> > > Samsung
> >
> 
> --
> Jaegeuk Kim
> Samsung


--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] f2fs: clean up several status-related operations

2013-10-23 Thread Gu Zheng
On 10/23/2013 05:46 PM, Jaegeuk Kim wrote:

> This patch cleans up improper definitions that update some status information.

Nice, it makes the code more neat.

> 
> Signed-off-by: Jaegeuk Kim 

Reviewed-by: Gu Zheng 

> ---
>  fs/f2fs/checkpoint.c |  8 ++--
>  fs/f2fs/data.c   | 12 +++-
>  fs/f2fs/f2fs.h   | 14 +-
>  fs/f2fs/gc.c |  4 +---
>  fs/f2fs/segment.c| 10 --
>  5 files changed, 23 insertions(+), 25 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 6fb484c..b4a59cf 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -467,9 +467,7 @@ static int __add_dirty_inode(struct inode *inode, struct 
> dir_inode_entry *new)
>   return -EEXIST;
>   }
>   list_add_tail(&new->list, head);
> -#ifdef CONFIG_F2FS_STAT_FS
> - sbi->n_dirty_dirs++;
> -#endif
> + stat_inc_dirty_dir(sbi);
>   return 0;
>  }
>  
> @@ -531,9 +529,7 @@ void remove_dirty_dir_inode(struct inode *inode)
>   if (entry->inode == inode) {
>   list_del(&entry->list);
>   kmem_cache_free(inode_entry_slab, entry);
> -#ifdef CONFIG_F2FS_STAT_FS
> - sbi->n_dirty_dirs--;
> -#endif
> + stat_dec_dirty_dir(sbi);
>   break;
>   }
>   }
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 2535d3b..4d4718f 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -68,9 +68,6 @@ static int check_extent_cache(struct inode *inode, pgoff_t 
> pgofs,
>   struct buffer_head *bh_result)
>  {
>   struct f2fs_inode_info *fi = F2FS_I(inode);
> -#ifdef CONFIG_F2FS_STAT_FS
> - struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
> -#endif
>   pgoff_t start_fofs, end_fofs;
>   block_t start_blkaddr;
>  
> @@ -80,9 +77,8 @@ static int check_extent_cache(struct inode *inode, pgoff_t 
> pgofs,
>   return 0;
>   }
>  
> -#ifdef CONFIG_F2FS_STAT_FS
> - sbi->total_hit_ext++;
> -#endif
> + stat_inc_hit_ext(inode->i_sb);
> +
>   start_fofs = fi->ext.fofs;
>   end_fofs = fi->ext.fofs + fi->ext.len - 1;
>   start_blkaddr = fi->ext.blk_addr;
> @@ -100,9 +96,7 @@ static int check_extent_cache(struct inode *inode, pgoff_t 
> pgofs,
>   else
>   bh_result->b_size = UINT_MAX;
>  
> -#ifdef CONFIG_F2FS_STAT_FS
> - sbi->read_hit_ext++;
> -#endif
> + stat_inc_hit_ext(inode->i_sb);
>   read_unlock(&fi->ext.ext_lock);
>   return 1;
>   }
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 2949275..d1fc93c 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1155,7 +1155,13 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct 
> f2fs_sb_info *sbi)
>   return (struct f2fs_stat_info*)sbi->stat_info;
>  }
>  
> -#define stat_inc_call_count(si)  ((si)->call_count++)
> +#define stat_inc_call_count(si)  ((si)->call_count++)
> +#define stat_inc_bggc_count(sbi) ((sbi)->bg_gc++)
> +#define stat_inc_dirty_dir(sbi)  ((sbi)->n_dirty_dirs++)
> +#define stat_dec_dirty_dir(sbi)  ((sbi)->n_dirty_dirs--)
> +#define stat_inc_hit_ext(sb) ((F2FS_SB(sb))->total_hit_ext++)
> +#define stat_inc_alloc_type(sbi, curseg) \
> + ((sbi)->segment_count[(curseg)->alloc_type]++)
>  
>  #define stat_inc_seg_count(sbi, type)
> \
>   do {\
> @@ -1184,12 +1190,18 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct 
> f2fs_sb_info *sbi)
>   si->node_blks += (blks);\
>   } while (0)
>  
> +
>  int f2fs_build_stats(struct f2fs_sb_info *);
>  void f2fs_destroy_stats(struct f2fs_sb_info *);
>  void __init f2fs_create_root_stats(void);
>  void f2fs_destroy_root_stats(void);
>  #else
>  #define stat_inc_call_count(si)
> +#define stat_inc_bggc_count(si)
> +#define stat_inc_dirty_dir(sbi)
> +#define stat_dec_dirty_dir(sbi)
> +#define stat_inc_hit_ext(sb)
> +#define stat_inc_alloc_type(sbi, curseg)
>  #define stat_inc_seg_count(si, type)
>  #define stat_inc_tot_blk_count(si, blks)
>  #define stat_inc_data_blk_count(si, blks)
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 7914b92..cb286d7 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -77,9 +77,7 @@ static int gc_thread_func(void *data)
>   else
>   wait_ms = increase_sleep_time(gc_th, wait_ms);
>  
> -#ifdef CONFIG_F2FS_STAT_FS
> - sbi->bg_gc++;
> -#endif
> + stat_inc_bggc_count(sbi);
>  
>   /* if return value is not zero, no victim was selected */
>   if (f2fs_gc(sbi))
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8ac1619..c9c276e 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segmen

Re: [f2fs-dev] [PATCH] f2fs: delete and free dirty dir freeing inode entry when sync dirty dir inodes

2013-10-23 Thread Gu Zheng
Hi Kim,
On 10/22/2013 07:15 PM, Jaegeuk Kim wrote:

> 2013-10-21 (월), 15:19 +0800, Gu Zheng:
>> In sync_dirty_dir_inodes(), remove_dirty_dir_inode() will be called
>> in the callback of filemap_flush to delete and free dirty dir inode entry.
>> But for the freeing inode entry, missed this step after sbumit data bio,
>> and this may lead to a dead loop if these is freeing inode entry in
>> dir_inode_list. So add the delete and free step to fix it.
> 
> Hi Gu,
> 
> This dirty inode will be removed by f2fs_evict_inode() after submitting
> any pending bio, f2fs_submit_bio().

Yeah, got it, thanks for your direction, please ignore this patch.

Regards,
Gu

> Thanks,
> 
>>
>> Signed-off-by: Gu Zheng 
>> ---
>>  fs/f2fs/checkpoint.c |9 +
>>  1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 8d16071..f61838f 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -600,7 +600,16 @@ retry:
>>   * wribacking dentry pages in the freeing inode.
>>   */
>>  f2fs_submit_bio(sbi, DATA, true);
>> +
>> +spin_lock(&sbi->dir_inode_lock);
>> +list_del(&entry->list);
>> +#ifdef CONFIG_F2FS_STAT_FS
>> +sbi->n_dirty_dirs--;
>> +#endif
>> +spin_unlock(&sbi->dir_inode_lock);
>> +kmem_cache_free(inode_entry_slab, entry);
>>  }
>> +
>>  goto retry;
>>  }
>>  
> 



--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [Bug] Inaccessible, unerasable file

2013-10-23 Thread Jaegeuk Kim
Hi,

2013-10-22 (화), 22:50 +0200, Max Muster:
> Hi,
> 
> I don't recall anything like a blackout, but since I like to run new
> software that's still in development, I have had a fair share of system
> crashes.
> 
> As far as I'm aware this is the only file on the partition to ever
> become corrupted at the file system level, though.
> 
> The repository was a simple (shallow) git clone of Google's gyp,
> available here:
> 
> https://chromium.googlesource.com/external/gyp.git
> 

As I tested the above git, there was no functional problem on f2fs.
So, could you give me the log of "fsck.f2fs -d 3"?
It is the best you can give me the broken image though.
Thanks,

> Such being the case, I have no need to restore the file, but being able
> to have it properly deleted would be nice.
> 
> Yours
> tastky
> 
> On 22.10.2013 13:09, Jaegeuk Kim wrote:
> > Hi,
> >
> > Thank you for the report.
> >
> > 2013-10-19 (토), 19:36 +0200, Max Muster:
> >> There's a broken, ie. inaccessible and unerasable file on my f2fs
> >> partition (2nd partition with 21GB on a Corsair Flash Voyager GT USB 3.0
> >> 32GB). ls reports:
> >>
> >>   >cannot access shared.h: Input/output error
> >>   >total 0
> >>   >-? ? ? ? ?? shared.h
> >>
> >> The file has been on the partition for a couple of months already. I
> >> didn't report sooner as I could/can move its folder (but not the file
> >> itself) where it doesn't bug me and it doesn't appear to affect anything
> >> else.
> >>
> >> (I'm currently running Linux v3.12-rc5 with post-3.12 f2fs patches
> >> applied manually.)
> >>
> >> The partition is used primarily to store source code and as cache for
> >> ccache. I don't recall ever fiddling with this file directly; it
> >> probably happened during updating its repository or deleting just that.
> >>
> >> f2fs-tools's fsck (current git 2ad1fcd800) doesn't appear to do anything
> >> and aborts after some 30 seconds with:
> >>
> >>   >Info: sector size = 512
> >>   >Info: total sectors = 42106880 (in 512bytes)
> >>   >[fsck_chk_node_blk: 195] block addr [0xa40ae59]
> >>   >
> >>   >Assertion failed!
> >>   >[fsck_chk_node_blk: 195] ni.blk_addr < F2FS_RAW_SUPER(sbi)->block_count
> >>
> >> If you would like me to post further info, please tell me which; I've
> >> got no idea how to further debug this.
> >
> > Um, I've never seen this kind of error so far.
> >  From the result of fsck, it seems that the inode of shared.h was lost.
> > So, currently, there is no way to recover that inode and its data
> > simply.
> > It may need scan the whole partition to find the stale inode block.
> >
> > Two questions.
> > - Have you experienced any sudden power-off before?
> > - Can I test with the repository having the shared.h that you used?
> >(I'd like to do a simple test storing that repository.)
> >
> > Thanks,
> >

-- 
Jaegeuk Kim
Samsung



--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] f2fs: clean up several status-related operations

2013-10-23 Thread Jaegeuk Kim
This patch cleans up improper definitions that update some status information.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c |  8 ++--
 fs/f2fs/data.c   | 12 +++-
 fs/f2fs/f2fs.h   | 14 +-
 fs/f2fs/gc.c |  4 +---
 fs/f2fs/segment.c| 10 --
 5 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 6fb484c..b4a59cf 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -467,9 +467,7 @@ static int __add_dirty_inode(struct inode *inode, struct 
dir_inode_entry *new)
return -EEXIST;
}
list_add_tail(&new->list, head);
-#ifdef CONFIG_F2FS_STAT_FS
-   sbi->n_dirty_dirs++;
-#endif
+   stat_inc_dirty_dir(sbi);
return 0;
 }
 
@@ -531,9 +529,7 @@ void remove_dirty_dir_inode(struct inode *inode)
if (entry->inode == inode) {
list_del(&entry->list);
kmem_cache_free(inode_entry_slab, entry);
-#ifdef CONFIG_F2FS_STAT_FS
-   sbi->n_dirty_dirs--;
-#endif
+   stat_dec_dirty_dir(sbi);
break;
}
}
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2535d3b..4d4718f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -68,9 +68,6 @@ static int check_extent_cache(struct inode *inode, pgoff_t 
pgofs,
struct buffer_head *bh_result)
 {
struct f2fs_inode_info *fi = F2FS_I(inode);
-#ifdef CONFIG_F2FS_STAT_FS
-   struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
-#endif
pgoff_t start_fofs, end_fofs;
block_t start_blkaddr;
 
@@ -80,9 +77,8 @@ static int check_extent_cache(struct inode *inode, pgoff_t 
pgofs,
return 0;
}
 
-#ifdef CONFIG_F2FS_STAT_FS
-   sbi->total_hit_ext++;
-#endif
+   stat_inc_hit_ext(inode->i_sb);
+
start_fofs = fi->ext.fofs;
end_fofs = fi->ext.fofs + fi->ext.len - 1;
start_blkaddr = fi->ext.blk_addr;
@@ -100,9 +96,7 @@ static int check_extent_cache(struct inode *inode, pgoff_t 
pgofs,
else
bh_result->b_size = UINT_MAX;
 
-#ifdef CONFIG_F2FS_STAT_FS
-   sbi->read_hit_ext++;
-#endif
+   stat_inc_hit_ext(inode->i_sb);
read_unlock(&fi->ext.ext_lock);
return 1;
}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 2949275..d1fc93c 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1155,7 +1155,13 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct 
f2fs_sb_info *sbi)
return (struct f2fs_stat_info*)sbi->stat_info;
 }
 
-#define stat_inc_call_count(si)((si)->call_count++)
+#define stat_inc_call_count(si)((si)->call_count++)
+#define stat_inc_bggc_count(sbi)   ((sbi)->bg_gc++)
+#define stat_inc_dirty_dir(sbi)((sbi)->n_dirty_dirs++)
+#define stat_dec_dirty_dir(sbi)((sbi)->n_dirty_dirs--)
+#define stat_inc_hit_ext(sb)   ((F2FS_SB(sb))->total_hit_ext++)
+#define stat_inc_alloc_type(sbi, curseg)   \
+   ((sbi)->segment_count[(curseg)->alloc_type]++)
 
 #define stat_inc_seg_count(sbi, type)  \
do {\
@@ -1184,12 +1190,18 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct 
f2fs_sb_info *sbi)
si->node_blks += (blks);\
} while (0)
 
+
 int f2fs_build_stats(struct f2fs_sb_info *);
 void f2fs_destroy_stats(struct f2fs_sb_info *);
 void __init f2fs_create_root_stats(void);
 void f2fs_destroy_root_stats(void);
 #else
 #define stat_inc_call_count(si)
+#define stat_inc_bggc_count(si)
+#define stat_inc_dirty_dir(sbi)
+#define stat_dec_dirty_dir(sbi)
+#define stat_inc_hit_ext(sb)
+#define stat_inc_alloc_type(sbi, curseg)
 #define stat_inc_seg_count(si, type)
 #define stat_inc_tot_blk_count(si, blks)
 #define stat_inc_data_blk_count(si, blks)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 7914b92..cb286d7 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -77,9 +77,7 @@ static int gc_thread_func(void *data)
else
wait_ms = increase_sleep_time(gc_th, wait_ms);
 
-#ifdef CONFIG_F2FS_STAT_FS
-   sbi->bg_gc++;
-#endif
+   stat_inc_bggc_count(sbi);
 
/* if return value is not zero, no victim was selected */
if (f2fs_gc(sbi))
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8ac1619..c9c276e 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -554,9 +554,8 @@ static void allocate_segment_by_default(struct f2fs_sb_info 
*sbi,
change_curseg(sbi, type, true);
else
new_curseg(sbi, type, false);
-#ifdef CONFIG_F2FS_STAT_FS
-   sbi->segment_count[curseg->alloc_type]++;
-#endif
+
+

Re: [f2fs-dev] [PATCH] f2fs: check all ones or zeros bitmap with integer data type for better mount performance

2013-10-23 Thread Jaegeuk Kim
Hi,

2013-10-23 (수), 11:23 +0800, Chao Yu:
> Hi, Kim:
> 
> > -Original Message-
> > From: Jaegeuk Kim [mailto:jaegeuk@samsung.com]
> > Sent: Tuesday, October 22, 2013 8:24 PM
> > To: Chao Yu
> > Cc: linux-f2fs-devel@lists.sourceforge.net; linux-fsde...@vger.kernel.org;
> > linux-ker...@vger.kernel.org; 谭姝
> > Subject: Re: [f2fs-dev] [PATCH] f2fs: check all ones or zeros bitmap with 
> > integer
> > data type for better mount performance
> > 
> > Hi,
> > 
> > 2013-10-22 (화), 17:28 +0800, Chao Yu:
> > > Previously, check_block_count check valid_map with bit data type in
> > > common scenario that sit has all ones or zeros bitmap, it makes low
> > > mount performance.
> > > So let's check the special bitmap with integer data type instead of
> > > the bit one.
> > >
> > > Signed-off-by: Tan Shu 
> > > Signed-off-by: Yu Chao 
> > > ---
> > >  fs/f2fs/segment.h |   13 +
> > >  1 file changed, 13 insertions(+)
> > >
> > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index
> > > 7f94d78..d43ab9f 100644
> > > --- a/fs/f2fs/segment.h
> > > +++ b/fs/f2fs/segment.h
> > > @@ -543,6 +543,7 @@ static inline void check_block_count(struct
> > > f2fs_sb_info *sbi,  {
> > >   struct f2fs_sm_info *sm_info = SM_I(sbi);
> > >   unsigned int end_segno = sm_info->segment_count - 1;
> > > + int *valid_map = (int *)raw_sit->valid_map;
> > >   int valid_blocks = 0;
> > >   int i;
> > >
> > > @@ -552,6 +553,19 @@ static inline void check_block_count(struct
> > > f2fs_sb_info *sbi,
> > >   /* check boundary of a given segment number */
> > >   BUG_ON(segno > end_segno);
> > >
> > > + /* check all ones or zeros valid_map */
> > > + if (GET_SIT_VBLOCKS(raw_sit) == 0) {
> > > + for (i = 0; i < SIT_VBLOCK_MAP_SIZE / sizeof(int); i++)
> > 
> > We cannot guarantee all the time that SIT_VBLOCK_MAP_SIZE is multiple of
> > sizeof(int).
> Well, It's really large changes for f2fs if SIT_VBLOCK_MAP_SIZE value is 
> being modified.

But, it can be changed.
Please do not add any unnecessary assumption.

> 
> > How about using memcmp() with __u8?
> Do you mean that we can alloc all zeros or ones memory in SIT_VBLOCK_MAP_SIZE 
> size,
> then memcmp() it with sit bitmap by __u8?

Yap.
Ah, but there is another one.
It would be better to use find_next_bit_le() and
find_next_zero_bit_le().
Any idea?

> 
> > 
> > > + if (unlikely(valid_map[i] != 0))
> > > + BUG();
> > > + return;
> > > + } else if (GET_SIT_VBLOCKS(raw_sit) == sbi->blocks_per_seg) {
> > > + for (i = 0; i < SIT_VBLOCK_MAP_SIZE / sizeof(int); i++)
> > > + if (unlikely(valid_map[i] != -1))
> > > + BUG();
> > > + return;
> > > + }
> > > +
> > >   /* check bitmap with valid block count */
> > >   for (i = 0; i < sbi->blocks_per_seg; i++)
> > >   if (f2fs_test_bit(i, raw_sit->valid_map))
> > > ---
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe
> > > linux-fsdevel" in the body of a message to majord...@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> > --
> > Jaegeuk Kim
> > Samsung
> 

-- 
Jaegeuk Kim
Samsung



--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel