Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314852 > unrolled thread

[PATCH 1/2] f2fs: correct search area in get_new_segment

Started byChao Yu <chao2.yu@samsung.com>
First post2016-01-22 10:50 +0100
Last post2016-01-22 10:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] f2fs: correct search area in get_new_segment Chao Yu <chao2.yu@samsung.com> - 2016-01-22 10:50 +0100

#1314852 — [PATCH 1/2] f2fs: correct search area in get_new_segment

FromChao Yu <chao2.yu@samsung.com>
Date2016-01-22 10:50 +0100
Subject[PATCH 1/2] f2fs: correct search area in get_new_segment
Message-ID<qTGvU-2d2-19@gated-at.bofh.it>
get_new_segment starts from current segment position, tries to search a
free segment among its right neighbors locate in same section.

But previously our search area was set as [current segment, max segment],
which means we have to search to more bits in free_segmap bitmap for some
worse cases. So here we correct the search area to [current segment, last
segment in section] to avoid unnecessary searching.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/f2fs/segment.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 5904a41..75413e2 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -873,9 +873,8 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
 
 	if (!new_sec && ((*newseg + 1) % sbi->segs_per_sec)) {
 		segno = find_next_zero_bit(free_i->free_segmap,
-					MAIN_SEGS(sbi), *newseg + 1);
-		if (segno - *newseg < sbi->segs_per_sec -
-					(*newseg % sbi->segs_per_sec))
+				(hint + 1) * sbi->segs_per_sec, *newseg + 1);
+		if (segno < (hint + 1) * sbi->segs_per_sec)
 			goto got_it;
 	}
 find_other_zone:
-- 
2.7.0.2.g1b0b6dd

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web