1. 12 2月, 2015 2 次提交
    • J
      f2fs: fix sparse warnings · 29e7043f
      Jaegeuk Kim 提交于
      This patch resolves the following warnings.
      
      include/trace/events/f2fs.h:150:1: warning: expression using sizeof bool
      include/trace/events/f2fs.h:180:1: warning: expression using sizeof bool
      include/trace/events/f2fs.h:990:1: warning: expression using sizeof bool
      include/trace/events/f2fs.h:990:1: warning: expression using sizeof bool
      include/trace/events/f2fs.h:150:1: warning: odd constant _Bool cast (ffffffffffffffff becomes 1)
      include/trace/events/f2fs.h:180:1: warning: odd constant _Bool cast (ffffffffffffffff becomes 1)
      include/trace/events/f2fs.h:990:1: warning: odd constant _Bool cast (ffffffffffffffff becomes 1)
      include/trace/events/f2fs.h:990:1: warning: odd constant _Bool cast (ffffffffffffffff becomes 1)
      
      fs/f2fs/checkpoint.c:27:19: warning: symbol 'inode_entry_slab' was not declared. Should it be static?
      fs/f2fs/checkpoint.c:577:15: warning: cast to restricted __le32
      fs/f2fs/checkpoint.c:592:15: warning: cast to restricted __le32
      
      fs/f2fs/trace.c:19:1: warning: symbol 'pids' was not declared. Should it be static?
      fs/f2fs/trace.c:21:21: warning: symbol 'last_io' was not declared. Should it be static?
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      29e7043f
    • C
      f2fs: clean up {in,de}create_sleep_time · 88dd8934
      Chao Yu 提交于
      Use pointer parameter @wait to pass result in {in,de}create_sleep_time for
      cleanup.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      88dd8934
  2. 10 1月, 2015 1 次提交
    • C
      f2fs: reuse inode_entry_slab in gc procedure for using slab more effectively · 06292073
      Chao Yu 提交于
      There are two slab cache inode_entry_slab and winode_slab using the same
      structure as below:
      
      struct dir_inode_entry {
      	struct list_head list;	/* list head */
      	struct inode *inode;	/* vfs inode pointer */
      };
      
      struct inode_entry {
      	struct list_head list;
      	struct inode *inode;
      };
      
      It's a little waste that the two cache can not share their memory space for each
      other.
      So in this patch we remove one redundant winode_slab slab cache, then use more
      universal name struct inode_entry as remaining data structure name of slab,
      finally we reuse the inode_entry_slab to store dirty dir item and gc item for
      more effective.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      06292073
  3. 03 12月, 2014 1 次提交
  4. 20 8月, 2014 1 次提交
  5. 08 1月, 2014 1 次提交
    • J
      f2fs: add a sysfs entry to control max_victim_search · b1c57c1c
      Jaegeuk Kim 提交于
      Previously during SSR and GC, the maximum number of retrials to find a victim
      segment was hard-coded by MAX_VICTIM_SEARCH, 4096 by default.
      
      This number makes an effect on IO locality, when SSR mode is activated, which
      results in performance fluctuation on some low-end devices.
      
      If max_victim_search = 4, the victim will be searched like below.
      ("D" represents a dirty segment, and "*" indicates a selected victim segment.)
      
       D1 D2 D3 D4 D5 D6 D7 D8 D9
      [   *       ]
            [   *    ]
                  [         * ]
      	                [ ....]
      
      This patch adds a sysfs entry to control the number dynamically through:
        /sys/fs/f2fs/$dev/max_victim_search
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      b1c57c1c
  6. 05 9月, 2013 1 次提交
    • J
      f2fs: optimize gc for better performance · a26b7c8a
      Jin Xu 提交于
      This patch improves the gc efficiency by optimizing the victim
      selection policy. With this optimization, the random re-write
      performance could increase up to 20%.
      
      For f2fs, when disk is in shortage of free spaces, gc will selects
      dirty segments and moves valid blocks around for making more space
      available. The gc cost of a segment is determined by the valid blocks
      in the segment. The less the valid blocks, the higher the efficiency.
      The ideal victim segment is the one that has the most garbage blocks.
      
      Currently, it searches up to 20 dirty segments for a victim segment.
      The selected victim is not likely the best victim for gc when there
      are much more dirty segments. Why not searching more dirty segments
      for a better victim? The cost of searching dirty segments is
      negligible in comparison to moving blocks.
      
      In this patch, it enlarges the MAX_VICTIM_SEARCH to 4096 to make
      the search more aggressively for a possible better victim. Since
      it also applies to victim selection for SSR, it will likely improve
      the SSR efficiency as well.
      
      The test case is simple. It creates as many files until the disk full.
      The size for each file is 32KB. Then it writes as many as 100000
      records of 4KB size to random offsets of random files in sync mode.
      The testing was done on a 2GB partition of a SDHC card. Let's see the
      test result of f2fs without and with the patch.
      
      ---------------------------------------
      2GB partition, SDHC
      create 52023 files of size 32768 bytes
      random re-write 100000 records of 4KB
      ---------------------------------------
      | file creation (s) | rewrite time (s) | gc count | gc garbage blocks |
      [no patch]  341         4227             1174          174840
      [patched]   324         2958             645           106682
      
      It's obvious that, with the patch, f2fs finishes the test in 20+% less
      time than without the patch. And internally it does much less gc with
      higher efficiency than before.
      
      Since the performance improvement is related to gc, it might not be so
      obvious for other tests that do not trigger gc as often as this one (
      This is because f2fs selects dirty segments for SSR use most of the
      time when free space is in shortage). The well-known iozone test tool
      was not used for benchmarking the patch becuase it seems do not have
      a test case that performs random re-write on a full disk.
      
      This patch is the revised version based on the suggestion from
      Jaegeuk Kim.
      Signed-off-by: NJin Xu <jinuxstyle@gmail.com>
      [Jaegeuk Kim: suggested simpler solution]
      Reviewed-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      a26b7c8a
  7. 06 8月, 2013 2 次提交
  8. 26 4月, 2013 1 次提交
  9. 12 2月, 2013 3 次提交
    • J
      f2fs: clarify and enhance the f2fs_gc flow · 43727527
      Jaegeuk Kim 提交于
      This patch makes clearer the ambiguous f2fs_gc flow as follows.
      
      1. Remove intermediate checkpoint condition during f2fs_gc
       (i.e., should_do_checkpoint() and GC_BLOCKED)
      
      2. Remove unnecessary return values of f2fs_gc because of #1.
       (i.e., GC_NODE, GC_OK, etc)
      
      3. Simplify write_checkpoint() because of #2.
      
      4. Clarify the main f2fs_gc flow.
       o monitor how many freed sections during one iteration of do_garbage_collect().
       o do GC more without checkpoints if we can't get enough free sections.
       o do checkpoint once we've got enough free sections through forground GCs.
      
      5. Adopt thread-logging (Slack-Space-Recycle) scheme more aggressively on data
        log types. See. get_ssr_segement()
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      43727527
    • N
      f2fs: make an accessor to get sections for particular block type · 5ac206cf
      Namjae Jeon 提交于
      Introduce accessor to get the sections based upon the block type
      (node,dents...) and modify the functions : should_do_checkpoint,
      has_not_enough_free_secs to use this accessor function to get
      the node sections and dent sections.
      Signed-off-by: NNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: NAmit Sahrawat <a.sahrawat@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      5ac206cf
    • N
      f2fs: name gc task as per the block device · ec7b1f2d
      Namjae Jeon 提交于
      Currently GC task is started for each f2fs formatted/mounted device.
      But, when we check the task list, using 'ps', there is no distinguishing
      factor between the tasks. So, name the task as per the block device just
      like the flusher threads.
      Also, remove the macro GC_THREAD_NAME and instead use the name: f2fs_gc
      to avoid name length truncation, as the command length is 16
      -> TASK_COMM_LEN 16 and example name like:
      f2fs_gc_task:8:16 -> this exceeds name length
      
      Before Patch for 2 F2FS formatted partitions:
      root  28061  0.0  0.0  0 0 ? S 10:31   0:00 [f2fs_gc_task]
      root  28087  0.0  0.0  0 0 ? S 10:32   0:00 [f2fs_gc_task]
      
      After Patch:
      root  16756  0.0  0.0  0  0 ?  S  14:57   0:00 [f2fs_gc-8:18]
      root  16765  0.0  0.0  0  0 ?  S  14:57   0:00 [f2fs_gc-8:19]
      Signed-off-by: NNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: NAmit Sahrawat <a.sahrawat@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      ec7b1f2d
  10. 11 12月, 2012 2 次提交
    • J
      f2fs: adjust kernel coding style · 0a8165d7
      Jaegeuk Kim 提交于
      As pointed out by Randy Dunlap, this patch removes all usage of "/**" for comment
      blocks. Instead, just use "/*".
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      0a8165d7
    • J
      f2fs: add garbage collection functions · 7bc09003
      Jaegeuk Kim 提交于
      This adds on-demand and background cleaning functions.
      
      - The basic background cleaning policy is trying to do cleaning jobs as much as
        possible whenever the system is idle. Once the background cleaning is done,
        the cleaner sleeps an amount of time not to interfere with VFS calls. The time
        is dynamically adjusted according to the status of whole segments, which is
        decreased when the following conditions are satisfied.
      
        . GC is not conducted currently, and
        . IO subsystem is idle by checking the number of requets in bdev's request
           list, and
        . There are enough dirty segments.
      
        Otherwise, the time is increased incrementally until to the maximum time.
        Note that, min and max times are 10 secs and 30 secs by default.
      
      - F2FS adopts a default victim selection policy where background cleaning uses
        a cost-benefit algorithm, while on-demand cleaning uses a greedy algorithm.
      
      - The method of moving data during the cleaning is slightly different between
        background and on-demand cleaning schemes. In the case of background cleaning,
        F2FS loads the data, and marks them as dirty. Then, F2FS expects that the data
        will be moved by flusher or VM. In the case of on-demand cleaning, F2FS should
        move the data right away.
      
      - In order to identify valid blocks in a victim segment, F2FS scans the bitmap
        of the segment managed as an SIT entry.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      7bc09003