1. 12 2月, 2015 8 次提交
    • 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: 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
    • J
      f2fs: split UMOUNT and FASTBOOT flags · 119ee914
      Jaegeuk Kim 提交于
      This patch adds FASTBOOT flag into checkpoint as follows.
      
       - CP_UMOUNT_FLAG is set when system is umounted.
       - CP_FASTBOOT_FLAG is set when intermediate checkpoint having node summaries
         was done.
      
      So, if you get CP_UMOUNT_FLAG from checkpoint, the system was umounted cleanly.
      Instead, if there was sudden-power-off, you can get CP_FASTBOOT_FLAG or nothing.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      119ee914
    • J
      f2fs: avoid write_checkpoint if f2fs is mounted readonly · 11504a8e
      Jaegeuk Kim 提交于
      Do not change any partition when f2fs is changed to readonly mode.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      11504a8e
    • 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
    • C
      f2fs: fix to release count of meta page in ->invalidatepage · 1601839e
      Chao Yu 提交于
      We will encounter deadloop in below scenario:
      
      1. increase page count for F2FS_DIRTY_META type in following path:
      ->recover_fsync_data
        ->recover_data
          ->do_recover_data
            ->recover_data_page
              ->change_curseg
                ->write_sum_page
                  ->set_page_dirty
      2. fail in recover_data()
      3. invalidate meta pages in truncate_inode_pages_final without decreasing page
         count.
      4. deadloop when sync_meta_pages as page count will always be non-zero.
      
      message:
      NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s!
      
       [<c1129a37>] pagevec_lookup_tag+0x27/0x30
       [<f0e774c7>] sync_meta_pages+0x87/0x160 [f2fs]
       [<f0e86dd9>] recover_fsync_data+0xeb9/0xf10 [f2fs]
       [<f0e75398>] f2fs_fill_super+0x888/0x980 [f2fs]
       [<c11733ca>] mount_bdev+0x16a/0x1a0
       [<f0e7180f>] f2fs_mount+0x1f/0x30 [f2fs]
       [<c1173da6>] mount_fs+0x36/0x170
       [<c118b6f5>] vfs_kern_mount+0x55/0xe0
       [<c118d63f>] do_mount+0x1df/0x9f0
       [<c118e110>] SyS_mount+0x70/0xb0
       [<c15a0c48>] sysenter_do_call+0x12/0x12
      
      To avoid page count leak, let's add ->invalidatepage and ->releasepage in
      f2fs_meta_aops as f2fs_node_aops to release meta page count correctly.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1601839e
    • J
      f2fs: do checkpoint when umount flag is not set · 85dc2f2c
      Jaegeuk Kim 提交于
      If the previous checkpoint was done without CP_UMOUNT flag, it needs to do
      checkpoint with CP_UMOUNT for the next fast boot.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      85dc2f2c
  2. 10 1月, 2015 4 次提交
  3. 09 12月, 2014 3 次提交
  4. 06 12月, 2014 1 次提交
    • J
      f2fs: call radix_tree_preload before radix_tree_insert · 769ec6e5
      Jaegeuk Kim 提交于
      This patch tries to fix:
      
       BUG: using smp_processor_id() in preemptible [00000000] code: f2fs_gc-254:0/384
        (radix_tree_node_alloc+0x14/0x74) from [<c033d8a0>] (radix_tree_insert+0x110/0x200)
        (radix_tree_insert+0x110/0x200) from [<c02e8264>] (gc_data_segment+0x340/0x52c)
        (gc_data_segment+0x340/0x52c) from [<c02e8658>] (f2fs_gc+0x208/0x400)
        (f2fs_gc+0x208/0x400) from [<c02e8a98>] (gc_thread_func+0x248/0x28c)
        (gc_thread_func+0x248/0x28c) from [<c0139944>] (kthread+0xa0/0xac)
        (kthread+0xa0/0xac) from [<c0105ef8>] (ret_from_fork+0x14/0x3c)
      
      The reason is that f2fs calls radix_tree_insert under enabled preemption.
      So, before calling it, we need to call radix_tree_preload.
      
      Otherwise, we should use _GFP_WAIT for the radix tree, and use mutex or
      semaphore to cover the radix tree operations.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      769ec6e5
  5. 20 11月, 2014 2 次提交
    • J
      f2fs: write SSA pages under memory pressure · 857dc4e0
      Jaegeuk Kim 提交于
      Under memory pressure, we don't need to skip SSA page writes.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      857dc4e0
    • C
      f2fs: introduce struct inode_management to wrap inner fields · 67298804
      Chao Yu 提交于
      Now in f2fs, we have three inode cache: ORPHAN_INO, APPEND_INO, UPDATE_INO,
      and we manage fields related to inode cache separately in struct f2fs_sb_info
      for each inode cache type.
      This makes codes a bit messy, so that this patch intorduce a new struct
      inode_management to wrap inner fields as following which make codes more neat.
      
      /* for inner inode cache management */
      struct inode_management {
      	struct radix_tree_root ino_root;	/* ino entry array */
      	spinlock_t ino_lock;			/* for ino entry lock */
      	struct list_head ino_list;		/* inode list head */
      	unsigned long ino_num;			/* number of entries */
      };
      
      struct f2fs_sb_info {
      	...
      	struct inode_management im[MAX_INO_ENTRY];      /* manage inode cache */
      	...
      }
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      67298804
  6. 07 11月, 2014 1 次提交
  7. 05 11月, 2014 1 次提交
    • 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
  8. 04 11月, 2014 1 次提交
  9. 01 10月, 2014 3 次提交
  10. 24 9月, 2014 2 次提交
  11. 16 9月, 2014 2 次提交
  12. 10 9月, 2014 2 次提交
  13. 04 9月, 2014 1 次提交
  14. 23 8月, 2014 1 次提交
  15. 22 8月, 2014 4 次提交
  16. 20 8月, 2014 1 次提交
  17. 31 7月, 2014 3 次提交