1. 01 10月, 2016 2 次提交
    • C
      f2fs: support configuring fault injection per superblock · 1ecc0c5c
      Chao Yu 提交于
      Previously, we only support global fault injection configuration, so that
      when we configure type/rate of fault injection through sysfs, mount
      option, it will influence all f2fs partition which is being used.
      
      It is not make sence, since it will be not convenient if developer want
      to test separated partitions with different fault injection rate/type
      simultaneously, also it's not possible to enable fault injection in one
      partition and disable fault injection in other one.
      
      >From now on, we move global configuration of fault injection in module
      into per-superblock, hence injection testing can be more flexible.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1ecc0c5c
    • W
      f2fs: add customized migrate_page callback · 5b7a487c
      Weichao Guo 提交于
      This patch improves the migration of dirty pages and allows migrating atomic
      written pages that F2FS uses in Page Cache. Instead of the fallback releasing
      page path, it provides better performance for memory compaction, CMA and other
      users of memory page migrating. For dirty pages, there is no need to write back
      first when migrating. For an atomic written page before committing, we can
      migrate the page and update the related 'inmem_pages' list at the same time.
      Signed-off-by: NWeichao Guo <guoweichao@huawei.com>
      Reviewed-by: NChao Yu <yuchao0@huawei.com>
      [Jaegeuk Kim: fix some coding style]
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      5b7a487c
  2. 14 9月, 2016 1 次提交
  3. 30 8月, 2016 1 次提交
  4. 19 8月, 2016 1 次提交
  5. 21 7月, 2016 1 次提交
  6. 16 7月, 2016 2 次提交
  7. 09 7月, 2016 5 次提交
  8. 07 7月, 2016 1 次提交
  9. 08 6月, 2016 2 次提交
  10. 03 6月, 2016 6 次提交
  11. 21 5月, 2016 1 次提交
    • C
      f2fs: fix to update dirty page count correctly · 0f3311a8
      Chao Yu 提交于
      Once we failed to merge inline data into inode page during flushing inline
      inode, we will skip invoking inode_dec_dirty_pages, which makes dirty page
      count incorrect, result in panic in ->evict_inode, Fix it.
      
      ------------[ cut here ]------------
      kernel BUG at /home/yuchao/git/devf2fs/inode.c:336!
      invalid opcode: 0000 [#1] PREEMPT SMP
      CPU: 3 PID: 10004 Comm: umount Tainted: G           O    4.6.0-rc5+ #17
      Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      task: f0c33000 ti: c5212000 task.ti: c5212000
      EIP: 0060:[<f89aacb5>] EFLAGS: 00010202 CPU: 3
      EIP is at f2fs_evict_inode+0x85/0x490 [f2fs]
      EAX: 00000001 EBX: c4529ea0 ECX: 00000001 EDX: 00000000
      ESI: c0131000 EDI: f89dd0a0 EBP: c5213e9c ESP: c5213e78
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      CR0: 80050033 CR2: b75878c0 CR3: 1a36a700 CR4: 000406f0
      Stack:
       c4529ea0 c4529ef4 c5213e8c c176d45c c4529ef4 00000000 c4529ea0 c4529fac
       f89dd0a0 c5213eb0 c1204a68 c5213ed8 c452a2b4 c6680930 c5213ec0 c1204b64
       c6680d44 c6680620 c5213eec c120588d ee84b000 ee84b5c0 c5214000 ee84b5e0
      Call Trace:
       [<c176d45c>] ? _raw_spin_unlock+0x2c/0x50
       [<c1204a68>] evict+0xa8/0x170
       [<c1204b64>] dispose_list+0x34/0x50
       [<c120588d>] evict_inodes+0x10d/0x130
       [<c11ea941>] generic_shutdown_super+0x41/0xe0
       [<c1185190>] ? unregister_shrinker+0x40/0x50
       [<c1185190>] ? unregister_shrinker+0x40/0x50
       [<c11eac52>] kill_block_super+0x22/0x70
       [<f89af23e>] kill_f2fs_super+0x1e/0x20 [f2fs]
       [<c11eae1d>] deactivate_locked_super+0x3d/0x70
       [<c11eb383>] deactivate_super+0x43/0x60
       [<c1208ec9>] cleanup_mnt+0x39/0x80
       [<c1208f50>] __cleanup_mnt+0x10/0x20
       [<c107d091>] task_work_run+0x71/0x90
       [<c105725a>] exit_to_usermode_loop+0x72/0x9e
       [<c1001c7c>] do_fast_syscall_32+0x19c/0x1c0
       [<c176dd48>] sysenter_past_esp+0x45/0x74
      EIP: [<f89aacb5>] f2fs_evict_inode+0x85/0x490 [f2fs] SS:ESP 0068:c5213e78
      ---[ end trace d30536330b7fdc58 ]---
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0f3311a8
  12. 08 5月, 2016 4 次提交
  13. 28 4月, 2016 1 次提交
    • C
      f2fs: move node pages only in victim section during GC · da011cc0
      Chao Yu 提交于
      For foreground GC, we cache node blocks in victim section and set them
      dirty, then we call sync_node_pages to flush these node pages, but
      meanwhile, those node pages which does not locate in victim section
      will be flushed together, so more bandwidth and continuous free space
      would be occupied.
      
      So for this condition, it's better to leave those unrelated node page
      in cache for further write hit, and let CP or VM to flush them afterward.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      da011cc0
  14. 27 4月, 2016 4 次提交
  15. 15 4月, 2016 2 次提交
  16. 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
  17. 18 3月, 2016 3 次提交
  18. 27 2月, 2016 1 次提交
    • C
      f2fs: fix to avoid deadlock when merging inline data · 19c7377b
      Chao Yu 提交于
      When testing with fsstress, kworker and user threads were both blocked:
      
      INFO: task kworker/u16:1:16580 blocked for more than 120 seconds.
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      kworker/u16:1   D ffff8803f2595390     0 16580      2 0x00000000
      Workqueue: writeback bdi_writeback_workfn (flush-251:0)
       ffff8802730e5760 0000000000000046 ffff880274729fc0 0000000000012440
       ffff8802730e5fd8 ffff8802730e4010 0000000000012440 0000000000012440
       ffff8802730e5fd8 0000000000012440 ffff880274729fc0 ffff88026eb50000
      Call Trace:
       [<ffffffff816fe9d9>] schedule+0x29/0x70
       [<ffffffff816ff895>] rwsem_down_read_failed+0xa5/0xf9
       [<ffffffff81378584>] call_rwsem_down_read_failed+0x14/0x30
       [<ffffffffa0694feb>] f2fs_write_data_page+0x31b/0x420 [f2fs]
       [<ffffffffa0690f1a>] __f2fs_writepage+0x1a/0x50 [f2fs]
       [<ffffffffa06922a0>] f2fs_write_data_pages+0xe0/0x290 [f2fs]
       [<ffffffff811473b3>] do_writepages+0x23/0x40
       [<ffffffff811cc3ee>] __writeback_single_inode+0x4e/0x250
       [<ffffffff811cd4f1>] writeback_sb_inodes+0x2c1/0x470
       [<ffffffff811cd73e>] __writeback_inodes_wb+0x9e/0xd0
       [<ffffffff811cda0b>] wb_writeback+0x1fb/0x2d0
       [<ffffffff811cdb7c>] wb_do_writeback+0x9c/0x220
       [<ffffffff811ce232>] bdi_writeback_workfn+0x72/0x1c0
       [<ffffffff8106b74e>] process_one_work+0x1de/0x5b0
       [<ffffffff8106e78f>] worker_thread+0x11f/0x3e0
       [<ffffffff810750ce>] kthread+0xde/0xf0
       [<ffffffff817093f8>] ret_from_fork+0x58/0x90
      
      fsstress thread stack:
       [<ffffffff81139f0e>] sleep_on_page+0xe/0x20
       [<ffffffff81139ef7>] __lock_page+0x67/0x70
       [<ffffffff8113b100>] find_lock_page+0x50/0x80
       [<ffffffff8113b24f>] find_or_create_page+0x3f/0xb0
       [<ffffffffa06983a9>] sync_node_pages+0x259/0x810 [f2fs]
       [<ffffffffa068d874>] write_checkpoint+0x1a4/0xce0 [f2fs]
       [<ffffffffa0686b0c>] f2fs_sync_fs+0x7c/0xd0 [f2fs]
       [<ffffffffa067c813>] f2fs_sync_file+0x143/0x5f0 [f2fs]
       [<ffffffff811d301b>] vfs_fsync_range+0x2b/0x40
       [<ffffffff811d304c>] vfs_fsync+0x1c/0x20
       [<ffffffff811d3291>] do_fsync+0x41/0x70
       [<ffffffff811d32d3>] SyS_fdatasync+0x13/0x20
       [<ffffffff817094a2>] system_call_fastpath+0x16/0x1b
       [<ffffffffffffffff>] 0xffffffffffffffff
      
      The reason of this issue is:
      CPU0:					CPU1:
       - f2fs_write_data_pages
      					 - f2fs_sync_fs
      					  - write_checkpoint
      					   - block_operations
      					    - f2fs_lock_all
      					     - down_write(sbi->cp_rwsem)
        - lock_page(page)
        - f2fs_write_data_page
      					    - sync_node_pages
      					     - flush_inline_data
      					      - pagecache_get_page(page, GFP_LOCK)
         - f2fs_lock_op
          - down_read(sbi->cp_rwsem)
      
      This patch alters to use trylock_page in flush_inline_data to fix this ABBA
      deadlock issue.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      19c7377b
  19. 26 2月, 2016 1 次提交
    • C
      f2fs: fix incorrect upper bound when iterating inode mapping tree · 80dd9c0e
      Chao Yu 提交于
      1. Inode mapping tree can index page in range of [0, ULONG_MAX], however,
      in some places, f2fs only search or iterate page in ragne of [0, LONG_MAX],
      result in miss hitting in page cache.
      
      2. filemap_fdatawait_range accepts range parameters in unit of bytes, so
      the max range it covers should be [0, LLONG_MAX], if we use [0, LONG_MAX]
      as range for waiting on writeback, big number of pages will not be covered.
      
      This patch corrects above two issues.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      80dd9c0e