1. 03 6月, 2016 7 次提交
  2. 11 5月, 2016 1 次提交
  3. 08 5月, 2016 3 次提交
  4. 28 4月, 2016 2 次提交
  5. 15 4月, 2016 1 次提交
    • C
      f2fs: fix to convert inline directory correctly · 675f10bd
      Chao Yu 提交于
      With below serials, we will lose parts of dirents:
      
      1) mount f2fs with inline_dentry option
      2) echo 1 > /sys/fs/f2fs/sdX/dir_level
      3) mkdir dir
      4) touch 180 files named [1-180] in dir
      5) touch 181 in dir
      6) echo 3 > /proc/sys/vm/drop_caches
      7) ll dir
      
      ls: cannot access 2: No such file or directory
      ls: cannot access 4: No such file or directory
      ls: cannot access 5: No such file or directory
      ls: cannot access 6: No such file or directory
      ls: cannot access 8: No such file or directory
      ls: cannot access 9: No such file or directory
      ...
      total 360
      drwxr-xr-x 2 root root 4096 Feb 19 15:12 ./
      drwxr-xr-x 3 root root 4096 Feb 19 15:11 ../
      -rw-r--r-- 1 root root    0 Feb 19 15:12 1
      -rw-r--r-- 1 root root    0 Feb 19 15:12 10
      -rw-r--r-- 1 root root    0 Feb 19 15:12 100
      -????????? ? ?    ?       ?            ? 101
      -????????? ? ?    ?       ?            ? 102
      -????????? ? ?    ?       ?            ? 103
      ...
      
      The reason is: when doing the inline dir conversion, we didn't consider
      that directory has hierarchical hash structure which can be configured
      through sysfs interface 'dir_level'.
      
      By default, dir_level of directory inode is 0, it means we have one bucket
      in hash table located in first level, all dirents will be hashed in this
      bucket, so it has no problem for us to do the duplication simply between
      inline dentry page and converted normal dentry page.
      
      However, if we configured dir_level with the value N (greater than 0), it
      will expand the bucket number of first level hash table by 2^N - 1, it
      hashs dirents into different buckets according their hash value, if we
      still move all dirents to first bucket, it makes incorrent locating for
      inline dirents, the result is, although we can iterate all dirents through
      ->readdir, we can't stat some of them in ->lookup which based on hash
      table searching.
      
      This patch fixes this issue by rehashing dirents into correct position
      when converting inline directory.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      675f10bd
  6. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  7. 18 3月, 2016 3 次提交
  8. 23 2月, 2016 3 次提交
  9. 12 1月, 2016 1 次提交
  10. 01 1月, 2016 1 次提交
  11. 17 12月, 2015 1 次提交
  12. 05 12月, 2015 2 次提交
  13. 13 10月, 2015 1 次提交
    • J
      f2fs: set GFP_NOFS for grab_cache_page · a56c7c6f
      Jaegeuk Kim 提交于
      For normal inodes, their pages are allocated with __GFP_FS, which can cause
      filesystem calls when reclaiming memory.
      This can incur a dead lock condition accordingly.
      
      So, this patch addresses this problem by introducing
      f2fs_grab_cache_page(.., bool for_write), which calls
      grab_cache_page_write_begin() with AOP_FLAG_NOFS.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      a56c7c6f
  14. 10 10月, 2015 1 次提交
    • J
      f2fs crypto: allocate buffer for decrypting filename · 569cf187
      Jaegeuk Kim 提交于
      We got dentry pages from high_mem, and its address space directly goes into the
      decryption path via f2fs_fname_disk_to_usr.
      But, sg_init_one assumes the address is not from high_mem, so we can get this
      panic since it doesn't call kmap_high but kunmap_high is triggered at the end.
      
      kernel BUG at ../../../../../../kernel/mm/highmem.c:290!
      Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
      ...
       (kunmap_high+0xb0/0xb8) from [<c0114534>] (__kunmap_atomic+0xa0/0xa4)
       (__kunmap_atomic+0xa0/0xa4) from [<c035f028>] (blkcipher_walk_done+0x128/0x1ec)
       (blkcipher_walk_done+0x128/0x1ec) from [<c0366c24>] (crypto_cbc_decrypt+0xc0/0x170)
       (crypto_cbc_decrypt+0xc0/0x170) from [<c0367148>] (crypto_cts_decrypt+0xc0/0x114)
       (crypto_cts_decrypt+0xc0/0x114) from [<c035ea98>] (async_decrypt+0x40/0x48)
       (async_decrypt+0x40/0x48) from [<c032ca34>] (f2fs_fname_disk_to_usr+0x124/0x304)
       (f2fs_fname_disk_to_usr+0x124/0x304) from [<c03056fc>] (f2fs_fill_dentries+0xac/0x188)
       (f2fs_fill_dentries+0xac/0x188) from [<c03059c8>] (f2fs_readdir+0x1f0/0x300)
       (f2fs_readdir+0x1f0/0x300) from [<c0218054>] (vfs_readdir+0x90/0xb4)
       (vfs_readdir+0x90/0xb4) from [<c0218418>] (SyS_getdents64+0x64/0xcc)
       (SyS_getdents64+0x64/0xcc) from [<c0105ba0>] (ret_fast_syscall+0x0/0x30)
      
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      569cf187
  15. 21 8月, 2015 1 次提交
    • C
      f2fs: avoid clear valid page · 206e61be
      Chao Yu 提交于
      In f2fs_delete_entry, if last dirent is remove from the dentry page,
      we will try to punch that page since it has no valid date in it.
      
      But truncate_hole which is used for punching could fail because of
      no memory or IO error, if that happened, we'd better skip clearing
      this valid dentry page.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      206e61be
  16. 02 6月, 2015 2 次提交
  17. 29 5月, 2015 6 次提交
  18. 11 4月, 2015 3 次提交
    • J
      f2fs: assign parent's i_mode for empty dir · cb58463b
      Jaegeuk Kim 提交于
      When assigning i_mode for dotdot, it needs to assign parent's i_mode.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      cb58463b
    • J
      f2fs: add F2FS_INLINE_DOTS to recover missing dot dentries · 510022a8
      Jaegeuk Kim 提交于
      If f2fs was corrupted with missing dot dentries, it needs to recover them after
      fsck.f2fs detection.
      
      The underlying precedure is:
      
      1. The fsck.f2fs remains F2FS_INLINE_DOTS flag in directory inode, if it detects
      missing dot dentries.
      
      2. When f2fs looks up the corrupted directory, it triggers f2fs_add_link with
      proper inode numbers and their dot and dotdot names.
      
      3. Once f2fs recovers the directory without errors, it removes F2FS_INLINE_DOTS
      finally.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      510022a8
    • C
      f2fs: fix to calculate max length of contiguous free slots correctly · bda19076
      Chao Yu 提交于
      When lookuping for creating, we will try to record the level of current dentry
      hash table if current dentry has enough contiguous slots for storing name of new
      file which will be created later, this can save our lookup time when add a link
      into parent dir.
      
      But currently in find_target_dentry, our current length of contiguous free slots
      is not calculated correctly. This make us leaving some holes in dentry block
      occasionally, it wastes our space of dentry block.
      
      Let's refactor the lookup flow for max slots as following to fix this issue:
      a) increase max_len if current slot is free;
      b) update max_slots with max_len if max_len is larger than max_slots;
      c) reset max_len to zero if current slot is not free.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      bda19076