diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-11 08:46:53 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-11 08:46:53 -0400 |
commit | 336879b1da97fffc097f77c6d6f818660f2826f0 (patch) | |
tree | 4ddb4d1c5d2b67fb096c72e41d2a03b01a605041 /fs/f2fs/segment.c | |
parent | 3d3cbd84300e7be1e53083cac0f6f9c12978ecb4 (diff) | |
parent | fdcaa1dbb7c6ed419b10fb8cdb5001ab0a00538f (diff) |
Merge remote-tracking branch 'airlied/drm-next' into topic/vblank-rework
Dave asked me to do the backmerge before sending him the revised pull
request, so here we go. Nothing fancy in the conflicts, just a few
things changed right next to each another.
Conflicts:
drivers/gpu/drm/drm_irq.c
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d04613df710a..0dfeebae2a50 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -239,6 +239,12 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi) | |||
239 | struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info; | 239 | struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info; |
240 | struct flush_cmd cmd; | 240 | struct flush_cmd cmd; |
241 | 241 | ||
242 | trace_f2fs_issue_flush(sbi->sb, test_opt(sbi, NOBARRIER), | ||
243 | test_opt(sbi, FLUSH_MERGE)); | ||
244 | |||
245 | if (test_opt(sbi, NOBARRIER)) | ||
246 | return 0; | ||
247 | |||
242 | if (!test_opt(sbi, FLUSH_MERGE)) | 248 | if (!test_opt(sbi, FLUSH_MERGE)) |
243 | return blkdev_issue_flush(sbi->sb->s_bdev, GFP_KERNEL, NULL); | 249 | return blkdev_issue_flush(sbi->sb->s_bdev, GFP_KERNEL, NULL); |
244 | 250 | ||
@@ -272,13 +278,13 @@ int create_flush_cmd_control(struct f2fs_sb_info *sbi) | |||
272 | return -ENOMEM; | 278 | return -ENOMEM; |
273 | spin_lock_init(&fcc->issue_lock); | 279 | spin_lock_init(&fcc->issue_lock); |
274 | init_waitqueue_head(&fcc->flush_wait_queue); | 280 | init_waitqueue_head(&fcc->flush_wait_queue); |
275 | sbi->sm_info->cmd_control_info = fcc; | 281 | SM_I(sbi)->cmd_control_info = fcc; |
276 | fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, | 282 | fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, |
277 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); | 283 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); |
278 | if (IS_ERR(fcc->f2fs_issue_flush)) { | 284 | if (IS_ERR(fcc->f2fs_issue_flush)) { |
279 | err = PTR_ERR(fcc->f2fs_issue_flush); | 285 | err = PTR_ERR(fcc->f2fs_issue_flush); |
280 | kfree(fcc); | 286 | kfree(fcc); |
281 | sbi->sm_info->cmd_control_info = NULL; | 287 | SM_I(sbi)->cmd_control_info = NULL; |
282 | return err; | 288 | return err; |
283 | } | 289 | } |
284 | 290 | ||
@@ -287,13 +293,12 @@ int create_flush_cmd_control(struct f2fs_sb_info *sbi) | |||
287 | 293 | ||
288 | void destroy_flush_cmd_control(struct f2fs_sb_info *sbi) | 294 | void destroy_flush_cmd_control(struct f2fs_sb_info *sbi) |
289 | { | 295 | { |
290 | struct flush_cmd_control *fcc = | 296 | struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info; |
291 | sbi->sm_info->cmd_control_info; | ||
292 | 297 | ||
293 | if (fcc && fcc->f2fs_issue_flush) | 298 | if (fcc && fcc->f2fs_issue_flush) |
294 | kthread_stop(fcc->f2fs_issue_flush); | 299 | kthread_stop(fcc->f2fs_issue_flush); |
295 | kfree(fcc); | 300 | kfree(fcc); |
296 | sbi->sm_info->cmd_control_info = NULL; | 301 | SM_I(sbi)->cmd_control_info = NULL; |
297 | } | 302 | } |
298 | 303 | ||
299 | static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, | 304 | static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, |
@@ -377,11 +382,8 @@ static int f2fs_issue_discard(struct f2fs_sb_info *sbi, | |||
377 | return blkdev_issue_discard(sbi->sb->s_bdev, start, len, GFP_NOFS, 0); | 382 | return blkdev_issue_discard(sbi->sb->s_bdev, start, len, GFP_NOFS, 0); |
378 | } | 383 | } |
379 | 384 | ||
380 | void discard_next_dnode(struct f2fs_sb_info *sbi) | 385 | void discard_next_dnode(struct f2fs_sb_info *sbi, block_t blkaddr) |
381 | { | 386 | { |
382 | struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_WARM_NODE); | ||
383 | block_t blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); | ||
384 | |||
385 | if (f2fs_issue_discard(sbi, blkaddr, 1)) { | 387 | if (f2fs_issue_discard(sbi, blkaddr, 1)) { |
386 | struct page *page = grab_meta_page(sbi, blkaddr); | 388 | struct page *page = grab_meta_page(sbi, blkaddr); |
387 | /* zero-filled page */ | 389 | /* zero-filled page */ |
@@ -437,17 +439,12 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, | |||
437 | static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi) | 439 | static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi) |
438 | { | 440 | { |
439 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); | 441 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); |
440 | unsigned int segno = -1; | 442 | unsigned int segno; |
441 | unsigned int total_segs = TOTAL_SEGS(sbi); | 443 | unsigned int total_segs = TOTAL_SEGS(sbi); |
442 | 444 | ||
443 | mutex_lock(&dirty_i->seglist_lock); | 445 | mutex_lock(&dirty_i->seglist_lock); |
444 | while (1) { | 446 | for_each_set_bit(segno, dirty_i->dirty_segmap[PRE], total_segs) |
445 | segno = find_next_bit(dirty_i->dirty_segmap[PRE], total_segs, | ||
446 | segno + 1); | ||
447 | if (segno >= total_segs) | ||
448 | break; | ||
449 | __set_test_and_free(sbi, segno); | 447 | __set_test_and_free(sbi, segno); |
450 | } | ||
451 | mutex_unlock(&dirty_i->seglist_lock); | 448 | mutex_unlock(&dirty_i->seglist_lock); |
452 | } | 449 | } |
453 | 450 | ||
@@ -974,14 +971,12 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, | |||
974 | { | 971 | { |
975 | struct sit_info *sit_i = SIT_I(sbi); | 972 | struct sit_info *sit_i = SIT_I(sbi); |
976 | struct curseg_info *curseg; | 973 | struct curseg_info *curseg; |
977 | unsigned int old_cursegno; | ||
978 | 974 | ||
979 | curseg = CURSEG_I(sbi, type); | 975 | curseg = CURSEG_I(sbi, type); |
980 | 976 | ||
981 | mutex_lock(&curseg->curseg_mutex); | 977 | mutex_lock(&curseg->curseg_mutex); |
982 | 978 | ||
983 | *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); | 979 | *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); |
984 | old_cursegno = curseg->segno; | ||
985 | 980 | ||
986 | /* | 981 | /* |
987 | * __add_sum_entry should be resided under the curseg_mutex | 982 | * __add_sum_entry should be resided under the curseg_mutex |
@@ -1002,7 +997,6 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, | |||
1002 | * since SSR needs latest valid block information. | 997 | * since SSR needs latest valid block information. |
1003 | */ | 998 | */ |
1004 | refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); | 999 | refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); |
1005 | locate_dirty_segment(sbi, old_cursegno); | ||
1006 | 1000 | ||
1007 | mutex_unlock(&sit_i->sentry_lock); | 1001 | mutex_unlock(&sit_i->sentry_lock); |
1008 | 1002 | ||
@@ -1532,7 +1526,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi) | |||
1532 | struct page *page = NULL; | 1526 | struct page *page = NULL; |
1533 | struct f2fs_sit_block *raw_sit = NULL; | 1527 | struct f2fs_sit_block *raw_sit = NULL; |
1534 | unsigned int start = 0, end = 0; | 1528 | unsigned int start = 0, end = 0; |
1535 | unsigned int segno = -1; | 1529 | unsigned int segno; |
1536 | bool flushed; | 1530 | bool flushed; |
1537 | 1531 | ||
1538 | mutex_lock(&curseg->curseg_mutex); | 1532 | mutex_lock(&curseg->curseg_mutex); |
@@ -1544,7 +1538,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi) | |||
1544 | */ | 1538 | */ |
1545 | flushed = flush_sits_in_journal(sbi); | 1539 | flushed = flush_sits_in_journal(sbi); |
1546 | 1540 | ||
1547 | while ((segno = find_next_bit(bitmap, nsegs, segno + 1)) < nsegs) { | 1541 | for_each_set_bit(segno, bitmap, nsegs) { |
1548 | struct seg_entry *se = get_seg_entry(sbi, segno); | 1542 | struct seg_entry *se = get_seg_entry(sbi, segno); |
1549 | int sit_offset, offset; | 1543 | int sit_offset, offset; |
1550 | 1544 | ||
@@ -1703,7 +1697,7 @@ static int build_curseg(struct f2fs_sb_info *sbi) | |||
1703 | struct curseg_info *array; | 1697 | struct curseg_info *array; |
1704 | int i; | 1698 | int i; |
1705 | 1699 | ||
1706 | array = kzalloc(sizeof(*array) * NR_CURSEG_TYPE, GFP_KERNEL); | 1700 | array = kcalloc(NR_CURSEG_TYPE, sizeof(*array), GFP_KERNEL); |
1707 | if (!array) | 1701 | if (!array) |
1708 | return -ENOMEM; | 1702 | return -ENOMEM; |
1709 | 1703 | ||