1. 23 12月, 2013 7 次提交
    • J
      f2fs: introduce sysfs entry to control in-place-update policy · 216fbd64
      Jaegeuk Kim 提交于
      This patch introduces new sysfs entries for users to control the policy of
      in-place-updates, namely IPU, in f2fs.
      
      Sometimes f2fs suffers from performance degradation due to its out-of-place
      update policy that produces many additional node block writes.
      If the storage performance is very dependant on the amount of data writes
      instead of IO patterns, we'd better drop this out-of-place update policy.
      
      This patch suggests 5 polcies and their triggering conditions as follows.
      
      [sysfs entry name = ipu_policy]
      
      0: F2FS_IPU_FORCE       all the time,
      1: F2FS_IPU_SSR         if SSR mode is activated,
      2: F2FS_IPU_UTIL        if FS utilization is over threashold,
      3: F2FS_IPU_SSR_UTIL    if SSR mode is activated and FS utilization is over
                              threashold,
      4: F2FS_IPU_DISABLE    disable IPU. (=default option)
      
      [sysfs entry name = min_ipu_util]
      
      This parameter controls the threshold to trigger in-place-updates.
      The number indicates percentage of the filesystem utilization, and used by
      F2FS_IPU_UTIL and F2FS_IPU_SSR_UTIL policies.
      
      For more details, see need_inplace_update() in segment.h.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      216fbd64
    • C
      f2fs: add unlikely() macro for compiler optimization · cfb271d4
      Chao Yu 提交于
      As we know, some of our branch condition will rarely be true. So we could add
      'unlikely' to let compiler optimize these code, by this way we could drop
      unneeded 'jump' assemble code to improve performance.
      
      change log:
       o add *unlikely* as many as possible across the whole source files at once
         suggested by Jaegeuk Kim.
      Suggested-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      cfb271d4
    • J
      f2fs: remove the own bi_private allocation · 187b5b8b
      Jaegeuk Kim 提交于
      Previously f2fs allocates its own bi_private data structure all the time even
      though we don't use it. But, can we remove this bi_private allocation?
      
      This patch removes such the additional bi_private allocation.
      
      1. Retrieve f2fs_sb_info from its page->mapping->host->i_sb.
       - This removes the usecases of bi_private in end_io.
      
      2. Use bi_private only when we really need it.
       - The bi_private is used only when the checkpoint procedure is conducted.
       - When conducting the checkpoint, f2fs submits a META_FLUSH bio to wait its bio
      completion.
       - Since we have no dependancies to remove bi_private now, let's just use
       bi_private pointer as the completion pointer.
      Reviewed-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      187b5b8b
    • C
      f2fs: correct type of wait in struct bio_private · aac44046
      Chao Yu 提交于
      The void *wait in bio_private is used for waiting completion of checkpoint bio.
      So we don't need to use its type as void, but declare it as completion type.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      [Jaegeuk Kim: add description]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      aac44046
    • J
      f2fs: bug fix on bit overflow from 32bits to 64bits · f9a4e6df
      Jaegeuk Kim 提交于
      This patch fixes some bit overflows by the shift operations.
      
      Dan Carpenter reported potential bugs on bit overflows as follows.
      
      fs/f2fs/segment.c:910 submit_write_page()
      	warn: should 'blk_addr << ((sbi)->log_blocksize - 9)' be a 64 bit type?
      fs/f2fs/checkpoint.c:429 get_valid_checkpoint()
      	warn: should '1 << ()' be a 64 bit type?
      fs/f2fs/data.c:408 f2fs_readpage()
      	warn: should 'blk_addr << ((sbi)->log_blocksize - 9)' be a 64 bit type?
      fs/f2fs/data.c:457 submit_read_page()
      	warn: should 'blk_addr << ((sbi)->log_blocksize - 9)' be a 64 bit type?
      fs/f2fs/data.c:525 get_data_block_ro()
      	warn: should 'i << blkbits' be a 64 bit type?
      Bug-Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      f9a4e6df
    • C
      f2fs: read contiguous sit entry pages by merging for mount performance · 74de593a
      Chao Yu 提交于
      Previously we read sit entries page one by one, this method lost the chance
      of reading contiguous page together. So we read pages as contiguous as
      possible for better mount performance.
      
      change log:
       o merge judgements/use 'Continue' or 'Break' instead of 'Goto' as Gu Zheng
         suggested.
       o add mark_page_accessed() before release page to delay VM reclaiming.
       o remove '*order' for simplification of function as Jaegeuk Kim suggested.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      [Jaegeuk Kim: fix a bug on the block address calculation]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      74de593a
    • C
      f2fs: simplify IS_DATASEG and IS_NODESEG macro · 61ae45c8
      Changman Lee 提交于
      It is not efficient comparing each segment type to find node or data.
      Signed-off-by: NChangman Lee <cm224.lee@samsung.com>
      [Jaegeuk Kim: remove unnecessary white spaces]
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      61ae45c8
  2. 30 10月, 2013 1 次提交
  3. 29 10月, 2013 1 次提交
  4. 25 10月, 2013 1 次提交
    • J
      f2fs: reclaim prefree segments periodically · 81eb8d6e
      Jaegeuk Kim 提交于
      Previously, f2fs postpones reclaiming prefree segments into free segments
      as much as possible.
      However, if user writes and deletes a bunch of data without any sync or fsync
      calls, some flash storages can suffer from garbage collections.
      
      So, this patch adds the reclaiming codes to f2fs_write_node_pages and background
      GC thread.
      
      If there are a lot of prefree segments, let's do checkpoint so that f2fs
      submits discard commands for the prefree regions to the flash storage.
      Signed-off-by: NChangman Lee <cm224.lee@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      81eb8d6e
  5. 24 9月, 2013 1 次提交
  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. 03 9月, 2013 2 次提交
  8. 30 4月, 2013 1 次提交
    • J
      f2fs: modify the number of issued pages to merge IOs · ac5d156c
      Jaegeuk Kim 提交于
      When testing f2fs on an SSD, I found some 128 page IOs followed by 1 page IO
      were issued by f2fs_write_node_pages.
      This means that there were some mishandling flows which degrades performance.
      
      Previous f2fs_write_node_pages determines the number of pages to be written,
      nr_to_write, as follows.
      
      1. The bio_get_nr_vecs returns 129 pages.
      2. The bio_alloc makes a room for 128 pages.
      3. The initial 128 pages go into one bio.
      4. The existing bio is submitted, and a new bio is prepared for the last 1 page.
      5. Finally, sync_node_pages submits the last 1 page bio.
      
      The problem is from the use of bio_get_nr_vecs, so this patch replace it
      with max_hw_blocks using queue_max_sectors.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      ac5d156c
  9. 09 4月, 2013 1 次提交
  10. 03 4月, 2013 3 次提交
  11. 08 3月, 2013 1 次提交
  12. 12 2月, 2013 3 次提交
  13. 28 12月, 2012 1 次提交
  14. 11 12月, 2012 3 次提交
    • J
      f2fs: cleanup the f2fs_bio_alloc routine · 3cd8a239
      Jaegeuk Kim 提交于
      Do cleanup more for better code readability.
      
      - Change the parameter set of f2fs_bio_alloc()
        This function should allocate a bio only since it is not something like
        f2fs_bio_init(). Instead, the caller should initialize the allocated bio.
      
      - Introduce SECTOR_FROM_BLOCK
        This macro translates a block address to its sector address.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      Reviewed-by: NNamjae Jeon <namjae.jeon@samsung.com>
      3cd8a239
    • 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 superblock and major in-memory structure · 39a53e0c
      Jaegeuk Kim 提交于
      This adds the following major in-memory structures in f2fs.
      
      - f2fs_sb_info:
        contains f2fs-specific information, two special inode pointers for node and
        meta address spaces, and orphan inode management.
      
      - f2fs_inode_info:
        contains vfs_inode and other fs-specific information.
      
      - f2fs_nm_info:
        contains node manager information such as NAT entry cache, free nid list,
        and NAT page management.
      
      - f2fs_node_info:
        represents a node as node id, inode number, block address, and its version.
      
      - f2fs_sm_info:
        contains segment manager information such as SIT entry cache, free segment
        map, current active logs, dirty segment management, and segment utilization.
        The specific structures are sit_info, free_segmap_info, dirty_seglist_info,
        curseg_info.
      
      In addition, add F2FS_SUPER_MAGIC in magic.h.
      Signed-off-by: NChul Lee <chur.lee@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      39a53e0c