1. 03 4月, 2013 1 次提交
    • J
      f2fs: change GC bitmaps to apply the section granularity · 5ec4e49f
      Jaegeuk Kim 提交于
      This patch removes a bitmap for victim segments selected by foreground GC, and
      modifies the other bitmap for victim segments selected by background GC.
      
      1) foreground GC bitmap
       : We don't need to manage this, since we just only one previous victim section
         number instead of the whole victim history.
         The f2fs uses the victim section number in order not to allocate currently
         GC'ed section to current active logs.
      
      2) background GC bitmap
       : This bitmap is used to avoid selecting victims repeatedly by background GCs.
         In addition, the victims are able to be selected by foreground GCs, since
         there is no need to read victim blocks during foreground GCs.
      
         By the fact that the foreground GC reclaims segments in a section unit, it'd
         be better to manage this bitmap based on the section granularity.
      Reviewed-by: NNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      5ec4e49f
  2. 27 3月, 2013 3 次提交
  3. 20 3月, 2013 2 次提交
  4. 18 3月, 2013 1 次提交
    • J
      f2fs: introduce readahead mode of node pages · 266e97a8
      Jaegeuk Kim 提交于
      Previously, f2fs reads several node pages ahead when get_dnode_of_data is called
      with RDONLY_NODE flag.
      And, this flag is set by the following functions.
      - get_data_block_ro
      - get_lock_data_page
      - do_write_data_page
      - truncate_blocks
      - truncate_hole
      
      However, this readahead mechanism is initially introduced for the use of
      get_data_block_ro to enhance the sequential read performance.
      
      So, let's clarify all the cases with the additional modes as follows.
      
      enum {
      	ALLOC_NODE,	/* allocate a new node page if needed */
      	LOOKUP_NODE,	/* look up a node without readahead */
      	LOOKUP_NODE_RA,	/*
      			 * look up a node with readahead called
      			 * by get_datablock_ro.
      			 */
      }
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      Reviewed-by: NNamjae Jeon <namjae.jeon@samsung.com>
      266e97a8
  5. 12 2月, 2013 6 次提交
    • N
      f2fs: add compat_ioctl to provide backward compatability · e9750824
      Namjae Jeon 提交于
      adding compat_ioctl to provide support for backward comptability - 32bit binary
      execution on 64bit kernel.
      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>
      e9750824
    • 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
    • J
      f2fs: avoid balanc_fs during evict_inode · d4686d56
      Jaegeuk Kim 提交于
      1. Background
      
      Previously, if f2fs tries to move data blocks of an *evicting* inode during the
      cleaning process, it stops the process incompletely and then restarts the whole
      process, since it needs a locked inode to grab victim data pages in its address
      space. In order to get a locked inode, iget_locked() by f2fs_iget() is normally
      used, but, it waits if the inode is on freeing.
      
      So, here is a deadlock scenario.
      1. f2fs_evict_inode()       <- inode "A"
        2. f2fs_balance_fs()
          3. f2fs_gc()
            4. gc_data_segment()
              5. f2fs_iget()      <- inode "A" too!
      
      If step #1 and #5 treat a same inode "A", step #5 would fall into deadlock since
      the inode "A" is on freeing. In order to resolve this, f2fs_iget_nowait() which
      skips __wait_on_freeing_inode() was introduced in step #5, and stops f2fs_gc()
      to complete f2fs_evict_inode().
      
      1. f2fs_evict_inode()           <- inode "A"
        2. f2fs_balance_fs()
          3. f2fs_gc()
            4. gc_data_segment()
              5. f2fs_iget_nowait()   <- inode "A", then stop f2fs_gc() w/ -ENOENT
      
      2. Problem and Solution
      
      In the above scenario, however, f2fs cannot finish f2fs_evict_inode() only if:
       o there are not enough free sections, and
       o f2fs_gc() tries to move data blocks of the *evicting* inode repeatedly.
      
      So, the final solution is to use f2fs_iget() and remove f2fs_balance_fs() in
      f2fs_evict_inode().
      The f2fs_evict_inode() actually truncates all the data and node blocks, which
      means that it doesn't produce any dirty node pages accordingly.
      So, we don't need to do f2fs_balance_fs() in practical.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      d4686d56
    • N
      f2fs: fix typo mistake for data_version description · 324ddc70
      Namjae Jeon 提交于
      In f2fs_inode_info structure, the description for data_version
      has a typo mistake. It should be latest instead of lastes.
      So, correcting that.
      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>
      324ddc70
    • J
      f2fs: prevent checkpoint once any IO failure is detected · 577e3495
      Jaegeuk Kim 提交于
      This patch enhances the checkpoint routine to cope with IO errors.
      
      Basically f2fs detects IO errors from end_io_write, and the errors are able to
      be occurred during one of data, node, and meta page writes.
      
      In the previous code, when an IO error is occurred during writes, f2fs sets a
      flag, CP_ERROR_FLAG, in the raw ckeckpoint buffer which will be written to disk.
      Afterwards, write_checkpoint() will check the flag and remount f2fs as a
      read-only (ro) mode.
      
      However, even once f2fs is remounted as a ro mode, dirty checkpoint pages are
      freely able to be written to disk by flusher or kswapd in background.
      In such a case, after cold reboot, f2fs would restore the checkpoint data having
      CP_ERROR_FLAG, resulting in disabling write_checkpoint and remounting f2fs as
      a ro mode again.
      
      Therefore, let's prevent any checkpoint page (meta) writes once an IO error is
      occurred, and remount f2fs as a ro mode right away at that moment.
      Reported-by: NOliver Winker <oliver@oli1170.net>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      Reviewed-by: NNamjae Jeon <namjae.jeon@samsung.com>
      577e3495
  6. 08 2月, 2013 3 次提交
  7. 22 1月, 2013 1 次提交
  8. 15 1月, 2013 1 次提交
  9. 10 1月, 2013 1 次提交
    • J
      f2fs: revisit the f2fs_gc flow · 408e9375
      Jaegeuk Kim 提交于
      I'd like to revisit the f2fs_gc flow and rewrite as follows.
      
      1. In practical, the nGC parameter of f2fs_gc is meaningless. So, let's
        remove it.
      2. Background GC marks victim blocks as dirty one at a time.
      3. Foreground GC should do cleaning job until acquiring enough free
        sections. Afterwards, it needs to do checkpoint.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      408e9375
  10. 04 1月, 2013 2 次提交
  11. 28 12月, 2012 1 次提交
  12. 11 12月, 2012 6 次提交
    • J
      f2fs: fix tracking parent inode number · 6666e6aa
      Jaegeuk Kim 提交于
      Previously, f2fs didn't track the parent inode number correctly which is stored
      in each f2fs_inode. In the case of the following scenario, a bug can be occured.
      
      Let's suppose there are one directory, "/b", and two files, "/a" and "/b/a".
       - pino of "/a" is ROOT_INO.
       - pino of "/b/a" is DIR_B_INO.
      
      Then,
       # sync
        : The inode pages of "/a" and "/b/a" contain the parent inode numbers as
          ROOT_INO and DIR_B_INO respectively.
       # mv /a /b/a
        : The parent inode number of "/a" should be changed to DIR_B_INO, but f2fs
          didn't do that. Ref. f2fs_set_link().
      
      In order to fix this clearly, I added i_pino in f2fs_inode_info, and whenever
      it needs to be changed like in f2fs_add_link() and f2fs_set_link(), it is
      updated temporarily in f2fs_inode_info.
      
      And later, f2fs_write_inode() stores the latest information to the inode pages.
      For power-off-recovery, f2fs_sync_file() triggers simply f2fs_write_inode().
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      6666e6aa
    • 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: fix endian conversion bugs reported by sparse · 25ca923b
      Jaegeuk Kim 提交于
      This patch should resolve the bugs reported by the sparse tool.
      Initial reports were written by "kbuild test robot" managed by fengguang.wu.
      
      In my local machines, I've tested also by running:
      > make C=2 CF="-D__CHECK_ENDIAN__"
      
      Accordingly, I've found lots of warnings and bugs related to the endian
      conversion. And I've fixed all at this moment.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      25ca923b
    • S
      f2fs: remove unneeded version.h header file from f2fs.h · cf0e3a64
      Sachin Kamat 提交于
      Including <linux/version.h> is not necessary.
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      cf0e3a64
    • 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