1. 27 8月, 2013 1 次提交
  2. 30 7月, 2013 2 次提交
    • J
      f2fs: fix handling orphan inodes · cbd56e7d
      Jaegeuk Kim 提交于
      This patch fixes mishandling of the sbi->n_orphans variable.
      
      If users request lots of f2fs_unlink(), check_orphan_space() could be contended.
      In such the case, sbi->n_orphans can be read incorrectly so that f2fs_unlink()
      would fall into the wrong state which results in the failure of
      add_orphan_inode().
      
      So, let's increment sbi->n_orphans virtually prior to the actual orphan inode
      stuffs. After that, let's release sbi->n_orphans by calling release_orphan_inode
      or remove_orphan_inode.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      cbd56e7d
    • J
      f2fs: update file name in the inode block during f2fs_rename · 1cd14caf
      Jaegeuk Kim 提交于
      The error is reproducible by:
      0. mkfs.f2fs /dev/sdb1 & mount
      1. touch test1
      2. touch test2
      3. mv test1 test2
      4. umount
      5. dumpt.f2fs -i 4 /dev/sdb1
      
      After this, when we retrieve the inode->i_name of test2 by dump.f2fs, we get
      test1 instead of test2.
      This is because f2fs didn't update the file name during the f2fs_rename.
      
      So, this patch fixes that.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      1cd14caf
  3. 14 6月, 2013 1 次提交
  4. 11 6月, 2013 1 次提交
    • J
      f2fs: fix i_blocks translation on various types of files · 2d4d9fb5
      Jaegeuk Kim 提交于
      Basically an inode manages the number of allocated blocks with inode->i_blocks
      which is represented in a unit of sectors, not file system blocks.
      But, f2fs has used i_blocks in a unit of file system blocks, and f2fs_getattr
      translates it to the number of sectors when fstat is called.
      
      However, previously f2fs_file_inode_operations only has this, so this patch adds
      it to all the types of inode_operations.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      2d4d9fb5
  5. 28 5月, 2013 4 次提交
  6. 08 5月, 2013 1 次提交
    • J
      f2fs: avoid deadlock during evict after f2fs_gc · 531ad7d5
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      531ad7d5
  7. 29 4月, 2013 1 次提交
  8. 23 4月, 2013 2 次提交
  9. 09 4月, 2013 1 次提交
    • J
      f2fs: introduce a new global lock scheme · 39936837
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      39936837
  10. 27 3月, 2013 1 次提交
  11. 18 3月, 2013 1 次提交
  12. 28 12月, 2012 1 次提交
  13. 26 12月, 2012 1 次提交
    • J
      f2fs: do f2fs_balance_fs in front of dir operations · 1efef832
      Jaegeuk Kim 提交于
      In order to conserve free sections to deal with the worst-case scenarios, f2fs
      should be able to freeze all the directory operations especially when there are
      not enough free sections. The f2fs_balance_fs() is for this use.
      
      When FS utilization becomes almost 100%, directory operations can be failed due
      to -ENOSPC frequently, which produces some dirty node pages occasionally.
      
      Previously, in such a case, f2fs_balance_fs() is not able to be triggered since
      it is triggered only if the directory operation ends up with success.
      
      So, this patch triggers f2fs_balance_fs() at first before handling directory
      operations.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      1efef832
  14. 11 12月, 2012 4 次提交