Revert "f2fs: resync with upstream 3.4 branch (forced update)"
This reverts commit 6a1be380100e402aacca6a0a3ac829c059768d79.
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 825025b..3461bc1 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -266,12 +266,6 @@
struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info;
struct flush_cmd cmd;
- trace_f2fs_issue_flush(sbi->sb, test_opt(sbi, NOBARRIER),
- test_opt(sbi, FLUSH_MERGE));
-
- if (test_opt(sbi, NOBARRIER))
- return 0;
-
if (!test_opt(sbi, FLUSH_MERGE))
return blkdev_issue_flush(sbi->sb->s_bdev, GFP_KERNEL, NULL);
@@ -409,8 +403,11 @@
return blkdev_issue_discard(sbi->sb->s_bdev, start, len, GFP_NOFS, 0);
}
-void discard_next_dnode(struct f2fs_sb_info *sbi, block_t blkaddr)
+void discard_next_dnode(struct f2fs_sb_info *sbi)
{
+ struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_WARM_NODE);
+ block_t blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
+
if (f2fs_issue_discard(sbi, blkaddr, 1)) {
struct page *page = grab_meta_page(sbi, blkaddr);
/* zero-filled page */
@@ -466,12 +463,17 @@
static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi)
{
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
- unsigned int segno;
+ unsigned int segno = -1;
unsigned int total_segs = TOTAL_SEGS(sbi);
mutex_lock(&dirty_i->seglist_lock);
- for_each_set_bit(segno, dirty_i->dirty_segmap[PRE], total_segs)
+ while (1) {
+ segno = find_next_bit(dirty_i->dirty_segmap[PRE], total_segs,
+ segno + 1);
+ if (segno >= total_segs)
+ break;
__set_test_and_free(sbi, segno);
+ }
mutex_unlock(&dirty_i->seglist_lock);
}
@@ -998,12 +1000,14 @@
{
struct sit_info *sit_i = SIT_I(sbi);
struct curseg_info *curseg;
+ unsigned int old_cursegno;
curseg = CURSEG_I(sbi, type);
mutex_lock(&curseg->curseg_mutex);
*new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
+ old_cursegno = curseg->segno;
/*
* __add_sum_entry should be resided under the curseg_mutex
@@ -1024,6 +1028,7 @@
* since SSR needs latest valid block information.
*/
refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr);
+ locate_dirty_segment(sbi, old_cursegno);
mutex_unlock(&sit_i->sentry_lock);
@@ -1553,7 +1558,7 @@
struct page *page = NULL;
struct f2fs_sit_block *raw_sit = NULL;
unsigned int start = 0, end = 0;
- unsigned int segno;
+ unsigned int segno = -1;
bool flushed;
mutex_lock(&curseg->curseg_mutex);
@@ -1565,7 +1570,7 @@
*/
flushed = flush_sits_in_journal(sbi);
- for_each_set_bit(segno, bitmap, nsegs) {
+ while ((segno = find_next_bit(bitmap, nsegs, segno + 1)) < nsegs) {
struct seg_entry *se = get_seg_entry(sbi, segno);
int sit_offset, offset;