1. 18 3月, 2016 1 次提交
    • J
      fs crypto: move per-file encryption from f2fs tree to fs/crypto · 0b81d077
      Jaegeuk Kim 提交于
      This patch adds the renamed functions moved from the f2fs crypto files.
      
      1. definitions for per-file encryption used by ext4 and f2fs.
      
      2. crypto.c for encrypt/decrypt functions
       a. IO preparation:
        - fscrypt_get_ctx / fscrypt_release_ctx
       b. before IOs:
        - fscrypt_encrypt_page
        - fscrypt_decrypt_page
        - fscrypt_zeroout_range
       c. after IOs:
        - fscrypt_decrypt_bio_pages
        - fscrypt_pullback_bio_page
        - fscrypt_restore_control_page
      
      3. policy.c supporting context management.
       a. For ioctls:
        - fscrypt_process_policy
        - fscrypt_get_policy
       b. For context permission
        - fscrypt_has_permitted_context
        - fscrypt_inherit_context
      
      4. keyinfo.c to handle permissions
        - fscrypt_get_encryption_info
        - fscrypt_free_encryption_info
      
      5. fname.c to support filename encryption
       a. general wrapper functions
        - fscrypt_fname_disk_to_usr
        - fscrypt_fname_usr_to_disk
        - fscrypt_setup_filename
        - fscrypt_free_filename
      
       b. specific filename handling functions
        - fscrypt_fname_alloc_buffer
        - fscrypt_fname_free_buffer
      
      6. Makefile and Kconfig
      
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Signed-off-by: NMichael Halcrow <mhalcrow@google.com>
      Signed-off-by: NIldar Muslukhov <ildarm@google.com>
      Signed-off-by: NUday Savagaonkar <savagaon@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0b81d077
  2. 23 2月, 2016 3 次提交
  3. 09 1月, 2016 2 次提交
  4. 31 12月, 2015 1 次提交
    • J
      f2fs: load largest extent all the time · ed3d1256
      Jaegeuk Kim 提交于
      Otherwise, we can get mismatched largest extent information.
      
      One example is:
      1. mount f2fs w/ extent_cache
      2. make a small extent
      3. umount
      4. mount f2fs w/o extent_cache
      5. update the largest extent
      6. umount
      7. mount f2fs w/ extent_cache
      8. get the old extent made by #2
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ed3d1256
  5. 17 12月, 2015 1 次提交
  6. 16 12月, 2015 1 次提交
  7. 09 12月, 2015 1 次提交
    • A
      don't put symlink bodies in pagecache into highmem · 21fc61c7
      Al Viro 提交于
      kmap() in page_follow_link_light() needed to go - allowing to hold
      an arbitrary number of kmaps for long is a great way to deadlocking
      the system.
      
      new helper (inode_nohighmem(inode)) needs to be used for pagecache
      symlinks inodes; done for all in-tree cases.  page_follow_link_light()
      instrumented to yell about anything missed.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      21fc61c7
  8. 10 10月, 2015 1 次提交
  9. 25 8月, 2015 2 次提交
    • C
      f2fs: fix to release inode correctly · 13ec7297
      Chao Yu 提交于
      In following call stack, if unfortunately we lose all chances to truncate
      inode page in remove_inode_page, eventually we will add the nid allocated
      previously into free nid cache, this nid is with NID_NEW status and with
      NEW_ADDR in its blkaddr pointer:
      
       - f2fs_create
        - f2fs_add_link
         - __f2fs_add_link
          - init_inode_metadata
           - new_inode_page
            - new_node_page
             - set_node_addr(, NEW_ADDR)
           - f2fs_init_acl   failed
           - remove_inode_page  failed
        - handle_failed_inode
         - remove_inode_page  failed
         - iput
          - f2fs_evict_inode
           - remove_inode_page  failed
           - alloc_nid_failed   cache a nid with valid blkaddr: NEW_ADDR
      
      This may not only cause resource leak of previous inode, but also may cause
      incorrect use of the previous blkaddr which is located in NO.nid node entry
      when this nid is reused by others.
      
      This patch tries to add this inode to orphan list if we fail to truncate
      inode, so that we can obtain a second chance to release it in orphan
      recovery flow.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      13ec7297
    • Z
      f2fs: atomically set inode->i_flags · 6a678857
      Zhang Zhen 提交于
      According to commit 5f16f322 ("ext4: atomically set inode->i_flags in
      ext4_set_inode_flags()").
      Signed-off-by: NZhang Zhen <zhenzhang.zhang@huawei.com>
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      6a678857
  10. 05 8月, 2015 5 次提交
  11. 02 6月, 2015 1 次提交
    • J
      f2fs crypto: use per-inode tfm structure · 26bf3dc7
      Jaegeuk Kim 提交于
      This patch applies the following ext4 patch:
      
        ext4 crypto: use per-inode tfm structure
      
      As suggested by Herbert Xu, we shouldn't allocate a new tfm each time
      we read or write a page.  Instead we can use a single tfm hanging off
      the inode's crypt_info structure for all of our encryption needs for
      that inode, since the tfm can be used by multiple crypto requests in
      parallel.
      
      Also use cmpxchg() to avoid races that could result in crypt_info
      structure getting doubly allocated or doubly freed.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      26bf3dc7
  12. 29 5月, 2015 2 次提交
  13. 11 4月, 2015 4 次提交
  14. 04 3月, 2015 2 次提交
    • C
      f2fs: enable rb-tree extent cache · 1dcc336b
      Chao Yu 提交于
      This patch enables rb-tree based extent cache in f2fs.
      
      When we mount with "-o extent_cache", f2fs will try to add recently accessed
      page-block mappings into rb-tree based extent cache as much as possible, instead
      of original one extent info cache.
      
      By this way, f2fs can support more effective cache between dnode page cache and
      disk. It will supply high hit ratio in the cache with fewer memory when dnode
      page cache are reclaimed in environment of low memory.
      
      Storage: Sandisk sd card 64g
      1.append write file (offset: 0, size: 128M);
      2.override write file (offset: 2M, size: 1M);
      3.override write file (offset: 4M, size: 1M);
      ...
      4.override write file (offset: 48M, size: 1M);
      ...
      5.override write file (offset: 112M, size: 1M);
      6.sync
      7.echo 3 > /proc/sys/vm/drop_caches
      8.read file (size:128M, unit: 4k, count: 32768)
      (time dd if=/mnt/f2fs/128m bs=4k count=32768)
      
      Extent Hit Ratio:
      		before		patched
      Hit Ratio	121 / 1071	1071 / 1071
      
      Performance:
      		before		patched
      real    	0m37.051s	0m35.556s
      user    	0m0.040s	0m0.026s
      sys     	0m2.990s	0m2.251s
      
      Memory Cost:
      		before		patched
      Tree Count:	0		1 (size: 24 bytes)
      Node Count:	0		45 (size: 1440 bytes)
      
      v3:
       o retest and given more details of test result.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1dcc336b
    • C
      f2fs: move ext_lock out of struct extent_info · 0c872e2d
      Chao Yu 提交于
      Move ext_lock out of struct extent_info, then in the following patches we can
      use variables with struct extent_info type as a parameter to pass pure data.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0c872e2d
  15. 10 1月, 2015 2 次提交
    • C
      f2fs: get rid of kzalloc in __recover_inline_status · 9e5ba77f
      Chao Yu 提交于
      We use kzalloc to allocate memory in __recover_inline_status, and use this
      all-zero memory to check the inline date content of inode page by comparing
      them. This is low effective and not needed, let's check inline date content
      directly.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      [Jaegeuk Kim: make the code more neat]
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      9e5ba77f
    • J
      f2fs: change atomic and volatile write policies · 1e84371f
      Jaegeuk Kim 提交于
      This patch adds two new ioctls to release inmemory pages grabbed by atomic
      writes.
       o f2fs_ioc_abort_volatile_write
        - If transaction was failed, all the grabbed pages and data should be written.
       o f2fs_ioc_release_volatile_write
        - This is to enhance the performance of PERSIST mode in sqlite.
      
      In order to avoid huge memory consumption which causes OOM, this patch changes
      volatile writes to use normal dirty pages, instead blocked flushing to the disk
      as long as system does not suffer from memory pressure.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1e84371f
  16. 09 12月, 2014 1 次提交
  17. 05 11月, 2014 1 次提交
    • 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
  18. 04 11月, 2014 3 次提交
  19. 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
  20. 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
  21. 01 10月, 2014 1 次提交
  22. 16 9月, 2014 1 次提交
  23. 10 9月, 2014 1 次提交
  24. 04 9月, 2014 1 次提交