1. 08 6月, 2009 3 次提交
    • C
      xfs: kill xfs_qmops · 7d095257
      Christoph Hellwig 提交于
      Kill the quota ops function vector and replace it with direct calls or
      stubs in the CONFIG_XFS_QUOTA=n case.
      
      Make sure we check XFS_IS_QUOTA_RUNNING in the right spots.  We can remove
      the number of those checks because the XFS_TRANS_DQ_DIRTY flag can't be set
      otherwise.
      
      This brings us back closer to the way this code worked in IRIX and earlier
      Linux versions, but we keep a lot of the more useful factoring of common
      code.
      
      Eventually we should also kill xfs_qm_bhv.c, but that's left for a later
      patch.
      
      Reduces the size of the source code by about 250 lines and the size of
      XFS module by about 1.5 kilobytes with quotas enabled:
      
         text	   data	    bss	    dec	    hex	filename
       615957	   2960	   3848	 622765	  980ad	fs/xfs/xfs.o
       617231	   3152	   3848	 624231	  98667	fs/xfs/xfs.o.old
      
      Fallout:
      
       - xfs_qm_dqattach is split into xfs_qm_dqattach_locked which expects
         the inode locked and xfs_qm_dqattach which does the locking around it,
         thus removing XFS_QMOPT_ILOCKED.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NEric Sandeen <sandeen@sandeen.net>
      7d095257
    • C
      xfs: validate quota log items during log recovery · 0c5e1ce8
      Christoph Hellwig 提交于
      Arkadiusz has seen really strange crashes in xfs_qm_dqcheck that
      I can only explain by a log item being too smal to actually fit the
      xfs_dqblk_t we're dereferencing all over xfs_qm_dqcheck.  So add
      graceful checks for NULL or too small quota items to the log recovery
      code.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NEric Sandeen <sandeen@sandeen.net>
      0c5e1ce8
    • C
      xfs: update max log size · e1696834
      Christoph Hellwig 提交于
      Commit a6634fba3dec4a92f0a2c4e30c80b634c0576ad5 in xfsprogs increased the
      maximum log size supported by mkfs.  Merged back the changes to xfs_fs.h
      so the growfs enforced the same limit and the headers are in sync.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NEric Sandeen <sandeen@sandeen.net>
      e1696834
  2. 02 6月, 2009 1 次提交
  3. 27 5月, 2009 1 次提交
    • E
      xfs: fix overflow in xfs_growfs_data_private · 09632487
      Eric Sandeen 提交于
      In the case where growing a filesystem would leave the last AG
      too small, the fixup code has an overflow in the calculation
      of the new size with one fewer ag, because "nagcount" is a 32
      bit number.  If the new filesystem has > 2^32 blocks in it
      this causes a problem resulting in an EINVAL return from growfs:
      
       # xfs_io -f -c "truncate 19998630180864" fsfile
       # mkfs.xfs -f -bsize=4096 -dagsize=76288719b,size=3905982455b fsfile
       # mount -o loop fsfile /mnt
       # xfs_growfs /mnt
      
      meta-data=/dev/loop0             isize=256    agcount=52,
      agsize=76288719 blks
               =                       sectsz=512   attr=2
      data     =                       bsize=4096   blocks=3905982455, imaxpct=5
               =                       sunit=0      swidth=0 blks
      naming   =version 2              bsize=4096   ascii-ci=0
      log      =internal               bsize=4096   blocks=32768, version=2
               =                       sectsz=512   sunit=0 blks, lazy-count=0
      realtime =none                   extsz=4096   blocks=0, rtextents=0
      xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Invalid argument
      
      Reported-by: richard.ems@cape-horn-eng.com
      Signed-off-by: NEric Sandeen <sandeen@sandeen.net>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NFelix Blyakher <felixb@sgi.com>
      Signed-off-by: NFelix Blyakher <felixb@sgi.com>
      09632487
  4. 08 5月, 2009 1 次提交
  5. 30 4月, 2009 1 次提交
  6. 29 4月, 2009 3 次提交
  7. 07 4月, 2009 9 次提交
    • D
      xfs: remove xfs_flush_space · 8de2bf93
      Dave Chinner 提交于
      The only thing we need to do now when we get an ENOSPC condition during delayed
      allocation reservation is flush all the other inodes with delalloc blocks on
      them and retry without EOF preallocation. Remove the unneeded mess that is
      xfs_flush_space() and just call xfs_flush_inodes() directly from
      xfs_iomap_write_delay().
      
      Also, change the location of the retry label to avoid trying to do EOF
      preallocation because we don't want to do that at ENOSPC. This enables us to
      remove the BMAPI_SYNC flag as it is no longer used.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      8de2bf93
    • D
      xfs: flush delayed allcoation blocks on ENOSPC in create · 153fec43
      Dave Chinner 提交于
      If we are creating lots of small files, we can fail to get
      a reservation for inode create earlier than we should due to
      EOF preallocation done during delayed allocation reservation.
      Hence on the first reservation ENOSPC failure flush all the
      delayed allocation blocks out of the system and retry.
      
      This fixes the last commonly triggered spurious ENOSPC issue
      that has been reported.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      153fec43
    • D
      xfs: block callers of xfs_flush_inodes() correctly · e43afd72
      Dave Chinner 提交于
      xfs_flush_inodes() currently uses a magic timeout to wait for
      some inodes to be flushed before returning. This isn't
      really reliable but used to be the best that could be done
      due to deadlock potential of waiting for the entire flush.
      
      Now the inode flush is safe to execute while we hold page
      and inode locks, we can wait for all the inodes to flush
      synchronously. Convert the wait mechanism to a completion
      to do this efficiently. This should remove all remaining
      spurious ENOSPC errors from the delayed allocation reservation
      path.
      
      This is extracted almost line for line from a larger patch
      from Mikulas Patocka.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      e43afd72
    • D
      xfs: make inode flush at ENOSPC synchronous · 5825294e
      Dave Chinner 提交于
      When we are writing to a single file and hit ENOSPC, we trigger a background
      flush of the inode and try again.  Because we hold page locks and the iolock,
      the flush won't proceed until after we release these locks. This occurs once
      we've given up and ENOSPC has been reported. Hence if this one is the only
      dirty inode in the system, we'll get an ENOSPC prematurely.
      
      To fix this, remove the async flush from the allocation routines and move
      it to the top of the write path where we can do a synchronous flush
      and retry the write again. Only retry once as a second ENOSPC indicates
      that we really are ENOSPC.
      
      This avoids a page cache deadlock when trying to do this flush synchronously
      in the allocation layer that was identified by Mikulas Patocka.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      5825294e
    • D
      xfs: use xfs_sync_inodes() for device flushing · a8d770d9
      Dave Chinner 提交于
      Currently xfs_device_flush calls sync_blockdev() which is
      a no-op for XFS as all it's metadata is held in a different
      address to the one sync_blockdev() works on.
      
      Call xfs_sync_inodes() instead to flush all the delayed
      allocation blocks out. To do this as efficiently as possible,
      do it via two passes - one to do an async flush of all the
      dirty blocks and a second to wait for all the IO to complete.
      This requires some modification to the xfs-sync_inodes_ag()
      flush code to do efficiently.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      a8d770d9
    • D
      xfs: inform the xfsaild of the push target before sleeping · 9d7fef74
      Dave Chinner 提交于
      When trying to reserve log space, we find the amount of space
      we need, then go to sleep waiting for space. When we are
      woken, we try to push the tail of the log forward to make
      sure we have space available.
      
      Unfortunately, this means that if there is not space available, and
      everyone who needs space goes to sleep there is no-one left to push
      the tail of the log to make space available. Once we have a thread
      waiting for space to become available, the others queue up behind
      it in a FIFO, and none of them push the tail of the log.
      
      This can result in everyone going to sleep in xlog_grant_log_space()
      if the first sleeper races with the last I/O that moves the tail
      of the log forward. With no further I/O tomove the tail of the log,
      there is nothing to wake the sleepers and hence all transactions
      just stop.
      
      Fix this by making sure the xfsaild will create enough space for the
      transaction that is about to sleep by moving the push target far
      enough forwards to ensure that that the curent proceeees will have
      enough space available when it is woken. That is, we push the
      AIL before we go to sleep.
      
      Because we've inserted the log ticket into the queue before we've
      pushed and gone to sleep, subsequent transactions will wait behind
      this one. Hence we are guaranteed to have space available when we
      are woken.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      9d7fef74
    • D
      xfs: prevent unwritten extent conversion from blocking I/O completion · c626d174
      Dave Chinner 提交于
      Unwritten extent conversion can recurse back into the filesystem due
      to memory allocation. Memory reclaim requires I/O completions to be
      processed to allow the callers to make progress. If the I/O
      completion workqueue thread is doing the recursion, then we have a
      deadlock situation.
      
      Move unwritten extent completion into it's own workqueue so it
      doesn't block I/O completions for normal delayed allocation or
      overwrite data.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      c626d174
    • D
      xfs: fix double free of inode · 705db3fd
      Dave Chinner 提交于
      If we fail to initialise the VFS inode in inode_init_always(),
      it will call ->delete_inode internally resulting in the inode being
      freed. Hence we need to delay the call to inode_init_always()
      until after the XFS inode is sufficient set up to handle a
      call to ->delete_inode, and then if that fails do not touch
      the inode again at all as it has been freed.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      705db3fd
    • D
      xfs: validate log feature fields correctly · a6cb767e
      Dave Chinner 提交于
      If the large log sector size feature bit is set in the
      superblock by accident (say disk corruption), the then
      fields that are now considered valid are not checked on
      production kernels. The checks are present as ASSERT
      statements so cause a panic on a debug kernel.
      
      Change this so that the fields are validity checked if
      the feature bit is set and abort the log mount if the
      fields do not contain valid values.
      Reported-by: NEric Sesterhenn <snakebyte@gmx.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      a6cb767e
  8. 31 3月, 2009 21 次提交