1. 08 May, 2013 1 commit
    • Jaegeuk Kim's avatar
      f2fs: avoid deadlock during evict after f2fs_gc · 531ad7d5
      Jaegeuk Kim authored
      o Deadlock case #1
      
      Thread 1:
      - writeback_sb_inodes
       - do_writepages
        - f2fs_write_data_pages
         - write_cache_pages
          - f2fs_write_data_page
           - f2fs_balance_fs
            - wait mutex_lock(gc_mutex)
      
      Thread 2:
      - f2fs_balance_fs
       - mutex_lock(gc_mutex)
       - f2fs_gc
        - f2fs_iget
         - wait iget_locked(inode->i_lock)
      
      Thread 3:
      - do_unlinkat
       - iput
        - lock(inode->i_lock)
         - evict
          - inode_wait_for_writeback
      
      o Deadlock case #2
      
      Thread 1:
      - __writeback_single_inode
       : set I_SYNC
        - do_writepages
         - f2fs_write_data_page
          - f2fs_balance_fs
           - f2fs_gc
            - iput
             - evict
              - inode_wait_for_writeback(I_SYNC)
      
      In order to avoid this, even though iput is called with the zero-reference
      count, we need to stop the eviction procedure if the inode is on writeback.
      So this patch links f2fs_drop_inode which checks the I_SYNC flag.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      531ad7d5
  2. 30 Apr, 2013 3 commits
  3. 29 Apr, 2013 3 commits
  4. 26 Apr, 2013 4 commits
    • Jaegeuk Kim's avatar
      f2fs: check nid == 0 in add_free_nid · 9198aceb
      Jaegeuk Kim authored
      It is more obvious that add_free_nid checks whether the free nid is zero or not.
      Reviewed-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      9198aceb
    • Namjae Jeon's avatar
      f2fs: add REQ_META about metadata requests for submit · 8680441c
      Namjae Jeon authored
      Adding REQ_META for all the metadata requests can help in improving the
      FS performance, if the underlying device supports TAGGING.
      So, when considering the submit_bio path for all the f2fs requests. We can
      add REQ_META for all the META requests.
      As a precursor to this change we considered the commit
      4265900e 'mmc: MMC-4.5 Data Tag Support'
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      8680441c
    • Jaegeuk Kim's avatar
      f2fs: give a chance to merge IOs by IO scheduler · c718379b
      Jaegeuk Kim authored
      Previously, background GC submits many 4KB read requests to load victim blocks
      and/or its (i)node blocks.
      
      ...
      f2fs_gc : f2fs_readpage: ino = 1, page_index = 0xb61, blkaddr = 0x3b964ed
      f2fs_gc : block_rq_complete: 8,16 R () 499854968 + 8 [0]
      f2fs_gc : f2fs_readpage: ino = 1, page_index = 0xb6f, blkaddr = 0x3b964ee
      f2fs_gc : block_rq_complete: 8,16 R () 499854976 + 8 [0]
      f2fs_gc : f2fs_readpage: ino = 1, page_index = 0xb79, blkaddr = 0x3b964ef
      f2fs_gc : block_rq_complete: 8,16 R () 499854984 + 8 [0]
      ...
      
      However, by the fact that many IOs are sequential, we can give a chance to merge
      the IOs by IO scheduler.
      In order to do that, let's use blk_plug.
      
      ...
      f2fs_gc : f2fs_iget: ino = 143
      f2fs_gc : f2fs_readpage: ino = 143, page_index = 0x1c6, blkaddr = 0x2e6ee
      f2fs_gc : f2fs_iget: ino = 143
      f2fs_gc : f2fs_readpage: ino = 143, page_index = 0x1c7, blkaddr = 0x2e6ef
      <idle> : block_rq_complete: 8,16 R () 1519616 + 8 [0]
      <idle> : block_rq_complete: 8,16 R () 1519848 + 8 [0]
      <idle> : block_rq_complete: 8,16 R () 1520432 + 96 [0]
      <idle> : block_rq_complete: 8,16 R () 1520536 + 104 [0]
      <idle> : block_rq_complete: 8,16 R () 1521008 + 112 [0]
      <idle> : block_rq_complete: 8,16 R () 1521440 + 152 [0]
      <idle> : block_rq_complete: 8,16 R () 1521688 + 144 [0]
      <idle> : block_rq_complete: 8,16 R () 1522128 + 192 [0]
      <idle> : block_rq_complete: 8,16 R () 1523256 + 328 [0]
      ...
      
      Note that this issue should be addressed in checkpoint, and some readahead
      flows too.
      Reviewed-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      c718379b
    • Jaegeuk Kim's avatar
      f2fs: avoid frequent background GC · 6cb968d9
      Jaegeuk Kim authored
      If there is no victim segments selected by background GC, let's wait
      a little bit longer time to collect dirty segments.
      By default, let's give 5 minutes.
      Reviewed-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      6cb968d9
  5. 23 Apr, 2013 7 commits
  6. 22 Apr, 2013 1 commit
  7. 21 Apr, 2013 1 commit
  8. 09 Apr, 2013 5 commits
    • Namjae Jeon's avatar
      f2fs: fix typo mistakes · 6224da87
      Namjae Jeon authored
      Fix typo mistakes.
      1. I think that it should be 'L' instead of 'V'.
      2. and try to fix 'Front' instead of 'Frone'
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      6224da87
    • Jaegeuk Kim's avatar
      f2fs: write checkpoint before starting FG_GC · d64f8047
      Jaegeuk Kim authored
      In order to be aware of prefree and free sections during FG_GC, let's start with
      write_checkpoint().
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      d64f8047
    • Zhihui Zhang's avatar
      f2fs: fix the logic of IS_DNODE() · 3315101f
      Zhihui Zhang authored
      If (ofs % (NIDS_PER_BLOCK + 1) == 0), the node is an indirect node block.
      Signed-off-by: default avatarZhihui Zhang <zzhsuny@gmail.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      3315101f
    • Jaegeuk Kim's avatar
      f2fs: introduce a new global lock scheme · 39936837
      Jaegeuk Kim authored
      In the previous version, f2fs uses global locks according to the usage types,
      such as directory operations, block allocation, block write, and so on.
      
      Reference the following lock types in f2fs.h.
      enum lock_type {
      	RENAME,		/* for renaming operations */
      	DENTRY_OPS,	/* for directory operations */
      	DATA_WRITE,	/* for data write */
      	DATA_NEW,	/* for data allocation */
      	DATA_TRUNC,	/* for data truncate */
      	NODE_NEW,	/* for node allocation */
      	NODE_TRUNC,	/* for node truncate */
      	NODE_WRITE,	/* for node write */
      	NR_LOCK_TYPE,
      };
      
      In that case, we lose the performance under the multi-threading environment,
      since every types of operations must be conducted one at a time.
      
      In order to address the problem, let's share the locks globally with a mutex
      array regardless of any types.
      So, let users grab a mutex and perform their jobs in parallel as much as
      possbile.
      
      For this, I propose a new global lock scheme as follows.
      
      0. Data structure
       - f2fs_sb_info -> mutex_lock[NR_GLOBAL_LOCKS]
       - f2fs_sb_info -> node_write
      
      1. mutex_lock_op(sbi)
       - try to get an avaiable lock from the array.
       - returns the index of the gottern lock variable.
      
      2. mutex_unlock_op(sbi, index of the lock)
       - unlock the given index of the lock.
      
      3. mutex_lock_all(sbi)
       - grab all the locks in the array before the checkpoint.
      
      4. mutex_unlock_all(sbi)
       - release all the locks in the array after checkpoint.
      
      5. block_operations()
       - call mutex_lock_all()
       - sync_dirty_dir_inodes()
       - grab node_write
       - sync_node_pages()
      
      Note that,
       the pairs of mutex_lock_op()/mutex_unlock_op() and
       mutex_lock_all()/mutex_unlock_all() should be used together.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      39936837
    • Jason Hrycay's avatar
      f2fs: move f2fs_balance_fs from truncate to punch_hole · 1127a3d4
      Jason Hrycay authored
      Move the f2fs_balance_fs out of the truncate_hole function and only
      perform that in punch_hole use case.  The commit:
      
        ed60b1644e7f7e5dd67d21caf7e4425dff05dad0
      
      intended to do this but moved it into truncate_hole to cover more
      cases.  However, a deadlock scenario is possible when deleting an inode
      entry under specific conditions:
      
       f2fs_delete_entry()
           mutex_lock_op(sbi, DENTRY_OPS);
           truncate_hole()
               f2fs_balance_fs()
                   mutex_lock(&sbi->gc_mutex);
                   f2fs_gc()
                       write_checkpoint()
                           block_operations()
                               mutex_lock_op(sbi, DENTRY_OPS);
      
      Lets move it into the punch_hole case to cover the original intent of
      avoiding it during fallocate's expand_inode_data case.
      
      Change-Id: I29f8ea1056b0b88b70ba8652d901b6e8431bb27e
      Signed-off-by: default avatarJason Hrycay <jason.hrycay@motorola.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
      1127a3d4
  9. 03 Apr, 2013 12 commits
  10. 31 Mar, 2013 1 commit
  11. 27 Mar, 2013 2 commits