1. 28 May, 2015 7 commits
  2. 07 May, 2015 4 commits
  3. 04 May, 2015 2 commits
  4. 16 Apr, 2015 3 commits
  5. 15 Apr, 2015 2 commits
  6. 12 Apr, 2015 4 commits
  7. 10 Apr, 2015 18 commits
    • Jaegeuk Kim's avatar
      f2fs: do not recover wrong data index · e03b07d9
      Jaegeuk Kim authored
      
      
      During the roll-forward recovery, if we found a new data index written fsync
      lastly, we need to recover new block address.
      But, if that address was corrupted, we should not recover that.
      Otherwise, f2fs gets kernel panic from:
      
       In check_index_in_prev_nodes(),
      
          sentry = get_seg_entry(sbi, segno);
                   --------------------------> out-of-range segno.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      e03b07d9
    • Jaegeuk Kim's avatar
      f2fs: do not increase link count during recovery · 418f6c27
      Jaegeuk Kim authored
      
      
      If there are multiple fsynced dnodes having a dent flag, roll-forward routine
      sets FI_INC_LINK for their inode, and recovery_dentry increases its link count
      accordingly.
      That results in normal file having a link count as 2, so we can't unlink those
      files.
      
      This was added to handle several inode blocks having same inode number with
      different directory paths.
      But, current f2fs doesn't replay all of path changes and only recover its dentry
      for the last fsynced inode block.
      So, there is no reason to do this.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      418f6c27
    • Jaegeuk Kim's avatar
      f2fs: assign parent's i_mode for empty dir · cb58463b
      Jaegeuk Kim authored
      
      
      When assigning i_mode for dotdot, it needs to assign parent's i_mode.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      cb58463b
    • Jaegeuk Kim's avatar
      f2fs: add F2FS_INLINE_DOTS to recover missing dot dentries · 510022a8
      Jaegeuk Kim authored
      
      
      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: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      510022a8
    • Jaegeuk Kim's avatar
      f2fs: fix mismatching lock and unlock pages for roll-forward recovery · c9ef4810
      Jaegeuk Kim authored
      
      
      Previously, inode page is not correctly locked and unlocked in pair during
      the roll-forward recovery.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      c9ef4810
    • Jaegeuk Kim's avatar
      f2fs: fix sparse warnings · adad81ed
      Jaegeuk Kim authored
      
      
      This patch fixes the below warning.
      
      sparse warnings: (new ones prefixed by >>)
      
      >> fs/f2fs/inode.c:56:23: sparse: restricted __le32 degrades to integer
      >> fs/f2fs/inode.c:56:52: sparse: restricted __le32 degrades to integer
      Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      adad81ed
    • Chao Yu's avatar
      f2fs: limit b_size of mapped bh in f2fs_map_bh · 1b3e27a9
      Chao Yu authored
      
      
      Map bh over max size which caller defined is not needed, limit it in
      f2fs_map_bh.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      1b3e27a9
    • Chao Yu's avatar
      f2fs: persist system.advise into on-disk inode · 30c62fdb
      Chao Yu authored
      
      
      This patch fixes to dirty inode for persisting i_advise of f2fs inode info into
      on-disk inode if user sets system.advise through setxattr. Otherwise the new
      value will be lost.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      30c62fdb
    • Chao Yu's avatar
      f2fs: avoid NULL pointer dereference in f2fs_xattr_advise_get · 84e97c27
      Chao Yu authored
      We will encounter oops by executing below command.
      getfattr -n system.advise /mnt/f2fs/file
      Killed
      
      message log:
      BUG: unable to handle kernel NULL pointer dereference at   (null)
      IP: [<f8b54d69>] f2fs_xattr_advise_get+0x29/0x40 [f2fs]
      *pdpt = 00000000319b7001 *pde = 0000000000000000
      Oops: 0002 [#1] SMP
      Modules linked in: f2fs(O) snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq joydev
      snd_seq_device snd_timer bnep snd rfcomm microcode bluetooth soundcore i2c_piix4 mac_hid serio_raw parport_pc ppdev lp parport
      binfmt_misc hid_generic psmouse usbhid hid e1000 [last unloaded: f2fs]
      CPU: 3 PID: 3134 Comm: getfattr Tainted: G           O    4.0.0-rc1 #6
      
      
      Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      task: f3a71b60 ti: f19a6000 task.ti: f19a6000
      EIP: 0060:[<f8b54d69>] EFLAGS: 00010246 CPU: 3
      EIP is at f2fs_xattr_advise_get+0x29/0x40 [f2fs]
      EAX: 00000000 EBX: f19a7e71 ECX: 00000000 EDX: f8b5b467
      ESI: 00000000 EDI: f2008570 EBP: f19a7e14 ESP: f19a7e08
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      CR0: 80050033 CR2: 00000000 CR3: 319b8000 CR4: 000007f0
      Stack:
       f8b5a634 c0cbb580 00000000 f19a7e34 c1193850 00000000 00000007 f19a7e71
       f19a7e64 c0cbb580 c1193810 f19a7e50 c1193c00 00000000 00000000 00000000
       c0cbb580 00000000 f19a7f70 c1194097 00000000 00000000 00000000 74737973
      Call Trace:
       [<c1193850>] generic_getxattr+0x40/0x50
       [<c1193810>] ? xattr_resolve_name+0x80/0x80
       [<c1193c00>] vfs_getxattr+0x70/0xa0
       [<c1194097>] getxattr+0x87/0x190
       [<c11801d7>] ? path_lookupat+0x57/0x5f0
       [<c11819d2>] ? putname+0x32/0x50
       [<c116653a>] ? kmem_cache_alloc+0x2a/0x130
       [<c11819d2>] ? putname+0x32/0x50
       [<c11819d2>] ? putname+0x32/0x50
       [<c11819d2>] ? putname+0x32/0x50
       [<c11827f9>] ? user_path_at_empty+0x49/0x70
       [<c118283f>] ? user_path_at+0x1f/0x30
       [<c11941e7>] path_getxattr+0x47/0x80
       [<c11948e7>] SyS_getxattr+0x27/0x30
       [<c163f748>] sysenter_do_call+0x12/0x12
      Code: 66 90 55 89 e5 57 56 53 66 66 66 66 90 8b 78 20 89 d3 ba 67 b4 b5 f8 89 d8 89 ce e8 42 7c 7b c8 85 c0 75 16 0f b6 87 44 01 00
      00 <88> 06 b8 01 00 00 00 5b 5e 5f 5d c3 8d 76 00 b8 ea ff ff ff eb
      EIP: [<f8b54d69>] f2fs_xattr_advise_get+0x29/0x40 [f2fs] SS:ESP 0068:f19a7e08
      CR2: 0000000000000000
      ---[ end trace 860260654f1f416a ]---
      
      The reason is that in getfattr there are two steps which is indicated by strace info:
      1) try to lookup and get size of specified xattr.
      2) get value of the extented attribute.
      
      strace info:
      getxattr("/mnt/f2fs/file", "system.advise", 0x0, 0) = 1
      getxattr("/mnt/f2fs/file", "system.advise", "\x00", 256) = 1
      
      For the first step, getfattr may pass a NULL pointer in @value and zero in @size
      as parameters for ->getxattr, but we access this @value pointer directly without
      checking whether the pointer is valid or not in f2fs_xattr_advise_get, so the
      oops occurs.
      
      This patch fixes this issue by verifying @value pointer before using.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      84e97c27
    • Chao Yu's avatar
      f2fs: preallocate fallocated blocks for direct IO · df6136ef
      Chao Yu authored
      Normally, due to DIO_SKIP_HOLES flag is set by default, blockdev_direct_IO in
      f2fs_direct_IO tries to skip DIO in holes when writing inside i_size, this
      makes us falling back to buffered IO which shows lower performance.
      
      So in commit 59b802e5
      
       ("f2fs: allocate data blocks in advance for
      f2fs_direct_IO"), we improve perfromance by allocating data blocks in advance
      if we meet holes no matter in i_size or not, since with it we can avoid falling
      back to buffered IO.
      
      But we forget to consider for unwritten fallocated block in this commit.
      This patch tries to fix it for fallocate case, this helps to improve
      performance.
      
      Test result:
      Storage info: sandisk ultra 64G micro sd card.
      
      touch /mnt/f2fs/file
      truncate -s 67108864 /mnt/f2fs/file
      fallocate -o 0 -l 67108864 /mnt/f2fs/file
      time dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=64 conv=notrunc oflag=direct
      
      Time before applying the patch:
      67108864 bytes (67 MB) copied, 36.16 s, 1.9 MB/s
      real    0m36.162s
      user    0m0.000s
      sys     0m0.180s
      
      Time after applying the patch:
      67108864 bytes (67 MB) copied, 27.7776 s, 2.4 MB/s
      real    0m27.780s
      user    0m0.000s
      sys     0m0.036s
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      df6136ef
    • Wanpeng Li's avatar
      f2fs: enable inline data by default · 75342797
      Wanpeng Li authored
      
      
      Enable inline_data feature by default since it brings us better
      performance and space utilization and now has already stable.
      Add another option noinline_data to disable it during mount.
      Suggested-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Suggested-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@linux.intel.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      75342797
    • Chao Yu's avatar
      f2fs: preserve extent info for extent cache · 0bdee482
      Chao Yu authored
      
      
      This patch tries to preserve last extent info in extent tree cache into on-disk
      inode, so this can help us to reuse the last extent info next time for
      performance.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      0bdee482
    • Chao Yu's avatar
      f2fs: initialize extent tree with on-disk extent info of inode · 028a41e8
      Chao Yu authored
      
      
      With normal extent info cache, we records largest extent mapping between logical
      block and physical block into extent info, and we persist extent info in on-disk
      inode.
      
      When we enable extent tree cache, if extent info of on-disk inode is exist, and
      the extent is not a small fragmented mapping extent. We'd better to load the
      extent info into extent tree cache when inode is loaded. By this way we can have
      more chance to hit extent tree cache rather than taking more time to read dnode
      page for block address.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      028a41e8
    • Chao Yu's avatar
      f2fs: introduce __{find,grab}_extent_tree · 93dfc526
      Chao Yu authored
      
      
      This patch introduces __{find,grab}_extent_tree for reusing by following
      patches.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      93dfc526
    • Chao Yu's avatar
      f2fs: split set_data_blkaddr from f2fs_update_extent_cache · 216a620a
      Chao Yu authored
      
      
      Split __set_data_blkaddr from f2fs_update_extent_cache for readability.
      
      Additionally rename __set_data_blkaddr to set_data_blkaddr for exporting.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      216a620a
    • Wanpeng Li's avatar
      f2fs: enable fast symlink by utilizing inline data · 368a0e40
      Wanpeng Li authored
      
      
      Fast symlink can utilize inline data flow to avoid using any
      i_addr region, since we need to handle many cases such as
      truncation, roll-forward recovery, and fsck/dump tools.
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@linux.intel.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      368a0e40
    • Jaegeuk Kim's avatar
    • Jaegeuk Kim's avatar
      f2fs: avoid punch_hole overhead when releasing volatile data · 3c6c2beb
      Jaegeuk Kim authored
      
      
      This patch is to avoid some punch_hole overhead when releasing volatile data.
      If volatile data was not written yet, we just can make the first page as zero.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      3c6c2beb