aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-02-27 06:12:24 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-02-27 06:40:36 -0500
commit81c1a0f13e6306a76fc3743b8504085d96659a5f (patch)
tree977ddb17842f5ae24856c1fdf7192d1ae1666840 /fs
parentab9fa662e4867455f44f4de96d29a7f09cf292c6 (diff)
f2fs: readahead contiguous SSA blocks for f2fs_gc
If there are multi segments in one section, we will read those SSA blocks which have contiguous address one by one in f2fs_gc. It may lost performance, let's read ahead SSA blocks by merge multi read request. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/checkpoint.c6
-rw-r--r--fs/f2fs/f2fs.h5
-rw-r--r--fs/f2fs/gc.c5
3 files changed, 12 insertions, 4 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 757b77b7118e..c8516ee24126 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -82,6 +82,7 @@ inline int get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
82 return NM_I(sbi)->max_nid / NAT_ENTRY_PER_BLOCK; 82 return NM_I(sbi)->max_nid / NAT_ENTRY_PER_BLOCK;
83 case META_SIT: 83 case META_SIT:
84 return SIT_BLK_CNT(sbi); 84 return SIT_BLK_CNT(sbi);
85 case META_SSA:
85 case META_CP: 86 case META_CP:
86 return 0; 87 return 0;
87 default: 88 default:
@@ -90,7 +91,7 @@ inline int get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
90} 91}
91 92
92/* 93/*
93 * Readahead CP/NAT/SIT pages 94 * Readahead CP/NAT/SIT/SSA pages
94 */ 95 */
95int ra_meta_pages(struct f2fs_sb_info *sbi, int start, int nrpages, int type) 96int ra_meta_pages(struct f2fs_sb_info *sbi, int start, int nrpages, int type)
96{ 97{
@@ -125,8 +126,9 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, int start, int nrpages, int type)
125 goto out; 126 goto out;
126 prev_blk_addr = blk_addr; 127 prev_blk_addr = blk_addr;
127 break; 128 break;
129 case META_SSA:
128 case META_CP: 130 case META_CP:
129 /* get cp block addr */ 131 /* get ssa/cp block addr */
130 blk_addr = blkno; 132 blk_addr = blkno;
131 break; 133 break;
132 default: 134 default:
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 6f88191f2a34..bd6666e1bf2f 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -89,12 +89,13 @@ enum {
89}; 89};
90 90
91/* 91/*
92 * For CP/NAT/SIT readahead 92 * For CP/NAT/SIT/SSA readahead
93 */ 93 */
94enum { 94enum {
95 META_CP, 95 META_CP,
96 META_NAT, 96 META_NAT,
97 META_SIT 97 META_SIT,
98 META_SSA
98}; 99};
99 100
100/* for the list of orphan inodes */ 101/* for the list of orphan inodes */
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index b161db4a96a4..d94acbc3d928 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -708,6 +708,11 @@ gc_more:
708 goto stop; 708 goto stop;
709 ret = 0; 709 ret = 0;
710 710
711 /* readahead multi ssa blocks those have contiguous address */
712 if (sbi->segs_per_sec > 1)
713 ra_meta_pages(sbi, GET_SUM_BLOCK(sbi, segno), sbi->segs_per_sec,
714 META_SSA);
715
711 for (i = 0; i < sbi->segs_per_sec; i++) 716 for (i = 0; i < sbi->segs_per_sec; i++)
712 do_garbage_collect(sbi, segno + i, &ilist, gc_type); 717 do_garbage_collect(sbi, segno + i, &ilist, gc_type);
713 718