1. 13 3月, 2018 6 次提交
  2. 26 1月, 2018 3 次提交
    • Y
      f2fs: rebuild sit page from sit info in mem · 068c3cd8
      Yunlei He 提交于
      This patch rebuild sit page from sit info in mem instead
      of issue a read io.
      
      I test this method and the result is as below:
      
      Pre:
       mmc_perf_test-12061 [001] ...1   976.819992: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [001] ...1   976.856446: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [003] ...1   998.976946: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [003] ...1   999.023269: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [003] ...1  1022.060772: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [003] ...1  1022.111034: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [002] ...1  1070.127643: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [003] ...1  1070.187352: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [003] ...1  1095.942124: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [003] ...1  1095.995975: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [003] ...1  1122.535091: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [003] ...1  1122.586521: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [001] ...1  1147.897487: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [001] ...1  1147.959438: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [003] ...1  1177.926951: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [002] ...1  1177.976823: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
       mmc_perf_test-12061 [002] ...1  1204.176087: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
       mmc_perf_test-12061 [002] ...1  1204.239046: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      
      Some sit flush consume more than 50ms.
      
      Now:
      mmc_perf_test-2187  [007] ...1   196.840684: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [007] ...1   196.841258: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [007] ...1   219.430582: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [007] ...1   219.431144: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [002] ...1   243.638678: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [000] ...1   243.638980: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [002] ...1   265.392180: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [002] ...1   265.392245: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [000] ...1   290.309051: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [000] ...1   290.309116: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [003] ...1   317.144209: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [003] ...1   317.145913: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [005] ...1   343.224954: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [005] ...1   343.225574: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [000] ...1   370.239846: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [000] ...1   370.241138: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [001] ...1   397.029043: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [001] ...1   397.030750: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      mmc_perf_test-2187  [003] ...1   425.386377: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = start flush sit
      mmc_perf_test-2187  [003] ...1   425.387735: f2fs_write_checkpoint: dev = (259,44), checkpoint for Sync, state = end flush sit
      
      Most sit flush consume no more than 1ms.
      Signed-off-by: NYunlei He <heyunlei@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      068c3cd8
    • C
      f2fs: stop issuing discard if fs is readonly · 3b60d802
      Chao Yu 提交于
      If filesystem is readonly, stop to issue discard in daemon.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      3b60d802
    • C
      f2fs: clean up duplicated assignment in init_discard_policy · 6819b884
      Chao Yu 提交于
      Remove duplicated codes of assignment for .max_requests and .io_aware_gran.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      6819b884
  3. 23 1月, 2018 1 次提交
  4. 19 1月, 2018 1 次提交
  5. 17 1月, 2018 3 次提交
    • C
      f2fs: avoid high cpu usage in discard thread · 49c60c67
      Chao Yu 提交于
      We take very long time to finish generic/476, this is because we will
      check consistence of all discard entries in global rb tree while
      traversing all different granularity pending lists, even when the list
      is empty, in order to avoid that unneeded overhead, we have to skip
      the check when coming up an empty list.
      
      generic/476 time consumption:
      					cost
      Before patch & w/o consistence check	57s
      Before patch & w/ consistence check	1426s
      After patch				78s
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      49c60c67
    • W
      f2fs: make local functions static · 94b1e10e
      Wei Yongjun 提交于
      Fixes the following sparse warnings:
      
      fs/f2fs/segment.c:887:6: warning:
       symbol '__check_sit_bitmap' was not declared. Should it be static?
      fs/f2fs/segment.c:1327:6: warning:
       symbol 'f2fs_wait_discard_bio' was not declared. Should it be static?
      fs/f2fs/super.c:1661:5: warning:
       symbol 'f2fs_get_projid' was not declared. Should it be static?
      Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      94b1e10e
    • Y
      f2fs: check segment type in __f2fs_replace_block · 2c190504
      Yunlong Song 提交于
      In some case, the node blocks has wrong blkaddr whose segment type is
      NODE, e.g., recover inode has missing xattr flag and the blkaddr is in
      the xattr range. Since fsck.f2fs does not check the recovery nodes, this
      will cause __f2fs_replace_block change the curseg of node and do the
      update_sit_entry(sbi, new_blkaddr, 1) with no next_blkoff refresh, as a
      result, when recovery process write checkpoint and sync nodes, the
      next_blkoff of curseg is used in the segment bit map, then it will
      cause f2fs_bug_on. So let's check segment type in __f2fs_replace_block.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      2c190504
  6. 03 1月, 2018 5 次提交
  7. 10 11月, 2017 1 次提交
  8. 06 11月, 2017 7 次提交
  9. 26 10月, 2017 8 次提交
    • C
      f2fs: remove several redundant assignments · dca6951f
      Colin Ian King 提交于
      There are several assignments to variables that are redundant
      as the values are never read when the variables are updated later
      and so the redundant statements can be safely removed.
      
      Cleans up clang warnings:
      fs/f2fs/segment.c:923:19: warning: Value stored to 'p' during its initialization is never read
      fs/f2fs/segment.c:2060:2: warning: Value stored to 'hint' is never read
      fs/f2fs/segment.c:2353:2: warning: Value stored to 'start_block' is never read
      fs/f2fs/segment.c:2354:2: warning: Value stored to 'end_block' is never read
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      dca6951f
    • J
      f2fs: limit # of inmemory pages · 57864ae5
      Jaegeuk Kim 提交于
      If some abnormal users try lots of atomic write operations, f2fs is able to
      produce pinned pages in the main memory which affects system performance.
      This patch limits that as 20% over total memory size, and if f2fs reaches
      to the limit, it will drop all the inmemory pages.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      57864ae5
    • C
      f2fs: give up CP_TRIMMED_FLAG if it drops discards · cf5c759f
      Chao Yu 提交于
      In ->umount, once we drop remained discard entries, we should not
      set CP_TRIMMED_FLAG with another checkpoint.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      cf5c759f
    • C
      f2fs: trace f2fs_remove_discard · 2ec6f2ef
      Chao Yu 提交于
      This patch adds tracepoint to trace f2fs_remove_discard.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      2ec6f2ef
    • C
      f2fs: reduce cmd_lock coverage in __issue_discard_cmd · 33da62cf
      Chao Yu 提交于
      __submit_discard_cmd may lead long latency due to exhaustion of I/O
      request resource in block layer, so issuing all discard under cmd_lock
      may lead to hangtask, in order to avoid that, let's reduce it's coverage.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      33da62cf
    • C
      f2fs: split discard policy · 78997b56
      Chao Yu 提交于
      There are many different scenarios such as fstrim, umount, urgent or
      background where we will issue discards, actually, they need use
      different policy in aspect of io aware, discard granularity, delay
      interval and so on. But now they just share one common discard policy,
      so there will be race when changing policy in between these scenarios,
      the interference of changing discard policy will be very serious.
      
      This patch changes to split discard policy for different scenarios.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      78997b56
    • C
      f2fs: wrap discard policy · ecc9aa00
      Chao Yu 提交于
      This patch wraps scattered optional parameters into discard policy as
      below, later, with it we expect that we can adjust these parameters with
      proper strategy in different scenario.
      
      struct discard_policy {
      	unsigned int min_interval;	/* used for candidates exist */
      	unsigned int max_interval;	/* used for candidates not exist */
      	unsigned int max_requests;	/* # of discards issued per round */
      	unsigned int io_aware_gran;	/* minimum granularity discard not be aware of I/O */
      	bool io_aware;			/* issue discard in idle time */
      	bool sync;			/* submit discard with REQ_SYNC flag */
      };
      
      This patch doesn't change any logic of codes.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ecc9aa00
    • C
      f2fs: support issuing/waiting discard in range · 8412663d
      Chao Yu 提交于
      Fstrim intends to trim invalid blocks of filesystem only with specified
      range and granularity, but actually, it will issue all previous cached
      discard commands which may be out-of-range and be with unmatched
      granularity, it's unneeded.
      
      In order to fix above issues, this patch introduces new helps to support
      to issue and wait discard in range and adds a new fstrim_list for tracking
      in-flight discard from ->fstrim.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      8412663d
  10. 11 10月, 2017 2 次提交
    • C
      f2fs: fix to flush multiple device in checkpoint · 1228b482
      Chao Yu 提交于
      If f2fs manages multiple devices, in checkpoint, we need to issue flush
      in those devices which contain dirty data/node in their cache before
      we write checkpoint region, otherwise, filesystem metadata could be
      corrupted if hitting SPO after checkpoint.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1228b482
    • C
      f2fs: enhance multiple device flush · 39d787be
      Chao Yu 提交于
      When multiple device feature is enabled, during ->fsync we will issue
      flush in all devices to make sure node/data of the file being persisted
      into storage. But some flushes of device could be unneeded as file's
      data may be not writebacked into those devices. So this patch adds and
      manage bitmap per inode in global cache to indicate which device is
      dirty and it needs to issue flush during ->fsync, hence, we could improve
      performance of fsync in scenario of multiple device.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      39d787be
  11. 03 10月, 2017 1 次提交
    • C
      f2fs: fix potential panic during fstrim · 638164a2
      Chao Yu 提交于
      As Ju Hyung Park reported:
      
      "When 'fstrim' is called for manual trim, a BUG() can be triggered
      randomly with this patch.
      
      I'm seeing this issue on both x86 Desktop and arm64 Android phone.
      
      On x86 Desktop, this was caused during Ubuntu boot-up. I have a
      cronjob installed which calls 'fstrim -v /' during boot. On arm64
      Android, this was caused during GC looping with 1ms gc_min_sleep_time
      & gc_max_sleep_time."
      
      Root cause of this issue is that f2fs_wait_discard_bios can only be
      used by f2fs_put_super, because during put_super there must be no
      other referrers, so it can ignore discard entry's reference count
      when removing the entry, otherwise in other caller we will hit bug_on
      in __remove_discard_cmd as there may be other issuer added reference
      count in discard entry.
      
      Thread A				Thread B
      					- issue_discard_thread
      - f2fs_ioc_fitrim
       - f2fs_trim_fs
        - f2fs_wait_discard_bios
         - __issue_discard_cmd
          - __submit_discard_cmd
      					 - __wait_discard_cmd
      					  - dc->ref++
      					  - __wait_one_discard_bio
         - __wait_discard_cmd
          - __remove_discard_cmd
           - f2fs_bug_on(sbi, dc->ref)
      
      Fixes: 969d1b18Reported-by: NJu Hyung Park <qkrwngud825@gmail.com>
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      638164a2
  12. 13 9月, 2017 1 次提交
  13. 12 9月, 2017 1 次提交