1. 05 12月, 2015 5 次提交
    • C
      f2fs: fix to enable missing ioctl interfaces in ->compat_ioctl · 04ef4b62
      Chao Yu 提交于
      In 64-bit kernel f2fs can supports 32-bit ioctl system call by identifying
      encoded code which is converted from 32-bit one to 64-bit one in
      ->compat_ioctl.
      
      When we introduced new interfaces in ->ioctl, we forgot to enable them in
      ->compat_ioctl, so enable them for fixing.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      [Jaegeuk Kim: fix wrongly added spaces together]
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      04ef4b62
    • C
      f2fs: fix memory leak of kobject in error path of fill_super · 29ba108d
      Chao Yu 提交于
      f2fs_sb_info::s_kobj should be released in error path of fill_super,
      otherwise it will lead to memory leak.
      
      This bug was found by kmemleak:
      
      dmesg:
      kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
      
      cat /sys/kernel/debug/kmemleak
      unreferenced object 0xffff8800838dc358 (size 8):
        comm "mount", pid 4154, jiffies 4297482839 (age 1911.412s)
        hex dump (first 8 bytes):
          7a 72 61 6d 31 00 ff ff                          zram1...
        backtrace:
          [<ffffffff817a3668>] kmemleak_alloc+0x28/0x50
          [<ffffffff811dc99f>] __kmalloc_track_caller+0xef/0x1c0
          [<ffffffff8119d1c5>] kstrdup+0x45/0x80
          [<ffffffff8119d228>] kstrdup_const+0x28/0x30
          [<ffffffff813d2333>] kvasprintf_const+0x63/0xa0
          [<ffffffff813c59fc>] kobject_set_name_vargs+0x3c/0xa0
          [<ffffffff813c5a85>] kobject_add_varg+0x25/0x60
          [<ffffffff813c5b13>] kobject_init_and_add+0x53/0x70
          [<ffffffffa07ced19>] f2fs_fill_super+0x9d9/0xc40 [f2fs]
          [<ffffffff811ff0b2>] mount_bdev+0x192/0x1d0
          [<ffffffffa07cd3e5>] f2fs_mount+0x15/0x20 [f2fs]
          [<ffffffff811fec93>] mount_fs+0x43/0x170
          [<ffffffff81220256>] vfs_kern_mount+0x76/0x160
          [<ffffffff812211c8>] do_mount+0x258/0xdc0
          [<ffffffff81221dab>] SyS_mount+0x7b/0xc0
          [<ffffffff817aecd7>] entry_SYSCALL_64_fastpath+0x12/0x6f
      ...
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      29ba108d
    • C
      f2fs: support file defragment · d323d005
      Chao Yu 提交于
      This patch introduces a new ioctl F2FS_IOC_DEFRAGMENT to support file
      defragment in a specified range of regular file.
      
      This ioctl can be used in very limited workload: if user expects high
      sequential read performance in randomly written file, this interface
      can be used for defragmentation, after that file can be written as
      continuous as possible in the device.
      
      Meanwhile, it has side-effect, it will make holes in segments where
      blocks located originally, so it's better to trigger GC to eliminate
      fragment in segments.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d323d005
    • C
      f2fs: commit atomic written page in LFS mode · 2da3e027
      Chao Yu 提交于
      We should always commit atomic written pages in LFS mode, otherwise data
      will become corrupted if we encounter suddent power cut after partial
      pages committed in IPU mode.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      2da3e027
    • C
      f2fs: report error of f2fs_create_root_stats · 787c7b8c
      Chao Yu 提交于
      f2fs_create_root_stats can fail due to no memory, report it to user.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      787c7b8c
  2. 14 11月, 2015 2 次提交
  3. 10 11月, 2015 1 次提交
  4. 23 10月, 2015 3 次提交
  5. 22 10月, 2015 3 次提交
  6. 21 10月, 2015 3 次提交
  7. 14 10月, 2015 2 次提交
    • J
      f2fs: relocate the tracepoint for background_gc · 84e4214f
      Jaegeuk Kim 提交于
      Once f2fs_gc is done, wait_ms is changed once more.
      So, its tracepoint would be located after it.
      Reported-by: NHe YunLei <heyunlei@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      84e4214f
    • C
      f2fs crypto: fix racing of accessing encrypted page among · 08b39fbd
      Chao Yu 提交于
       different competitors
      
      Since we use different page cache (normally inode's page cache for R/W
      and meta inode's page cache for GC) to cache the same physical block
      which is belong to an encrypted inode. Writeback of these two page
      cache should be exclusive, but now we didn't handle writeback state
      well, so there may be potential racing problem:
      
      a)
      kworker:				f2fs_gc:
       - f2fs_write_data_pages
        - f2fs_write_data_page
         - do_write_data_page
          - write_data_page
           - f2fs_submit_page_mbio
      (page#1 in inode's page cache was queued
      in f2fs bio cache, and be ready to write
      to new blkaddr)
      					 - gc_data_segment
      					  - move_encrypted_block
      					   - pagecache_get_page
      					(page#2 in meta inode's page cache
      					was cached with the invalid datas
      					of physical block located in new
      					blkaddr)
      					   - f2fs_submit_page_mbio
      					(page#1 was submitted, later, page#2
      					with invalid data will be submitted)
      
      b)
      f2fs_gc:
       - gc_data_segment
        - move_encrypted_block
         - f2fs_submit_page_mbio
      (page#1 in meta inode's page cache was
      queued in f2fs bio cache, and be ready
      to write to new blkaddr)
      					user thread:
      					 - f2fs_write_begin
      					  - f2fs_submit_page_bio
      					(we submit the request to block layer
      					to update page#2 in inode's page cache
      					with physical block located in new
      					blkaddr, so here we may read gabbage
      					data from new blkaddr since GC hasn't
      					writebacked the page#1 yet)
      
      This patch fixes above potential racing problem for encrypted inode.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      08b39fbd
  8. 13 10月, 2015 9 次提交
  9. 10 10月, 2015 12 次提交
    • J
      f2fs: merge meta writes as many possible · 6066d8cd
      Jaegeuk Kim 提交于
      This patch tries to merge IOs as many as possible when background flusher
      conducts flushing the dirty meta pages.
      
      [Before]
      
      ...
      2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 124320, size = 4096
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 124560, size = 32768
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 95720, size = 987136
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123928, size = 4096
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123944, size = 8192
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123968, size = 45056
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 124064, size = 4096
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 97648, size = 1007616
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123776, size = 8192
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123800, size = 32768
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 124624, size = 4096
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 99616, size = 921600
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123608, size = 4096
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123624, size = 77824
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123792, size = 4096
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 123864, size = 32768
      ...
      
      [After]
      
      ...
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 92168, size = 892928
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 93912, size = 753664
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 95384, size = 716800
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 96784, size = 712704
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 104160, size = 364544
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 104872, size = 356352
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 105568, size = 278528
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 106112, size = 319488
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 106736, size = 258048
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 107240, size = 270336
      f2fs_submit_write_bio: dev = (8,18), WRITE_SYNC(MP), META, sector = 107768, size = 180224
      ...
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      6066d8cd
    • J
      f2fs: introduce a periodic checkpoint flow · 60b99b48
      Jaegeuk Kim 提交于
      This patch introduces a periodic checkpoint feature.
      Note that, this is not enforcing to conduct checkpoints very strictly in terms
      of trigger timing, instead just hope to help user experiences.
      The default value is 60 seconds.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      60b99b48
    • J
      f2fs: add a tracepoint for background gc · 5c267434
      Jaegeuk Kim 提交于
      This patch introduces a tracepoint to monitor background gc behaviors.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      5c267434
    • J
      f2fs: introduce background_gc=sync mount option · 6aefd93b
      Jaegeuk Kim 提交于
      This patch introduce background_gc=sync enabling synchronous cleaning in
      background.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      6aefd93b
    • C
      f2fs: introduce a new ioctl F2FS_IOC_WRITE_CHECKPOINT · 456b88e4
      Chao Yu 提交于
      This patch introduce a new ioctl for those users who want to trigger
      checkpoint from userspace through ioctl.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      456b88e4
    • C
      f2fs: support synchronous gc in ioctl · d530d4d8
      Chao Yu 提交于
      This patch drops in batches gc triggered through ioctl, since user
      can easily control the gc by designing the loop around the ->ioctl.
      
      We support synchronous gc by forcing using FG_GC in f2fs_gc, so with
      it, user can make sure that in this round all blocks gced were
      persistent in the device until ioctl returned.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      d530d4d8
    • C
      f2fs: skip searching dirty map if dirty segment is not exist · 3342bb30
      Chao Yu 提交于
      When searching victim during gc, if there are no dirty segments in
      filesystem, we will still take the time to search the whole dirty segment
      map, it's not needed, it's better to skip in this condition.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      3342bb30
    • C
      f2fs: fix to avoid redundant searching in dirty map during gc · a43f7ec3
      Chao Yu 提交于
      When doing gc, we search a victim in dirty map, starting from position of
      last victim, we will reset the current searching position until we touch
      the end of dirty map, and then search the whole diryt map. So sometimes we
      will search the range [victim, last] twice, it's redundant, this patch
      avoids this issue.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      a43f7ec3
    • C
      f2fs: use atomic64_t for extent cache hit stat · 5b7ee374
      Chao Yu 提交于
      Our hit stat of extent cache will increase all the time until remount,
      and we use atomic_t type for the stat variable, so it may easily incur
      overflow when we query extent cache frequently in a long time running
      fs.
      
      So to avoid that, this patch uses atomic64_t for hit stat variables.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      5b7ee374
    • J
      f2fs: use vmalloc to handle -ENOMEM error · 39307a8e
      Jaegeuk Kim 提交于
      This patch introduces f2fs_kvmalloc to avoid -ENOMEM during mount.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      39307a8e
    • J
      f2fs: should get a victim from retrials · ab126cfc
      Jaegeuk Kim 提交于
      If we do not call get_victim first, we cannot get a new victim for retrial
      path.
      Reviewed-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ab126cfc
    • C
      f2fs: fix to correct freed section number during gc · 45fe8492
      Chao Yu 提交于
      This patch fixes to maintain the right section count freed in garbage
      collecting when triggering a foreground gc.
      
      Besides, when a foreground gc is running on current selected section, once
      we fail to gc one segment, it's better to abandon gcing the left segments
      in current section, because anyway we will select next victim for
      foreground gc, so gc on the left segments in previous section will become
      overhead and also cause the long latency for caller.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      45fe8492