diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2013-06-16 09:49:11 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:43:52 +0900 |
commit | 25ebab859d1064eb5a5d8ee92db0c544b4481f6e (patch) | |
tree | e6213ba5fdd635e065611b100228ee6bd3cc9fbc /fs | |
parent | 5c8c70506bc046dd92ba40fe15d92f5651c3e0b2 (diff) | |
download | linux-3.10-25ebab859d1064eb5a5d8ee92db0c544b4481f6e.tar.gz linux-3.10-25ebab859d1064eb5a5d8ee92db0c544b4481f6e.tar.bz2 linux-3.10-25ebab859d1064eb5a5d8ee92db0c544b4481f6e.zip |
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')
-rw-r--r-- | fs/f2fs/segment.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 0e1a60a4eb3..3ac4d29f0cd 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) { struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); struct free_segmap_info *free_i = FREE_I(sbi); - unsigned int segno = 0, offset = 0; + unsigned int segno = 0, offset = 0, total_segs = TOTAL_SEGS(sbi); unsigned short valid_blocks; - while (segno < TOTAL_SEGS(sbi)) { + while (1) { /* find dirty segment based on free segmap */ - segno = find_next_inuse(free_i, TOTAL_SEGS(sbi), offset); - if (segno >= TOTAL_SEGS(sbi)) + segno = find_next_inuse(free_i, total_segs, offset); + if (segno >= total_segs) break; offset = segno + 1; valid_blocks = get_valid_blocks(sbi, segno, 0); |