aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2013-06-15 20:49:11 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-07-01 19:48:14 -0400
commit8736fbf00372dcc0bc7b04b86d737eb5db31fff6 (patch)
tree32daf73a5157e2a72cae11fb9fdace1f78488cac /fs/f2fs
parent060dd67b3c0d451ea2c41e6a87811b4736a984e4 (diff)
f2fs: optimize the init_dirty_segmap function
Optimize the while loop condition Since this condition will always be true and while loop will be terminated by the following condition in code: if (segno >= TOTAL_SEGS(sbi)) break; Hence we can replace the while loop condition with while(1) instead of always checking for segno to be less than Total segs. Also we do not need to use TOTAL_SEGS() everytime. We can store this value in a local variable since this value is constant. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 0e1a60a4eb3f..3ac4d29f0cd4 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1582,13 +1582,13 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
1582{ 1582{
1583 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); 1583 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
1584 struct free_segmap_info *free_i = FREE_I(sbi); 1584 struct free_segmap_info *free_i = FREE_I(sbi);
1585 unsigned int segno = 0, offset = 0; 1585 unsigned int segno = 0, offset = 0, total_segs = TOTAL_SEGS(sbi);
1586 unsigned short valid_blocks; 1586 unsigned short valid_blocks;
1587 1587
1588 while (segno < TOTAL_SEGS(sbi)) { 1588 while (1) {
1589 /* find dirty segment based on free segmap */ 1589 /* find dirty segment based on free segmap */
1590 segno = find_next_inuse(free_i, TOTAL_SEGS(sbi), offset); 1590 segno = find_next_inuse(free_i, total_segs, offset);
1591 if (segno >= TOTAL_SEGS(sbi)) 1591 if (segno >= total_segs)
1592 break; 1592 break;
1593 offset = segno + 1; 1593 offset = segno + 1;
1594 valid_blocks = get_valid_blocks(sbi, segno, 0); 1594 valid_blocks = get_valid_blocks(sbi, segno, 0);