1. 09 Jul, 2014 15 commits
    • Fabian Frederick's avatar
      f2fs: replace count*size kzalloc by kcalloc · b434babf
      Fabian Frederick authored
      kcalloc manages count*sizeof overflow.
      
      Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>
      Cc: linux-f2fs-devel@lists.sourceforge.net
      Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      b434babf
    • Chao Yu's avatar
      f2fs: refactor flush_nat_entries codes for reducing NAT writes · aec71382
      Chao Yu authored
      Although building NAT journal in cursum reduce the read/write work for NAT
      block, but previous design leave us lower performance when write checkpoint
      frequently for these cases:
      1. if journal in cursum has already full, it's a bit of waste that we flush all
         nat entries to page for persistence, but not to cache any entries.
      2. if journal in cursum is not full, we fill nat entries to journal util
         journal is full, then flush the left dirty entries to disk without merge
         journaled entries, so these journaled entries may be flushed to disk at next
         checkpoint but lost chance to flushed last time.
      
      In this patch we merge dirty entries located in same NAT block to nat entry set,
      and linked all set to list, sorted ascending order by entries' count of set.
      Later we flush entries in sparse set into journal as many as we can, and then
      flush merged entries to disk. In this way we can not only gain in performance,
      but also save lifetime of flash device.
      
      In my testing environment, it shows this patch can help to reduce NAT block
      writes obviously. In hard disk test case: cost time of fsstress is stablely
      reduced by about 5%.
      
      1. virtual machine + hard disk:
      fsstress -p 20 -n 200 -l 5
      		node num	cp count	nodes/cp
      based		4599.6		1803.0		2.551
      patched		2714.6		1829.6		1.483
      
      2. virtual machine + 32g micro SD card:
      fsstress -p 20 -n 200 -l 1 -w -f chown=0 -f creat=4 -f dwrite=0
      -f fdatasync=4 -f fsync=4 -f link=0 -f mkdir=4 -f mknod=4 -f rename=5
      -f rmdir=5 -f symlink=0 -f truncate=4 -f unlink=5 -f write=0 -S
      
      		node num	cp count	nodes/cp
      based		84.5		43.7		1.933
      patched		49.2		40.0		1.23
      
      Our latency of merging op shows not bad when handling extreme case like:
      merging a great number of dirty nats:
      latency(ns)	dirty nat count
      3089219		24922
      5129423		27422
      4000250		24523
      
      change log from v1:
       o fix wrong logic in add_nat_entry when grab a new nat entry set.
       o swith to create slab cache in create_node_manager_caches.
       o use GFP_ATOMIC instead of GFP_NOFS to avoid potential long latency.
      
      change log from v2:
       o make comment position more appropriate suggested by Jaegeuk Kim.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      aec71382
    • Jaegeuk Kim's avatar
      f2fs: clean up an unused parameter and assignment · a014e037
      Jaegeuk Kim authored
      This patch cleans up simple unnecessary codes.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      a014e037
    • Jaegeuk Kim's avatar
      f2fs: introduce f2fs_do_tmpfile for code consistency · b97a9b5d
      Jaegeuk Kim authored
      This patch adds f2fs_do_tmpfile to eliminate the redundant init_inode_metadata
      flow.
      Throught this, we can provide the consistent lock usage, e.g., fi->i_sem,  and
      this will enable better debugging stuffs.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      b97a9b5d
    • Chao Yu's avatar
      f2fs: support ->tmpfile() · 50732df0
      Chao Yu authored
      Add function f2fs_tmpfile() to support O_TMPFILE file creation, and modify logic
      of init_inode_metadata to enable linkat temp file.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      50732df0
    • Chao Yu's avatar
      f2fs: avoid to truncate non-updated page partially · ca0a81b3
      Chao Yu authored
      After we call find_data_page in truncate_partial_data_page, we could not
      guarantee this page is updated or not as error may occurred in lower layer.
      
      We'd better check status of the page to avoid this no updated page be
      writebacked to device.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      ca0a81b3
    • Chao Yu's avatar
      f2fs: avoid unneeded SetPageUptodate in f2fs_write_end · 5576cd6c
      Chao Yu authored
      We have already set page update in ->write_begin, so we should remove redundant
      SetPageUptodate in ->write_end.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      5576cd6c
    • Linus Torvalds's avatar
      Merge tag 'f2fs-fixes-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · 191d385f
      Linus Torvalds authored
      Pull f2fs bugfixes from Jaegeuk Kim:
       "This includes a couple of bug fixes found by xfstests.  In addition,
        one critical bug was reported by Brian Chadwick, which is falling into
        the infinite loop in balance_dirty_pages.  And it turned out due to
        the IO merging policy in f2fs, which was newly merged in 3.16.
      
         - fix normal and recovery path for fallocated regions
         - fix error case mishandling
         - recover renamed fsync inodes correctly
         - fix to get out of infinite loops in balance_dirty_pages
         - fix kernel NULL pointer error"
      
      * tag 'f2fs-fixes-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
        f2fs: avoid to access NULL pointer in issue_flush_thread
        f2fs: check bdi->dirty_exceeded when trying to skip data writes
        f2fs: do checkpoint for the renamed inode
        f2fs: release new entry page correctly in error path of f2fs_rename
        f2fs: fix error path in init_inode_metadata
        f2fs: check lower bound nid value in check_nid_range
        f2fs: remove unused variables in f2fs_sm_info
        f2fs: fix not to allocate unnecessary blocks during fallocate
        f2fs: recover fallocated data and its i_size together
        f2fs: fix to report newly allocate region as extent
      191d385f
    • Chao Yu's avatar
      f2fs: avoid to access NULL pointer in issue_flush_thread · 50e1f8d2
      Chao Yu authored
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75861
      
      Denis 2014-05-10 11:28:59 UTC reported:
      "F2FS-fs (mmcblk0p28): mounting..
       Unable to handle kernel NULL pointer dereference at virtual address 00000018
       ...
       [<c0a2f678>] (_raw_spin_lock+0x3c/0x70) from [<c03a0330>] (issue_flush_thread+0x50/0x17c)
       [<c03a0330>] (issue_flush_thread+0x50/0x17c) from [<c01b4064>] (kthread+0x98/0xa4)
       [<c01b4064>] (kthread+0x98/0xa4) from [<c0108060>] (kernel_thread_exit+0x0/0x8)"
      
      This patch assign cmd_control_info in sm_info before issue_flush_thread is being
      created, so this make sure that issue flush thread will have no chance to access
      invalid info in fcc.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Reviewed-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      50e1f8d2
    • Jaegeuk Kim's avatar
      f2fs: check bdi->dirty_exceeded when trying to skip data writes · 2743f865
      Jaegeuk Kim authored
      If we don't check the current backing device status, balance_dirty_pages can
      fall into infinite pausing routine.
      
      This can be occurred when a lot of directories make a small number of dirty
      dentry pages including files.
      Reported-by: default avatarBrian Chadwick <brianchad@westnet.com.au>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      2743f865
    • Jaegeuk Kim's avatar
      f2fs: do checkpoint for the renamed inode · b2c08299
      Jaegeuk Kim authored
      If an inode is renamed, it should be registered as file_lost_pino to conduct
      checkpoint at f2fs_sync_file.
      Otherwise, the inode cannot be recovered due to no dent_mark in the following
      scenario.
      
      Note that, this scenario is from xfstests/322.
      
      1. create "a"
      2. fsync "a"
      3. rename "a" to "b"
      4. fsync "b"
      5. Sudden power-cut
      
      After recovery is done, "b" should be seen.
      However, the result shows "a", since the recovery procedure does not enter
      recover_dentry due to no dent_mark.
      
      The reason is like below.
      - The nid of "a" is checkpointed during #2, f2fs_sync_file.
      - The inode page for "b" produced by #3 is written without dent_mark by
      sync_node_pages.
      
      So, this patch fixes this bug by assinging file_lost_pino to the "a"'s inode.
      If the pino is lost, f2fs_sync_file conducts checkpoint, and then recovers
      the latest pino and its dentry information for further recovery.
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      b2c08299
    • Chao Yu's avatar
      f2fs: release new entry page correctly in error path of f2fs_rename · dd4d961f
      Chao Yu authored
      This patch correct releasing code of new_page to avoid BUG_ON in error patch of
      f2fs_rename.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      dd4d961f
    • Chao Yu's avatar
      f2fs: fix error path in init_inode_metadata · 90d72459
      Chao Yu authored
      If we fail in this path:
      ->init_inode_metadata
        ->make_empty_dir
          ->get_new_data_page
            ->grab_cache_page return -ENOMEM
      
      We will bug on in error path of init_inode_metadata when call remove_inode_page
      because i_block = 2 (one inode block will be released later & one dentry block).
      
      We should release the dentry block in init_inode_metadata to avoid this BUG_ON,
      and avoid leak of dentry block resource, because we never have second chance to
      release that block in ->evict_inode as in upper error path we make this inode
      'bad'.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      90d72459
    • Chao Yu's avatar
      f2fs: check lower bound nid value in check_nid_range · d6b7d4b3
      Chao Yu authored
      This patch add lower bound verification for nid in check_nid_range, so nids
      reserved like 0, node, meta passed by caller could be checked there.
      
      And then check_nid_range could be used in f2fs_nfs_get_inode for simplifying
      code.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      d6b7d4b3
    • Chao Yu's avatar
      f2fs: remove unused variables in f2fs_sm_info · 8bc6f60e
      Chao Yu authored
      Remove unused variables in struct f2fs_sm_info.
      Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      8bc6f60e
  2. 08 Jul, 2014 1 commit
  3. 07 Jul, 2014 7 commits
  4. 06 Jul, 2014 4 commits
    • Linus Torvalds's avatar
      Linux 3.16-rc4 · cd3de83f
      Linus Torvalds authored
      cd3de83f
    • Linus Torvalds's avatar
      Merge tag 'dt-for-linus' of git://git.secretlab.ca/git/linux · 100193f5
      Linus Torvalds authored
      Pull devicetree bugfix from Grant Likely:
       "Important bug fix for parsing 64-bit addresses on 32-bit platforms.
        Without this patch the kernel will try to use memory ranges that
        cannot be reached"
      
      * tag 'dt-for-linus' of git://git.secretlab.ca/git/linux:
        of: Check for phys_addr_t overflows in early_init_dt_add_memory_arch
      100193f5
    • Linus Torvalds's avatar
      Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 8addf0c7
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a set of 13 fixes, a MAINTAINERS update and a sparse update.
        The fixes are mostly correct value initialisations, avoiding NULL
        derefs and some uninitialised pointer avoidance.
      
        All the patches have been incubated in -next for a few days.  The
        final patch (use the scsi data buffer length to extract transfer size)
        has been rebased to add a cc to stable, but only the commit message
        has changed"
      
      * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        [SCSI] use the scsi data buffer length to extract transfer size
        virtio-scsi: fix various bad behavior on aborted requests
        virtio-scsi: avoid cancelling uninitialized work items
        ibmvscsi: Add memory barriers for send / receive
        ibmvscsi: Abort init sequence during error recovery
        qla2xxx: Fix sparse warning in qla_target.c.
        bnx2fc: Improve stats update mechanism
        bnx2fc: do not scan uninitialized lists in case of error.
        fc: ensure scan_work isn't active when freeing fc_rport
        pm8001: Fix potential null pointer dereference and memory leak.
        MAINTAINERS: Update LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) maintainers Email IDs
        be2iscsi: remove potential junk pointer free
        be2iscsi: add an missing goto in error path
        scsi_error: set DID_TIME_OUT correctly
        scsi_error: fix invalid setting of host byte
      8addf0c7
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 110e4308
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "i915, tda998x and vmwgfx fixes,
      
        The main one is i915 fix for missing VGA connectors, along with some
        fixes for the tda998x from Russell fixing some modesetting problems.
      
        (still on holidays, but got a spare moment to find these)"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/vmwgfx: Fix incorrect write to read-only register v2:
        drm/i915: Drop early VLV WA to fix Voltage not getting dropped to Vmin
        drm/i915: only apply crt_present check on VLV
        drm/i915: Wait for vblank after enabling the primary plane on BDW
        drm/i2c: tda998x: add some basic mode validation
        drm/i2c: tda998x: faster polling for edid
        drm/i2c: tda998x: move drm_i2c_encoder_destroy call
      110e4308
  5. 05 Jul, 2014 12 commits
  6. 04 Jul, 2014 1 commit