1. 29 5月, 2015 6 次提交
    • J
      f2fs crypto: add encryption policy and password salt support · f424f664
      Jaegeuk Kim 提交于
      This patch adds encryption policy and password salt support through ioctl
      implementation.
      
      It adds three ioctls:
       F2FS_IOC_SET_ENCRYPTION_POLICY,
       F2FS_IOC_GET_ENCRYPTION_POLICY,
       F2FS_IOC_GET_ENCRYPTION_PWSALT, which use xattr operations.
      
      Note that, these definition and codes are taken from ext4 crypto support.
      For f2fs, xattr operations and on-disk flags for superblock and inode were
      changed.
      Signed-off-by: NMichael Halcrow <mhalcrow@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NIldar Muslukhov <muslukhovi@gmail.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      f424f664
    • C
      f2fs: support FALLOC_FL_ZERO_RANGE · 75cd4e09
      Chao Yu 提交于
      Now, FALLOC_FL_ZERO_RANGE flag in ->fallocate is supported in ext4/xfs.
      
      In commit, the semantics of this flag is descripted as following:"
      1) Make sure that both offset and len are block size aligned.
      2) Update the i_size of inode by len bytes.
      3) Compute the file's logical block number against offset. If the computed
         block number is not the starting block of the extent, split the extent
         such that the block number is the starting block of the extent.
      4) Shift all the extents which are lying between
         [offset, last allocated extent] towards right by len bytes. This step
         will make a hole of len bytes at offset."
      
      This patch implements fallocate's FALLOC_FL_ZERO_RANGE for f2fs.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      75cd4e09
    • C
      f2fs: support FALLOC_FL_COLLAPSE_RANGE · b4ace337
      Chao Yu 提交于
      Now, FALLOC_FL_COLLAPSE_RANGE flag in ->fallocate is supported in ext4/xfs.
      
      In commit, the semantics of this flag is descripted as following:"
      1) It collapses the range lying between offset and length by removing any
         data blocks which are present in this range and than updates all the
         logical offsets of extents beyond "offset + len" to nullify the hole
         created by removing blocks. In short, it does not leave a hole.
      2) It should be used exclusively. No other fallocate flag in combination.
      3) Offset and length supplied to fallocate should be fs block size aligned
         in case of xfs and ext4.
      4) Collaspe range does not work beyond i_size."
      
      This patch implements fallocate's FALLOC_FL_COLLAPSE_RANGE for f2fs.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      b4ace337
    • J
      f2fs: split find_data_page according to specific purposes · 43f3eae1
      Jaegeuk Kim 提交于
      This patch splits find_data_page as follows.
      
      1. f2fs_gc
       - use get_read_data_page() with read only
      
      2. find_in_level
       - use find_data_page without locked page
      
      3. truncate_partial_page
       - In the case cache_only mode, just drop cached page.
       - Ohterwise, use get_lock_data_page() and guarantee to truncate
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      43f3eae1
    • J
      f2fs: add sbi and page pointer in f2fs_io_info · 05ca3632
      Jaegeuk Kim 提交于
      This patch adds f2fs_sb_info and page pointers in f2fs_io_info structure.
      With this change, we can reduce a lot of parameters for IO functions.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      05ca3632
    • J
      f2fs: add f2fs_may_inline_{data, dentry} · 01b960e9
      Jaegeuk Kim 提交于
      This patch adds f2fs_may_inline_data and f2fs_may_inline_dentry.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      01b960e9
  2. 08 5月, 2015 1 次提交
  3. 16 4月, 2015 1 次提交
  4. 12 4月, 2015 1 次提交
  5. 11 4月, 2015 5 次提交
    • C
      f2fs: split set_data_blkaddr from f2fs_update_extent_cache · 216a620a
      Chao Yu 提交于
      Split __set_data_blkaddr from f2fs_update_extent_cache for readability.
      
      Additionally rename __set_data_blkaddr to set_data_blkaddr for exporting.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      216a620a
    • J
      f2fs: avoid punch_hole overhead when releasing volatile data · 3c6c2beb
      Jaegeuk Kim 提交于
      This patch is to avoid some punch_hole overhead when releasing volatile data.
      If volatile data was not written yet, we just can make the first page as zero.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      3c6c2beb
    • C
      f2fs: fix to truncate inline data past EOF · 0bfcfcca
      Chao Yu 提交于
      Previously if inode is with inline data, we will try to invalid partial inline
      data in page #0 when we truncate size of inode in truncate_partial_data_page().
      And then we set page #0 to dirty, after this we can synchronize inode page with
      page #0 at ->writepage().
      
      But sometimes we will fail to operate page #0 in truncate_partial_data_page()
      due to below reason:
      a) if offset is zero, we will skip setting page #0 to dirty.
      b) if page #0 is not uptodate, we will fail to update it as it has no mapping
      data.
      
      So with following operations, we will meet recent data which should be
      truncated.
      
      1.write inline data to file
      2.sync first data page to inode page
      3.truncate file size to 0
      4.truncate file size to max_inline_size
      5.echo 1 > /proc/sys/vm/drop_caches
      6.read file --> meet original inline data which is remained in inode page.
      
      This patch renames truncate_inline_data() to truncate_inline_inode() for code
      readability, then use truncate_inline_inode() to truncate inline data in inode
      page in truncate_blocks() and truncate page #0 in truncate_partial_data_page()
      for fixing.
      
      v2:
       o truncate partially #0 page in truncate_partial_data_page to avoid keeping
         old data in #0 page.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0bfcfcca
    • J
      f2fs: clear append/update flags once fsync is done · cff28521
      Jaegeuk Kim 提交于
      When fsync is done through checkpoint, previous f2fs missed to clear append
      and update flag. This patch fixes to clear them.
      
      This was originally catched by Changman Lee before.
      Signed-off-by: NChangman Lee <cm224.lee@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      cff28521
    • J
      f2fs: support fs shutdown · 1abff93d
      Jaegeuk Kim 提交于
      This patch introduces a generic ioctl for fs shutdown, which was used by xfs.
      
      If this shutdown is triggered, filesystem stops any further IOs according to the
      following options.
      
      1. FS_GOING_DOWN_FULLSYNC
       : this will flush all the data and dentry blocks, and do checkpoint before
         shutdown.
      
      2. FS_GOING_DOWN_METASYNC
       : this will do checkpoint before shutdown.
      
      3. FS_GOING_DOWN_NOSYNC
       : this will trigger shutdown as is.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1abff93d
  6. 04 3月, 2015 1 次提交
    • C
      f2fs: introduce universal lookup/update interface for extent cache · 7e4dde79
      Chao Yu 提交于
      In this patch, we do these jobs:
      1. rename {check,update}_extent_cache to {lookup,update}_extent_info;
      2. introduce universal lookup/update interface of extent cache:
      f2fs_{lookup,update}_extent_cache including above two real functions, then
      export them to function callers.
      
      So after above cleanup, we can add new rb-tree based extent cache into exported
      interfaces.
      
      v2:
       o remove "f2fs_" for inner function {lookup,update}_extent_info suggested by
         Jaegeuk Kim.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      7e4dde79
  7. 12 2月, 2015 4 次提交
    • J
      f2fs: introduce macros to convert bytes and blocks in f2fs · f7ef9b83
      Jaegeuk Kim 提交于
      This patch adds two macros for transition between byte and block offsets.
      Currently, f2fs only supports 4KB blocks, so use the default size for now.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      f7ef9b83
    • C
      f2fs: avoid data offset overflow when lseeking huge file · 2e023174
      Chao Yu 提交于
      xfstest generic/285 complains our issue in lseeking huge file.
      
      Here is the detail output of generic/285:
      "./check -f2fs tests/generic/285
      Ran: generic/285
      Failures: generic/285
      Failed 1 of 1 tests
      
      10. Test a huge file for offset overflow
      10.01 SEEK_HOLE expected 65536 or 8589934592, got 65536.          succ
      10.02 SEEK_HOLE expected 65536 or 8589934592, got 65536.          succ
      10.03 SEEK_DATA expected 0 or 0, got 0.                           succ
      10.04 SEEK_DATA expected 1 or 1, got 1.                           succ
      10.05 SEEK_HOLE expected 8589934592 or 8589934592, got 0.         FAIL
      10.06 SEEK_DATA expected 8589869056 or 8589869056, got 8589869056. succ
      10.07 SEEK_DATA expected 8589869057 or 8589869057, got 8589869057. succ
      10.08 SEEK_DATA expected 8589869056 or 8589869056, got 4294901760. FAIL"
      
      The reason of this issue is:
      We will calculate current offset through left shifting page-offset with
      PAGE_CACHE_SHIFT bits, but our page-offset is a type of unsigned long, its size
      is 4 bytes in 32-bits machine.
      
      So if our page-offset is bigger than (1 << 32 / pagesize - 1), result of left
      shifting will overflow.
      
      Let's fix this issue by casting type of page-offset to type of current offset:
      loff_t.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      2e023174
    • C
      f2fs: add F2FS_IOC_GETVERSION support · d49f3e89
      Chao Yu 提交于
      In this patch we add the FS_IOC_GETVERSION ioctl for getting i_generation from
      inode, after that, users can list file's generation number by using "lsattr -v".
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d49f3e89
    • J
      f2fs: avoid infinite loop on cp_error · 871f599f
      Jaegeuk Kim 提交于
      If cp_error is set, we should avoid all the infinite loop.
      In f2fs_sync_file, there is a hole, and this patch fixes that.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      871f599f
  8. 11 2月, 2015 1 次提交
  9. 10 1月, 2015 3 次提交
  10. 09 12月, 2014 3 次提交
  11. 02 12月, 2014 1 次提交
  12. 12 11月, 2014 2 次提交
    • J
      f2fs: convert inline_data when i_size becomes large · 92dffd01
      Jaegeuk Kim 提交于
      If i_size becomes large outside of MAX_INLINE_DATA, we shoud convert the inode.
      Otherwise, we can make some dirty pages during the truncation, and those pages
      will be written through f2fs_write_data_page.
      At that moment, the inode has still inline_data, so that it tries to write non-
      zero pages into inline_data area.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      92dffd01
    • J
      f2fs: fix deadlock to grab 0'th data page · 764d2c80
      Jaegeuk Kim 提交于
      The scenario is like this.
      
      One trhead triggers:
        f2fs_write_data_pages
          lock_page
          f2fs_write_data_page
            f2fs_lock_op  <- wait
      
      The other thread triggers:
        f2fs_truncate
          truncate_blocks
            f2fs_lock_op
              truncate_partial_data_page
                lock_page  <- wait for locking the page
      
      This patch resolves this bug by relocating truncate_partial_data_page.
      This function is just to truncate user data page and not related to FS
      consistency as well.
      And, we don't need to call truncate_inline_data. Rather than that,
      f2fs_write_data_page will finally update inline_data later.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      764d2c80
  13. 06 11月, 2014 1 次提交
  14. 05 11月, 2014 2 次提交
  15. 04 11月, 2014 5 次提交
  16. 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
  17. 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
  18. 01 10月, 2014 1 次提交