diff options
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r-- | fs/f2fs/checkpoint.c | 186 |
1 files changed, 115 insertions, 71 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index dd10a031c052..e6c271fefaca 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -72,36 +72,36 @@ out: | |||
72 | return page; | 72 | return page; |
73 | } | 73 | } |
74 | 74 | ||
75 | struct page *get_meta_page_ra(struct f2fs_sb_info *sbi, pgoff_t index) | 75 | static inline bool is_valid_blkaddr(struct f2fs_sb_info *sbi, |
76 | { | 76 | block_t blkaddr, int type) |
77 | bool readahead = false; | ||
78 | struct page *page; | ||
79 | |||
80 | page = find_get_page(META_MAPPING(sbi), index); | ||
81 | if (!page || (page && !PageUptodate(page))) | ||
82 | readahead = true; | ||
83 | f2fs_put_page(page, 0); | ||
84 | |||
85 | if (readahead) | ||
86 | ra_meta_pages(sbi, index, MAX_BIO_BLOCKS(sbi), META_POR); | ||
87 | return get_meta_page(sbi, index); | ||
88 | } | ||
89 | |||
90 | static inline block_t get_max_meta_blks(struct f2fs_sb_info *sbi, int type) | ||
91 | { | 77 | { |
92 | switch (type) { | 78 | switch (type) { |
93 | case META_NAT: | 79 | case META_NAT: |
94 | return NM_I(sbi)->max_nid / NAT_ENTRY_PER_BLOCK; | 80 | break; |
95 | case META_SIT: | 81 | case META_SIT: |
96 | return SIT_BLK_CNT(sbi); | 82 | if (unlikely(blkaddr >= SIT_BLK_CNT(sbi))) |
83 | return false; | ||
84 | break; | ||
97 | case META_SSA: | 85 | case META_SSA: |
86 | if (unlikely(blkaddr >= MAIN_BLKADDR(sbi) || | ||
87 | blkaddr < SM_I(sbi)->ssa_blkaddr)) | ||
88 | return false; | ||
89 | break; | ||
98 | case META_CP: | 90 | case META_CP: |
99 | return 0; | 91 | if (unlikely(blkaddr >= SIT_I(sbi)->sit_base_addr || |
92 | blkaddr < __start_cp_addr(sbi))) | ||
93 | return false; | ||
94 | break; | ||
100 | case META_POR: | 95 | case META_POR: |
101 | return MAX_BLKADDR(sbi); | 96 | if (unlikely(blkaddr >= MAX_BLKADDR(sbi) || |
97 | blkaddr < MAIN_BLKADDR(sbi))) | ||
98 | return false; | ||
99 | break; | ||
102 | default: | 100 | default: |
103 | BUG(); | 101 | BUG(); |
104 | } | 102 | } |
103 | |||
104 | return true; | ||
105 | } | 105 | } |
106 | 106 | ||
107 | /* | 107 | /* |
@@ -112,7 +112,6 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type | |||
112 | block_t prev_blk_addr = 0; | 112 | block_t prev_blk_addr = 0; |
113 | struct page *page; | 113 | struct page *page; |
114 | block_t blkno = start; | 114 | block_t blkno = start; |
115 | block_t max_blks = get_max_meta_blks(sbi, type); | ||
116 | 115 | ||
117 | struct f2fs_io_info fio = { | 116 | struct f2fs_io_info fio = { |
118 | .type = META, | 117 | .type = META, |
@@ -122,18 +121,20 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type | |||
122 | for (; nrpages-- > 0; blkno++) { | 121 | for (; nrpages-- > 0; blkno++) { |
123 | block_t blk_addr; | 122 | block_t blk_addr; |
124 | 123 | ||
124 | if (!is_valid_blkaddr(sbi, blkno, type)) | ||
125 | goto out; | ||
126 | |||
125 | switch (type) { | 127 | switch (type) { |
126 | case META_NAT: | 128 | case META_NAT: |
127 | /* get nat block addr */ | 129 | if (unlikely(blkno >= |
128 | if (unlikely(blkno >= max_blks)) | 130 | NAT_BLOCK_OFFSET(NM_I(sbi)->max_nid))) |
129 | blkno = 0; | 131 | blkno = 0; |
132 | /* get nat block addr */ | ||
130 | blk_addr = current_nat_addr(sbi, | 133 | blk_addr = current_nat_addr(sbi, |
131 | blkno * NAT_ENTRY_PER_BLOCK); | 134 | blkno * NAT_ENTRY_PER_BLOCK); |
132 | break; | 135 | break; |
133 | case META_SIT: | 136 | case META_SIT: |
134 | /* get sit block addr */ | 137 | /* get sit block addr */ |
135 | if (unlikely(blkno >= max_blks)) | ||
136 | goto out; | ||
137 | blk_addr = current_sit_addr(sbi, | 138 | blk_addr = current_sit_addr(sbi, |
138 | blkno * SIT_ENTRY_PER_BLOCK); | 139 | blkno * SIT_ENTRY_PER_BLOCK); |
139 | if (blkno != start && prev_blk_addr + 1 != blk_addr) | 140 | if (blkno != start && prev_blk_addr + 1 != blk_addr) |
@@ -143,10 +144,6 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type | |||
143 | case META_SSA: | 144 | case META_SSA: |
144 | case META_CP: | 145 | case META_CP: |
145 | case META_POR: | 146 | case META_POR: |
146 | if (unlikely(blkno >= max_blks)) | ||
147 | goto out; | ||
148 | if (unlikely(blkno < SEG0_BLKADDR(sbi))) | ||
149 | goto out; | ||
150 | blk_addr = blkno; | 147 | blk_addr = blkno; |
151 | break; | 148 | break; |
152 | default: | 149 | default: |
@@ -169,6 +166,20 @@ out: | |||
169 | return blkno - start; | 166 | return blkno - start; |
170 | } | 167 | } |
171 | 168 | ||
169 | void ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index) | ||
170 | { | ||
171 | struct page *page; | ||
172 | bool readahead = false; | ||
173 | |||
174 | page = find_get_page(META_MAPPING(sbi), index); | ||
175 | if (!page || (page && !PageUptodate(page))) | ||
176 | readahead = true; | ||
177 | f2fs_put_page(page, 0); | ||
178 | |||
179 | if (readahead) | ||
180 | ra_meta_pages(sbi, index, MAX_BIO_BLOCKS(sbi), META_POR); | ||
181 | } | ||
182 | |||
172 | static int f2fs_write_meta_page(struct page *page, | 183 | static int f2fs_write_meta_page(struct page *page, |
173 | struct writeback_control *wbc) | 184 | struct writeback_control *wbc) |
174 | { | 185 | { |
@@ -178,7 +189,7 @@ static int f2fs_write_meta_page(struct page *page, | |||
178 | 189 | ||
179 | if (unlikely(sbi->por_doing)) | 190 | if (unlikely(sbi->por_doing)) |
180 | goto redirty_out; | 191 | goto redirty_out; |
181 | if (wbc->for_reclaim) | 192 | if (wbc->for_reclaim && page->index < GET_SUM_BLOCK(sbi, 0)) |
182 | goto redirty_out; | 193 | goto redirty_out; |
183 | if (unlikely(f2fs_cp_error(sbi))) | 194 | if (unlikely(f2fs_cp_error(sbi))) |
184 | goto redirty_out; | 195 | goto redirty_out; |
@@ -187,6 +198,9 @@ static int f2fs_write_meta_page(struct page *page, | |||
187 | write_meta_page(sbi, page); | 198 | write_meta_page(sbi, page); |
188 | dec_page_count(sbi, F2FS_DIRTY_META); | 199 | dec_page_count(sbi, F2FS_DIRTY_META); |
189 | unlock_page(page); | 200 | unlock_page(page); |
201 | |||
202 | if (wbc->for_reclaim) | ||
203 | f2fs_submit_merged_bio(sbi, META, WRITE); | ||
190 | return 0; | 204 | return 0; |
191 | 205 | ||
192 | redirty_out: | 206 | redirty_out: |
@@ -298,46 +312,57 @@ const struct address_space_operations f2fs_meta_aops = { | |||
298 | 312 | ||
299 | static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type) | 313 | static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type) |
300 | { | 314 | { |
315 | struct inode_management *im = &sbi->im[type]; | ||
301 | struct ino_entry *e; | 316 | struct ino_entry *e; |
302 | retry: | 317 | retry: |
303 | spin_lock(&sbi->ino_lock[type]); | 318 | if (radix_tree_preload(GFP_NOFS)) { |
319 | cond_resched(); | ||
320 | goto retry; | ||
321 | } | ||
322 | |||
323 | spin_lock(&im->ino_lock); | ||
304 | 324 | ||
305 | e = radix_tree_lookup(&sbi->ino_root[type], ino); | 325 | e = radix_tree_lookup(&im->ino_root, ino); |
306 | if (!e) { | 326 | if (!e) { |
307 | e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC); | 327 | e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC); |
308 | if (!e) { | 328 | if (!e) { |
309 | spin_unlock(&sbi->ino_lock[type]); | 329 | spin_unlock(&im->ino_lock); |
330 | radix_tree_preload_end(); | ||
310 | goto retry; | 331 | goto retry; |
311 | } | 332 | } |
312 | if (radix_tree_insert(&sbi->ino_root[type], ino, e)) { | 333 | if (radix_tree_insert(&im->ino_root, ino, e)) { |
313 | spin_unlock(&sbi->ino_lock[type]); | 334 | spin_unlock(&im->ino_lock); |
314 | kmem_cache_free(ino_entry_slab, e); | 335 | kmem_cache_free(ino_entry_slab, e); |
336 | radix_tree_preload_end(); | ||
315 | goto retry; | 337 | goto retry; |
316 | } | 338 | } |
317 | memset(e, 0, sizeof(struct ino_entry)); | 339 | memset(e, 0, sizeof(struct ino_entry)); |
318 | e->ino = ino; | 340 | e->ino = ino; |
319 | 341 | ||
320 | list_add_tail(&e->list, &sbi->ino_list[type]); | 342 | list_add_tail(&e->list, &im->ino_list); |
343 | if (type != ORPHAN_INO) | ||
344 | im->ino_num++; | ||
321 | } | 345 | } |
322 | spin_unlock(&sbi->ino_lock[type]); | 346 | spin_unlock(&im->ino_lock); |
347 | radix_tree_preload_end(); | ||
323 | } | 348 | } |
324 | 349 | ||
325 | static void __remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type) | 350 | static void __remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, int type) |
326 | { | 351 | { |
352 | struct inode_management *im = &sbi->im[type]; | ||
327 | struct ino_entry *e; | 353 | struct ino_entry *e; |
328 | 354 | ||
329 | spin_lock(&sbi->ino_lock[type]); | 355 | spin_lock(&im->ino_lock); |
330 | e = radix_tree_lookup(&sbi->ino_root[type], ino); | 356 | e = radix_tree_lookup(&im->ino_root, ino); |
331 | if (e) { | 357 | if (e) { |
332 | list_del(&e->list); | 358 | list_del(&e->list); |
333 | radix_tree_delete(&sbi->ino_root[type], ino); | 359 | radix_tree_delete(&im->ino_root, ino); |
334 | if (type == ORPHAN_INO) | 360 | im->ino_num--; |
335 | sbi->n_orphans--; | 361 | spin_unlock(&im->ino_lock); |
336 | spin_unlock(&sbi->ino_lock[type]); | ||
337 | kmem_cache_free(ino_entry_slab, e); | 362 | kmem_cache_free(ino_entry_slab, e); |
338 | return; | 363 | return; |
339 | } | 364 | } |
340 | spin_unlock(&sbi->ino_lock[type]); | 365 | spin_unlock(&im->ino_lock); |
341 | } | 366 | } |
342 | 367 | ||
343 | void add_dirty_inode(struct f2fs_sb_info *sbi, nid_t ino, int type) | 368 | void add_dirty_inode(struct f2fs_sb_info *sbi, nid_t ino, int type) |
@@ -355,10 +380,12 @@ void remove_dirty_inode(struct f2fs_sb_info *sbi, nid_t ino, int type) | |||
355 | /* mode should be APPEND_INO or UPDATE_INO */ | 380 | /* mode should be APPEND_INO or UPDATE_INO */ |
356 | bool exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode) | 381 | bool exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode) |
357 | { | 382 | { |
383 | struct inode_management *im = &sbi->im[mode]; | ||
358 | struct ino_entry *e; | 384 | struct ino_entry *e; |
359 | spin_lock(&sbi->ino_lock[mode]); | 385 | |
360 | e = radix_tree_lookup(&sbi->ino_root[mode], ino); | 386 | spin_lock(&im->ino_lock); |
361 | spin_unlock(&sbi->ino_lock[mode]); | 387 | e = radix_tree_lookup(&im->ino_root, ino); |
388 | spin_unlock(&im->ino_lock); | ||
362 | return e ? true : false; | 389 | return e ? true : false; |
363 | } | 390 | } |
364 | 391 | ||
@@ -368,36 +395,42 @@ void release_dirty_inode(struct f2fs_sb_info *sbi) | |||
368 | int i; | 395 | int i; |
369 | 396 | ||
370 | for (i = APPEND_INO; i <= UPDATE_INO; i++) { | 397 | for (i = APPEND_INO; i <= UPDATE_INO; i++) { |
371 | spin_lock(&sbi->ino_lock[i]); | 398 | struct inode_management *im = &sbi->im[i]; |
372 | list_for_each_entry_safe(e, tmp, &sbi->ino_list[i], list) { | 399 | |
400 | spin_lock(&im->ino_lock); | ||
401 | list_for_each_entry_safe(e, tmp, &im->ino_list, list) { | ||
373 | list_del(&e->list); | 402 | list_del(&e->list); |
374 | radix_tree_delete(&sbi->ino_root[i], e->ino); | 403 | radix_tree_delete(&im->ino_root, e->ino); |
375 | kmem_cache_free(ino_entry_slab, e); | 404 | kmem_cache_free(ino_entry_slab, e); |
405 | im->ino_num--; | ||
376 | } | 406 | } |
377 | spin_unlock(&sbi->ino_lock[i]); | 407 | spin_unlock(&im->ino_lock); |
378 | } | 408 | } |
379 | } | 409 | } |
380 | 410 | ||
381 | int acquire_orphan_inode(struct f2fs_sb_info *sbi) | 411 | int acquire_orphan_inode(struct f2fs_sb_info *sbi) |
382 | { | 412 | { |
413 | struct inode_management *im = &sbi->im[ORPHAN_INO]; | ||
383 | int err = 0; | 414 | int err = 0; |
384 | 415 | ||
385 | spin_lock(&sbi->ino_lock[ORPHAN_INO]); | 416 | spin_lock(&im->ino_lock); |
386 | if (unlikely(sbi->n_orphans >= sbi->max_orphans)) | 417 | if (unlikely(im->ino_num >= sbi->max_orphans)) |
387 | err = -ENOSPC; | 418 | err = -ENOSPC; |
388 | else | 419 | else |
389 | sbi->n_orphans++; | 420 | im->ino_num++; |
390 | spin_unlock(&sbi->ino_lock[ORPHAN_INO]); | 421 | spin_unlock(&im->ino_lock); |
391 | 422 | ||
392 | return err; | 423 | return err; |
393 | } | 424 | } |
394 | 425 | ||
395 | void release_orphan_inode(struct f2fs_sb_info *sbi) | 426 | void release_orphan_inode(struct f2fs_sb_info *sbi) |
396 | { | 427 | { |
397 | spin_lock(&sbi->ino_lock[ORPHAN_INO]); | 428 | struct inode_management *im = &sbi->im[ORPHAN_INO]; |
398 | f2fs_bug_on(sbi, sbi->n_orphans == 0); | 429 | |
399 | sbi->n_orphans--; | 430 | spin_lock(&im->ino_lock); |
400 | spin_unlock(&sbi->ino_lock[ORPHAN_INO]); | 431 | f2fs_bug_on(sbi, im->ino_num == 0); |
432 | im->ino_num--; | ||
433 | spin_unlock(&im->ino_lock); | ||
401 | } | 434 | } |
402 | 435 | ||
403 | void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) | 436 | void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) |
@@ -460,17 +493,19 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) | |||
460 | struct f2fs_orphan_block *orphan_blk = NULL; | 493 | struct f2fs_orphan_block *orphan_blk = NULL; |
461 | unsigned int nentries = 0; | 494 | unsigned int nentries = 0; |
462 | unsigned short index; | 495 | unsigned short index; |
463 | unsigned short orphan_blocks = | 496 | unsigned short orphan_blocks; |
464 | (unsigned short)GET_ORPHAN_BLOCKS(sbi->n_orphans); | ||
465 | struct page *page = NULL; | 497 | struct page *page = NULL; |
466 | struct ino_entry *orphan = NULL; | 498 | struct ino_entry *orphan = NULL; |
499 | struct inode_management *im = &sbi->im[ORPHAN_INO]; | ||
500 | |||
501 | orphan_blocks = GET_ORPHAN_BLOCKS(im->ino_num); | ||
467 | 502 | ||
468 | for (index = 0; index < orphan_blocks; index++) | 503 | for (index = 0; index < orphan_blocks; index++) |
469 | grab_meta_page(sbi, start_blk + index); | 504 | grab_meta_page(sbi, start_blk + index); |
470 | 505 | ||
471 | index = 1; | 506 | index = 1; |
472 | spin_lock(&sbi->ino_lock[ORPHAN_INO]); | 507 | spin_lock(&im->ino_lock); |
473 | head = &sbi->ino_list[ORPHAN_INO]; | 508 | head = &im->ino_list; |
474 | 509 | ||
475 | /* loop for each orphan inode entry and write them in Jornal block */ | 510 | /* loop for each orphan inode entry and write them in Jornal block */ |
476 | list_for_each_entry(orphan, head, list) { | 511 | list_for_each_entry(orphan, head, list) { |
@@ -510,7 +545,7 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) | |||
510 | f2fs_put_page(page, 1); | 545 | f2fs_put_page(page, 1); |
511 | } | 546 | } |
512 | 547 | ||
513 | spin_unlock(&sbi->ino_lock[ORPHAN_INO]); | 548 | spin_unlock(&im->ino_lock); |
514 | } | 549 | } |
515 | 550 | ||
516 | static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, | 551 | static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, |
@@ -731,6 +766,9 @@ void sync_dirty_dir_inodes(struct f2fs_sb_info *sbi) | |||
731 | struct dir_inode_entry *entry; | 766 | struct dir_inode_entry *entry; |
732 | struct inode *inode; | 767 | struct inode *inode; |
733 | retry: | 768 | retry: |
769 | if (unlikely(f2fs_cp_error(sbi))) | ||
770 | return; | ||
771 | |||
734 | spin_lock(&sbi->dir_inode_lock); | 772 | spin_lock(&sbi->dir_inode_lock); |
735 | 773 | ||
736 | head = &sbi->dir_inode_list; | 774 | head = &sbi->dir_inode_list; |
@@ -830,6 +868,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
830 | struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); | 868 | struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi); |
831 | struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_WARM_NODE); | 869 | struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_WARM_NODE); |
832 | struct f2fs_nm_info *nm_i = NM_I(sbi); | 870 | struct f2fs_nm_info *nm_i = NM_I(sbi); |
871 | unsigned long orphan_num = sbi->im[ORPHAN_INO].ino_num; | ||
833 | nid_t last_nid = nm_i->next_scan_nid; | 872 | nid_t last_nid = nm_i->next_scan_nid; |
834 | block_t start_blk; | 873 | block_t start_blk; |
835 | struct page *cp_page; | 874 | struct page *cp_page; |
@@ -889,7 +928,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
889 | else | 928 | else |
890 | clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); | 929 | clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); |
891 | 930 | ||
892 | orphan_blocks = GET_ORPHAN_BLOCKS(sbi->n_orphans); | 931 | orphan_blocks = GET_ORPHAN_BLOCKS(orphan_num); |
893 | ckpt->cp_pack_start_sum = cpu_to_le32(1 + cp_payload_blks + | 932 | ckpt->cp_pack_start_sum = cpu_to_le32(1 + cp_payload_blks + |
894 | orphan_blocks); | 933 | orphan_blocks); |
895 | 934 | ||
@@ -905,7 +944,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
905 | orphan_blocks); | 944 | orphan_blocks); |
906 | } | 945 | } |
907 | 946 | ||
908 | if (sbi->n_orphans) | 947 | if (orphan_num) |
909 | set_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); | 948 | set_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); |
910 | else | 949 | else |
911 | clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); | 950 | clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG); |
@@ -940,7 +979,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
940 | f2fs_put_page(cp_page, 1); | 979 | f2fs_put_page(cp_page, 1); |
941 | } | 980 | } |
942 | 981 | ||
943 | if (sbi->n_orphans) { | 982 | if (orphan_num) { |
944 | write_orphan_inodes(sbi, start_blk); | 983 | write_orphan_inodes(sbi, start_blk); |
945 | start_blk += orphan_blocks; | 984 | start_blk += orphan_blocks; |
946 | } | 985 | } |
@@ -975,6 +1014,9 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
975 | /* Here, we only have one bio having CP pack */ | 1014 | /* Here, we only have one bio having CP pack */ |
976 | sync_meta_pages(sbi, META_FLUSH, LONG_MAX); | 1015 | sync_meta_pages(sbi, META_FLUSH, LONG_MAX); |
977 | 1016 | ||
1017 | /* wait for previous submitted meta pages writeback */ | ||
1018 | wait_on_all_pages_writeback(sbi); | ||
1019 | |||
978 | release_dirty_inode(sbi); | 1020 | release_dirty_inode(sbi); |
979 | 1021 | ||
980 | if (unlikely(f2fs_cp_error(sbi))) | 1022 | if (unlikely(f2fs_cp_error(sbi))) |
@@ -1036,9 +1078,12 @@ void init_ino_entry_info(struct f2fs_sb_info *sbi) | |||
1036 | int i; | 1078 | int i; |
1037 | 1079 | ||
1038 | for (i = 0; i < MAX_INO_ENTRY; i++) { | 1080 | for (i = 0; i < MAX_INO_ENTRY; i++) { |
1039 | INIT_RADIX_TREE(&sbi->ino_root[i], GFP_ATOMIC); | 1081 | struct inode_management *im = &sbi->im[i]; |
1040 | spin_lock_init(&sbi->ino_lock[i]); | 1082 | |
1041 | INIT_LIST_HEAD(&sbi->ino_list[i]); | 1083 | INIT_RADIX_TREE(&im->ino_root, GFP_ATOMIC); |
1084 | spin_lock_init(&im->ino_lock); | ||
1085 | INIT_LIST_HEAD(&im->ino_list); | ||
1086 | im->ino_num = 0; | ||
1042 | } | 1087 | } |
1043 | 1088 | ||
1044 | /* | 1089 | /* |
@@ -1047,7 +1092,6 @@ void init_ino_entry_info(struct f2fs_sb_info *sbi) | |||
1047 | * orphan entries with the limitation one reserved segment | 1092 | * orphan entries with the limitation one reserved segment |
1048 | * for cp pack we can have max 1020*504 orphan entries | 1093 | * for cp pack we can have max 1020*504 orphan entries |
1049 | */ | 1094 | */ |
1050 | sbi->n_orphans = 0; | ||
1051 | sbi->max_orphans = (sbi->blocks_per_seg - F2FS_CP_PACKS - | 1095 | sbi->max_orphans = (sbi->blocks_per_seg - F2FS_CP_PACKS - |
1052 | NR_CURSEG_TYPE) * F2FS_ORPHANS_PER_BLOCK; | 1096 | NR_CURSEG_TYPE) * F2FS_ORPHANS_PER_BLOCK; |
1053 | } | 1097 | } |