1. 04 3月, 2015 4 次提交
  2. 12 2月, 2015 5 次提交
    • J
      f2fs: allocate data blocks in advance for f2fs_direct_IO · 59b802e5
      Jaegeuk Kim 提交于
      This patch adds preallocation for data blocks to prepare f2fs_direct_IO.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      59b802e5
    • J
      f2fs: call set_buffer_new for get_block · da17eece
      Jaegeuk Kim 提交于
      This patch fixes wrong handling of buffer_new flag in get_block.
      If f2fs allocates new blocks and mapped buffer_head, it needs to set buffer_new
      for the bh_result.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      da17eece
    • C
      f2fs: merge {invalidate,release}page for meta/node/data pages · 487261f3
      Chao Yu 提交于
      This patch merges ->{invalidate,release}page function for meta/node/data pages.
      
      After this, duplication of codes could be removed.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      487261f3
    • J
      f2fs: keep PagePrivate during releasepage · f68daeeb
      Jaegeuk Kim 提交于
      If PagePrivate is removed by releasepage, f2fs loses counting dirty pages.
      
      e.g., try_to_release_page will not release page when the page is dirty,
      but our releasepage removes PagePrivate.
      
          [<ffffffff81188d75>] try_to_release_page+0x35/0x50
          [<ffffffff811996f9>] invalidate_inode_pages2_range+0x2f9/0x3b0
          [<ffffffffa02a7f54>] ? truncate_blocks+0x384/0x4d0 [f2fs]
          [<ffffffffa02b7583>] ? f2fs_direct_IO+0x283/0x290 [f2fs]
          [<ffffffffa02b7fb0>] ? get_data_block_fiemap+0x20/0x20 [f2fs]
          [<ffffffff8118aa53>] generic_file_direct_write+0x163/0x170
          [<ffffffff8118ad06>] __generic_file_write_iter+0x2a6/0x350
          [<ffffffff8118adef>] generic_file_write_iter+0x3f/0xb0
          [<ffffffff81203081>] new_sync_write+0x81/0xb0
          [<ffffffff81203837>] vfs_write+0xb7/0x1f0
          [<ffffffff81204459>] SyS_write+0x49/0xb0
          [<ffffffff817c286d>] system_call_fastpath+0x16/0x1b
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      f68daeeb
    • C
      f2fs: merge flags in struct f2fs_sb_info · caf0047e
      Chao Yu 提交于
      Currently, there are several variables with Boolean type as below:
      
      struct f2fs_sb_info {
      ...
      	int s_dirty;
      	bool need_fsck;
      	bool s_closing;
      ...
      	bool por_doing;
      ...
      }
      
      For this there are some issues:
      1. there are some space of f2fs_sb_info is wasted due to aligning after Boolean
         type variables by compiler.
      2. if we continuously add new flag into f2fs_sb_info, structure will be messed
         up.
      
      So in this patch, we try to:
      1. switch s_dirty to Boolean type variable since it has two status 0/1.
      2. merge s_dirty/need_fsck/s_closing/por_doing variables into s_flag.
      3. introduce an enum type which can indicate different states of sbi.
      4. use new introduced universal interfaces is_sbi_flag_set/{set,clear}_sbi_flag
         to operate flags for sbi.
      
      After that, above issues will be fixed.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      caf0047e
  3. 10 1月, 2015 11 次提交
  4. 02 12月, 2014 1 次提交
  5. 26 11月, 2014 1 次提交
    • J
      f2fs: fix deadlock during inline_data conversion · 5f727395
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      5f727395
  6. 19 11月, 2014 1 次提交
  7. 05 11月, 2014 2 次提交
    • J
      f2fs: avoid race condition in handling wait_io · 6a8f8ca5
      Jaegeuk Kim 提交于
      __submit_merged_bio    f2fs_write_end_io        f2fs_write_end_io
                             wait_io = X              wait_io = x
                             complete(X)              complete(X)
                             wait_io = NULL
      wait_for_completion()
      free(X)
                                                       spin_lock(X)
                                                       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: NJaegeuk Kim <jaegeuk@kernel.org>
      6a8f8ca5
    • J
      f2fs: revisit inline_data to avoid data races and potential bugs · b3d208f9
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      b3d208f9
  8. 04 11月, 2014 4 次提交
  9. 08 10月, 2014 1 次提交
    • J
      f2fs: support volatile operations for transient data · 02a1335f
      Jaegeuk Kim 提交于
      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
       -> ioctl(F2FS_IOC_START_VOLATILE_WRITE);
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      02a1335f
  10. 07 10月, 2014 1 次提交
    • J
      f2fs: support atomic writes · 88b88a66
      Jaegeuk Kim 提交于
      This patch introduces a very limited functionality for atomic write support.
      In order to support atomic write, this patch adds two ioctls:
       o F2FS_IOC_START_ATOMIC_WRITE
       o F2FS_IOC_COMMIT_ATOMIC_WRITE
      
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      88b88a66
  11. 24 9月, 2014 4 次提交
    • C
      f2fs: support large sector size · 55cf9cb6
      Chao Yu 提交于
      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: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      55cf9cb6
    • J
      f2fs: update i_size when __allocate_data_block · 976e4c50
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      976e4c50
    • J
      f2fs: use MAX_BIO_BLOCKS(sbi) · 90a893c7
      Jaegeuk Kim 提交于
      This patch cleans up a simple macro.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      90a893c7
    • J
      f2fs: fix conditions to remain recovery information in f2fs_sync_file · 88bd02c9
      Jaegeuk Kim 提交于
      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: NHuang Ying <ying.huang@intel.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      88bd02c9
  12. 16 9月, 2014 1 次提交
  13. 10 9月, 2014 1 次提交
  14. 04 9月, 2014 1 次提交
  15. 22 8月, 2014 2 次提交
    • J
      f2fs: avoid double lock in truncate_blocks · 764aa3e9
      Jaegeuk Kim 提交于
      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
      truncate_blocks.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      764aa3e9
    • J
      f2fs: handle EIO not to break fs consistency · cf779cab
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      cf779cab