1. 10 Jan, 2015 4 commits
  2. 01 Dec, 2014 1 commit
  3. 25 Nov, 2014 1 commit
    • Jaegeuk Kim's avatar
      f2fs: fix deadlock during inline_data conversion · 5f727395
      Jaegeuk Kim authored
      A deadlock can be occurred:
      Thread 1]                             Thread 2]
       - f2fs_write_data_pages              - f2fs_write_begin
         - lock_page(page #0)
                                              - grab_cache_page(page #X)
                                              - get_node_page(inode_page)
                                              - grab_cache_page(page #0)
                                                : to convert inline_data
         - f2fs_write_data_page
           - f2fs_write_inline_data
             - get_node_page(inode_page)
      In this case, trying to lock inode_page and page #0 causes deadlock.
      In order to avoid this, this patch adds a rule for this locking policy,
      which is that page #0 should be locked followed by inode_page lock.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
  4. 19 Nov, 2014 1 commit
  5. 05 Nov, 2014 2 commits
    • Jaegeuk Kim's avatar
      f2fs: avoid race condition in handling wait_io · 6a8f8ca5
      Jaegeuk Kim authored
      __submit_merged_bio    f2fs_write_end_io        f2fs_write_end_io
                             wait_io = X              wait_io = x
                             complete(X)              complete(X)
                             wait_io = NULL
                                                       kernel panic
      In order to avoid this, this patch removes the wait_io facility.
      Instead, we can use wait_on_all_pages_writeback(sbi) to wait for end_ios.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    • Jaegeuk Kim's avatar
      f2fs: revisit inline_data to avoid data races and potential bugs · b3d208f9
      Jaegeuk Kim authored
      This patch simplifies the inline_data usage with the following rule.
      1. inline_data is set during the file creation.
      2. If new data is requested to be written ranges out of inline_data,
       f2fs converts that inode permanently.
      3. There is no cases which converts non-inline_data inode to inline_data.
      4. The inline_data flag should be changed under inode page lock.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
  6. 04 Nov, 2014 4 commits
  7. 07 Oct, 2014 2 commits
    • Jaegeuk Kim's avatar
      f2fs: support volatile operations for transient data · 02a1335f
      Jaegeuk Kim authored
      This patch adds support for volatile writes which keep data pages in memory
      until f2fs_evict_inode is called by iput.
      For instance, we can use this feature for the sqlite database as follows.
      While supporting atomic writes for main database file, we can keep its journal
      data temporarily in the page cache by the following sequence.
      1. open
      2. writes
       : keep all the data in the page cache.
      3. flush to the database file with atomic writes
        a. ioctl(F2FS_IOC_START_ATOMIC_WRITE);
        b. writes
        c. ioctl(F2FS_IOC_COMMIT_ATOMIC_WRITE);
      4. close
       -> drop the cached data
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    • Jaegeuk Kim's avatar
      f2fs: support atomic writes · 88b88a66
      Jaegeuk Kim authored
      This patch introduces a very limited functionality for atomic write support.
      In order to support atomic write, this patch adds two ioctls:
      The database engine should be aware of the following sequence.
      1. open
       -> ioctl(F2FS_IOC_START_ATOMIC_WRITE);
      2. writes
        : all the written data will be treated as atomic pages.
      3. commit
       -> ioctl(F2FS_IOC_COMMIT_ATOMIC_WRITE);
        : this flushes all the data blocks to the disk, which will be shown all or
        nothing by f2fs recovery procedure.
      4. repeat to #2
      The IO pattens should be:
        ,- START_ATOMIC_WRITE                  ,- COMMIT_ATOMIC_WRITE
       CP | D D D D D D | FSYNC | D D D D | FSYNC ...
                            `- COMMIT_ATOMIC_WRITE
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
  8. 23 Sep, 2014 4 commits
    • Chao Yu's avatar
      f2fs: support large sector size · 55cf9cb6
      Chao Yu authored
      Block size in f2fs is 4096 bytes, so theoretically, f2fs can support 4096 bytes
      sector device at maximum. But now f2fs only support 512 bytes size sector, so
      block device such as zRAM which uses page cache as its block storage space will
      not be mounted successfully as mismatch between sector size of zRAM and sector
      size of f2fs supported.
      In this patch we support large sector size in f2fs, so block device with sector
      size of 512/1024/2048/4096 bytes can be supported in f2fs.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    • Jaegeuk Kim's avatar
      f2fs: update i_size when __allocate_data_block · 976e4c50
      Jaegeuk Kim authored
      The f2fs_direct_IO uses __allocate_data_block, but inside the allocation path,
      we should update i_size at the changed time to update its inode page.
      Otherwise, we can get wrong i_size after roll-forward recovery.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    • Jaegeuk Kim's avatar
      f2fs: use MAX_BIO_BLOCKS(sbi) · 90a893c7
      Jaegeuk Kim authored
      This patch cleans up a simple macro.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    • Jaegeuk Kim's avatar
      f2fs: fix conditions to remain recovery information in f2fs_sync_file · 88bd02c9
      Jaegeuk Kim authored
      This patch revisited whole the recovery information during the f2fs_sync_file.
      In this patch, there are three information to make a decision.
      a) IS_CHECKPOINTED,	/* is it checkpointed before? */
      b) HAS_FSYNCED_INODE,	/* is the inode fsynced before? */
      c) HAS_LAST_FSYNC,	/* has the latest node fsync mark? */
      And, the scenarios for our rule are based on:
      [Term] F: fsync_mark, D: dentry_mark
      1. inode(x) | CP | inode(x) | dnode(F)
      2. inode(x) | CP | inode(F) | dnode(F)
      3. inode(x) | CP | dnode(F) | inode(x) | inode(F)
      4. inode(x) | CP | dnode(F) | inode(F)
      5. CP | inode(x) | dnode(F) | inode(DF)
      6. CP | inode(DF) | dnode(F)
      7. CP | dnode(F) | inode(DF)
      8. CP | dnode(F) | inode(x) | inode(DF)
      For example, #3, the three conditions should be changed as follows.
         inode(x) | CP | dnode(F) | inode(x) | inode(F)
      a)    x       o      o          o          o
      b)    x       x      x          x          o
      c)    x       o      o          x          o
      If f2fs_sync_file stops   ------^,
       it should write inode(F)    --------------^
      So, the need_inode_block_update should return true, since
       c) get_nat_flag(e, HAS_LAST_FSYNC), is false.
      For example, #8
            CP | alloc | dnode(F) | inode(x) | inode(DF)
      a)    o      x        x          x          x
      b)    x               x          x          o
      c)    o               o          x          o
      If f2fs_sync_file stops   -------^,
       it should write inode(DF)    --------------^
      Note that, the roll-forward policy should follow this rule, which means,
      if there are any missing blocks, we doesn't need to recover that inode.
      Signed-off-by: default avatarHuang Ying <ying.huang@intel.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
  9. 16 Sep, 2014 1 commit
  10. 09 Sep, 2014 1 commit
  11. 04 Sep, 2014 1 commit
  12. 21 Aug, 2014 2 commits
    • Jaegeuk Kim's avatar
      f2fs: avoid double lock in truncate_blocks · 764aa3e9
      Jaegeuk Kim authored
      The init_inode_metadata calls truncate_blocks when error is occurred.
      The callers holds f2fs_lock_op, so we should not call it again in
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    • Jaegeuk Kim's avatar
      f2fs: handle EIO not to break fs consistency · cf779cab
      Jaegeuk Kim authored
      There are two rules when EIO is occurred.
      1. don't write any checkpoint data to preserve the previous checkpoint
      2. don't lose the cached dentry/node/meta pages
      So, at first, this patch adds set_page_dirty in f2fs_write_end_io's failure.
      Then, writing checkpoint/dentry/node blocks is not allowed.
      Note that, for the data pages, we can't just throw away by redirtying them.
      Otherwise, kworker can fall into infinite loop to flush them.
      (Ref. xfstests/019)
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
  13. 19 Aug, 2014 2 commits
  14. 02 Aug, 2014 1 commit
  15. 29 Jul, 2014 2 commits
  16. 25 Jul, 2014 1 commit
  17. 09 Jul, 2014 2 commits
  18. 23 Jun, 2014 1 commit
  19. 07 Jun, 2014 1 commit
  20. 04 Jun, 2014 1 commit
  21. 07 May, 2014 5 commits