1. 01 Sep, 2009 9 commits
    • Christoph Hellwig's avatar
      xfs: simplify xfs_trans_iget · aa72a5cf
      Christoph Hellwig authored
      xfs_trans_iget is a wrapper for xfs_iget that adds the inode to the
      transaction after it is read.  Except when the inode already is in the
      inode cache, in which case it returns the existing locked inode with
      increment lock recursion counts.
      
      Now, no one in the tree every decrements these lock recursion counts,
      so any user of this gets a potential double unlock when both the original
      owner of the inode and the xfs_trans_iget caller unlock it.  When looking
      back in a git bisect in the historic XFS tree there was only one place
      that decremented these counts, xfs_trans_iput.  Introduced in commit
      ca25df7a840f426eb566d52667b6950b92bb84b5 by Adam Sweeney in 1993,
      and removed in commit 19f899a3ab155ff6a49c0c79b06f2f61059afaf3 by
      Steve Lord in 2003.  And as long as it didn't slip through git bisects
      cracks never actually used in that time frame.
      
      A quick audit of the callers of xfs_trans_iget shows that no caller
      really relies on this behaviour fortunately - xfs_ialloc allows this
      inode from disk so it must not be there before, and all the RT allocator
      routines only every add each RT bitmap inode once.
      
      In addition to removing lots of code and reducing the size of the inode
      item this patch also avoids the double inode cache lookup in each
      create/mkdir/mknod transaction.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      aa72a5cf
    • Christoph Hellwig's avatar
      xfs: merge fsync and O_SYNC handling · 13e6d5cd
      Christoph Hellwig authored
      The guarantees for O_SYNC are exactly the same as the ones we need to
      make for an fsync call (and given that Linux O_SYNC is O_DSYNC the
      equivalent is fdadatasync, but we treat both the same in XFS), except
      with a range data writeout.  Jan Kara has started unifying these two
      path for filesystems using the generic helpers, and I've started to
      look at XFS.
      
      The actual transaction commited by xfs_fsync and xfs_write_sync_logforce
      has a different transaction number, but actually is exactly the same.
      We'll only use the fsync transaction going forward.  One major difference
      is that xfs_write_sync_logforce never issues a cache flush unless we
      commit a transaction causing that as a side-effect, which is an obvious
      bug in the O_SYNC handling.  Second all the locking and i_update_size
      vs i_update_core changes from 978b7237
      never made it to xfs_write_sync_logforce, so we add them back.
      
      To make xfs_fsync easily usable from the O_SYNC path, the filemap_fdatawait
      call is moved up to xfs_file_fsync, so that we don't wait on the whole
      file after we already waited for our portion in xfs_write.
      
      We'll also use a plain call to filemap_write_and_wait_range instead
      of the previous sync_page_rang which did it in two steps including
      an half-hearted inode write out that doesn't help us.
      
      Once we're done with this also remove the now useless i_update_size
      tracking.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarFelix Blyakher <felixb@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      13e6d5cd
    • Dave Chinner's avatar
      xfs: speed up free inode search · bd169565
      Dave Chinner authored
      Don't search too far - abort if it is outside a certain radius and simply do
      a linear search for the first free inode.  In AGs with a million inodes this
      can speed up allocation speed by 3-4x.
      
      [hch: ported to the new xfs_ialloc.c world order]
      Signed-off-by: default avatarDave Chinner <dgc@sgi.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      bd169565
    • Christoph Hellwig's avatar
      xfs: rationalize xfs_inobt_lookup* · 21875505
      Christoph Hellwig authored
      Currenly we have a xfs_inobt_lookup* variant for each comparism direction,
      and all these get all three fields of the inobt records passed, while the
      common case is just looking for the inode number and we have only marginally
      more callers than xfs_inobt_lookup* variants.
      
      So opencode a direct call to xfs_btree_lookup for the single case where we
      need all fields, and replace xfs_inobt_lookup* with a xfs_inobt_looku that
      just takes the inode number and the direction for all other callers.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      21875505
    • Christoph Hellwig's avatar
      xfs: untangle xfs_dialloc · 4254b0bb
      Christoph Hellwig authored
      Clarify the control flow in xfs_dialloc.  Factor out a helper to go to the
      next node from the current one and improve the control flow by expanding
      composite if statements and using gotos.
      
      The xfs_ialloc_next_rec helper is borrowed from Dave Chinners dynamic
      allocation policy patches.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      4254b0bb
    • Dave Chinner's avatar
      xfs: factor out debug checks from xfs_dialloc and xfs_difree · 0b48db80
      Dave Chinner authored
      Factor out a common helper from repeated debug checks in xfs_dialloc and
      xfs_difree.
      
      [hch: split out from Dave's dynamic allocation policy patches]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      0b48db80
    • Christoph Hellwig's avatar
      xfs: improve xfs_inobt_update prototype · afabc24a
      Christoph Hellwig authored
      Both callers of xfs_inobt_update have the record in form of a
      xfs_inobt_rec_incore_t, so just pass a pointer to it instead of the
      individual variables.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      afabc24a
    • Christoph Hellwig's avatar
      xfs: improve xfs_inobt_get_rec prototype · 2e287a73
      Christoph Hellwig authored
      Most callers of xfs_inobt_get_rec need to fill a xfs_inobt_rec_incore_t, and
      those who don't yet are fine with a xfs_inobt_rec_incore_t, instead of the
      three individual variables, too.  So just change xfs_inobt_get_rec to write
      the output into a xfs_inobt_rec_incore_t directly.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      2e287a73
    • Dave Chinner's avatar
      xfs: factor out inode initialisation · 85c0b2ab
      Dave Chinner authored
      Factor out code to initialize new inode clusters into a function of it's own.
      This keeps xfs_ialloc_ag_alloc smaller and better structured and enables a
      future inode cluster initialization transaction.  Also initialize the agno
      variable earlier in xfs_ialloc_ag_alloc to avoid repeated byte swaps.
      
      [hch:  The original patch is from Dave from his unpublished inode create
       transaction patch series, with some modifcations by me to apply stand-alone]
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      85c0b2ab
  2. 31 Aug, 2009 5 commits
  3. 18 Aug, 2009 1 commit
    • Christoph Hellwig's avatar
      xfs: fix locking in xfs_iget_cache_hit · a022fe09
      Christoph Hellwig authored
      The locking in xfs_iget_cache_hit currently has numerous problems:
      
       - we clear the reclaim tag without i_flags_lock which protects
         modifications to it
       - we call inode_init_always which can sleep with pag_ici_lock
         held (this is oss.sgi.com BZ #819)
       - we acquire and drop i_flags_lock a lot and thus provide no
         consistency between the various flags we set/clear under it
      
      This patch fixes all that with a major revamp of the locking in
      the function.  The new version acquires i_flags_lock early and
      only drops it once we need to call into inode_init_always or before
      calling xfs_ilock.
      
      This patch fixes a bug seen in the wild where we race modifying the
      reclaim tag.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarFelix Blyakher <felixb@sgi.com>
      Reviewed-by: default avatarEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      a022fe09
  4. 17 Aug, 2009 1 commit
    • Christoph Hellwig's avatar
      xfs: fix locking in xfs_iget_cache_hit · bc990f5c
      Christoph Hellwig authored
      The locking in xfs_iget_cache_hit currently has numerous problems:
      
       - we clear the reclaim tag without i_flags_lock which protects
         modifications to it
       - we call inode_init_always which can sleep with pag_ici_lock
         held (this is oss.sgi.com BZ #819)
       - we acquire and drop i_flags_lock a lot and thus provide no
         consistency between the various flags we set/clear under it
      
      This patch fixes all that with a major revamp of the locking in
      the function.  The new version acquires i_flags_lock early and
      only drops it once we need to call into inode_init_always or before
      calling xfs_ilock.
      
      This patch fixes a bug seen in the wild where we race modifying the
      reclaim tag.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarFelix Blyakher <felixb@sgi.com>
      Reviewed-by: default avatarEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: default avatarFelix Blyakher <felixb@sgi.com>
      bc990f5c
  5. 16 Aug, 2009 2 commits
  6. 14 Aug, 2009 3 commits
    • Linus Torvalds's avatar
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 · 3011c7f0
      Linus Torvalds authored
      * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (38 commits)
        V4L/DVB (12441): siano: read buffer overflow
        V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly
        V4L/DVB (12438): Read buffer overflow
        V4L/DVB (12437): dvb: siano uses/depends on INPUT
        V4L/DVB (12436): stk-webcam: read buffer overflow
        V4L/DVB (12432): em28xx: fix regression in Empire DualTV digital tuning
        V4L/DVB (12429): v4l2-ioctl: fix G_STD and G_PARM default handlers
        V4L/DVB (12428): hdpvr: add missing initialization of current_norm
        V4L/DVB (12424): soc-camera: fix recursive locking in .buf_queue()
        V4L/DVB (12422): media/zr364xx: fix build errors
        V4L/DVB (12405): em28xx-cards: move register 0x13 setting to the proper place
        V4L/DVB (12411): em28xx: Fix artifacts with Silvercrest webcam
        V4L/DVB (12410): em28xx: Move the non-board dependent part to be outside em28xx_pre_card_setup()
        V4L/DVB (12407): em28xx: Adjust Silvercrest xtal frequency
        V4L/DVB (12406): em28xx: fix: don't do image interlacing on webcams
        V4L/DVB (12403): em28xx: properly reports some em2710 chips
        V4L/DVB (12402): em28xx: fix: some em2710 chips use a different vendor ID
        V4L/DVB (12401): m9v011: add vflip/hflip controls to control mirror/upside down
        V4L/DVB (12400): em28xx: Allow changing fps on webcams
        V4L/DVB (12399): mt9v011: Add support for controlling frame rates
        ...
      3011c7f0
    • Steven Whitehouse's avatar
      GFS2: Fix permissions on "recover" file · d7e623da
      Steven Whitehouse authored
      Although this file is only ever written and not read by
      userspace, it seems that the utils are opening this
      file O_RDWR, so we need to allow that.
      
      Also fixes the whitespace which seemed to be broken.
      Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
      Cc: David Teigland <teigland@redhat.com>
      d7e623da
  7. 13 Aug, 2009 19 commits