1. 29 5月, 2015 13 次提交
  2. 08 5月, 2015 4 次提交
  3. 05 5月, 2015 2 次提交
  4. 17 4月, 2015 3 次提交
  5. 16 4月, 2015 2 次提交
  6. 12 4月, 2015 4 次提交
  7. 11 4月, 2015 12 次提交
    • J
      f2fs: do not recover wrong data index · e03b07d9
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      e03b07d9
    • J
      f2fs: do not increase link count during recovery · 418f6c27
      Jaegeuk Kim 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      418f6c27
    • 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
    • J
      f2fs: fix mismatching lock and unlock pages for roll-forward recovery · c9ef4810
      Jaegeuk Kim 提交于
      Previously, inode page is not correctly locked and unlocked in pair during
      the roll-forward recovery.
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      c9ef4810
    • J
      f2fs: fix sparse warnings · adad81ed
      Jaegeuk Kim 提交于
      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: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      adad81ed
    • C
      f2fs: limit b_size of mapped bh in f2fs_map_bh · 1b3e27a9
      Chao Yu 提交于
      Map bh over max size which caller defined is not needed, limit it in
      f2fs_map_bh.
      Signed-off-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      1b3e27a9
    • C
      f2fs: persist system.advise into on-disk inode · 30c62fdb
      Chao Yu 提交于
      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: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      30c62fdb
    • C
      f2fs: avoid NULL pointer dereference in f2fs_xattr_advise_get · 84e97c27
      Chao Yu 提交于
      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: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      84e97c27
    • C
      f2fs: preallocate fallocated blocks for direct IO · df6136ef
      Chao Yu 提交于
      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: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      df6136ef
    • W
      f2fs: enable inline data by default · 75342797
      Wanpeng Li 提交于
      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: NJaegeuk Kim <jaegeuk@kernel.org>
      Suggested-by: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NWanpeng Li <wanpeng.li@linux.intel.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      75342797
    • C
      f2fs: preserve extent info for extent cache · 0bdee482
      Chao Yu 提交于
      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: NChao Yu <chao2.yu@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      0bdee482