1. 15 Jan, 2010 1 commit
    • Dave Chinner's avatar
      xfs: reclaim all inodes by background tree walks · 57817c68
      Dave Chinner authored
      We cannot do direct inode reclaim without taking the flush lock to
      ensure that we do not reclaim an inode under IO. We check the inode
      is clean before doing direct reclaim, but this is not good enough
      because the inode flush code marks the inode clean once it has
      copied the in-core dirty state to the backing buffer.
      It is the flush lock that determines whether the inode is still
      under IO, even though it is marked clean, and the inode is still
      required at IO completion so we can't reclaim it even though it is
      clean in core. Hence the requirement that we need to take the flush
      lock even on clean inodes because this guarantees that the inode
      writeback IO has completed and it is safe to reclaim the inode.
      With delayed write inode flushing, we coul dend up waiting a long
      time on the flush lock even for a clean inode. The background
      reclaim already handles this efficiently, so avoid all the problems
      by killing the direct reclaim path altogether.
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
  2. 14 Dec, 2009 1 commit
    • Christoph Hellwig's avatar
      xfs: event tracing support · 0b1b213f
      Christoph Hellwig authored
      Convert the old xfs tracing support that could only be used with the
      out of tree kdb and xfsidbg patches to use the generic event tracer.
      To use it make sure CONFIG_EVENT_TRACING is enabled and then enable
      all xfs trace channels by:
         echo 1 > /sys/kernel/debug/tracing/events/xfs/enable
      or alternatively enable single events by just doing the same in one
      event subdirectory, e.g.
         echo 1 > /sys/kernel/debug/tracing/events/xfs/xfs_ihold/enable
      or set more complex filters, etc. In Documentation/trace/events.txt
      all this is desctribed in more detail.  To reads the events do a
         cat /sys/kernel/debug/tracing/trace
      Compared to the last posting this patch converts the tracing mostly to
      the one tracepoint per callsite model that other users of the new
      tracing facility also employ.  This allows a very fine-grained control
      of the tracing, a cleaner output of the traces and also enables the
      perf tool to use each tracepoint as a virtual performance counter,
           allowing us to e.g. count how often certain workloads git various
           spots in XFS.  Take a look at
      for some examples.
      Also the btree tracing isn't included at all yet, as it will require
      additional core tracing features not in mainline yet, I plan to
      deliver it later.
      And the really nice thing about this patch is that it actually removes
      many lines of code while adding this nice functionality:
       fs/xfs/Makefile                |    8
       fs/xfs/linux-2.6/xfs_acl.c     |    1
       fs/xfs/linux-2.6/xfs_aops.c    |   52 -
       fs/xfs/linux-2.6/xfs_aops.h    |    2
       fs/xfs/linux-2.6/xfs_buf.c     |  117 +--
       fs/xfs/linux-2.6/xfs_buf.h     |   33
       fs/xfs/linux-2.6/xfs_fs_subr.c |    3
       fs/xfs/linux-2.6/xfs_ioctl.c   |    1
       fs/xfs/linux-2.6/xfs_ioctl32.c |    1
       fs/xfs/linux-2.6/xfs_iops.c    |    1
       fs/xfs/linux-2.6/xfs_linux.h   |    1
       fs/xfs/linux-2.6/xfs_lrw.c     |   87 --
       fs/xfs/linux-2.6/xfs_lrw.h     |   45 -
       fs/xfs/linux-2.6/xfs_super.c   |  104 ---
       fs/xfs/linux-2.6/xfs_super.h   |    7
       fs/xfs/linux-2.6/xfs_sync.c    |    1
       fs/xfs/linux-2.6/xfs_trace.c   |   75 ++
       fs/xfs/linux-2.6/xfs_trace.h   | 1369 +++++++++++++++++++++++++++++++++++++++++
       fs/xfs/linux-2.6/xfs_vnode.h   |    4
       fs/xfs/quota/xfs_dquot.c       |  110 ---
       fs/xfs/quota/xfs_dquot.h       |   21
       fs/xfs/quota/xfs_qm.c          |   40 -
       fs/xfs/quota/xfs_qm_syscalls.c |    4
       fs/xfs/support/ktrace.c        |  323 ---------
       fs/xfs/support/ktrace.h        |   85 --
       fs/xfs/xfs.h                   |   16
       fs/xfs/xfs_ag.h                |   14
       fs/xfs/xfs_alloc.c             |  230 +-----
       fs/xfs/xfs_alloc.h             |   27
       fs/xfs/xfs_alloc_btree.c       |    1
       fs/xfs/xfs_attr.c              |  107 ---
       fs/xfs/xfs_attr.h              |   10
       fs/xfs/xfs_attr_leaf.c         |   14
       fs/xfs/xfs_attr_sf.h           |   40 -
       fs/xfs/xfs_bmap.c              |  507 +++------------
       fs/xfs/xfs_bmap.h              |   49 -
       fs/xfs/xfs_bmap_btree.c        |    6
       fs/xfs/xfs_btree.c             |    5
       fs/xfs/xfs_btree_trace.h       |   17
       fs/xfs/xfs_buf_item.c          |   87 --
       fs/xfs/xfs_buf_item.h          |   20
       fs/xfs/xfs_da_btree.c          |    3
       fs/xfs/xfs_da_btree.h          |    7
       fs/xfs/xfs_dfrag.c             |    2
       fs/xfs/xfs_dir2.c              |    8
       fs/xfs/xfs_dir2_block.c        |   20
       fs/xfs/xfs_dir2_leaf.c         |   21
       fs/xfs/xfs_dir2_node.c         |   27
       fs/xfs/xfs_dir2_sf.c           |   26
       fs/xfs/xfs_dir2_trace.c        |  216 ------
       fs/xfs/xfs_dir2_trace.h        |   72 --
       fs/xfs/xfs_filestream.c        |    8
       fs/xfs/xfs_fsops.c             |    2
       fs/xfs/xfs_iget.c              |  111 ---
       fs/xfs/xfs_inode.c             |   67 --
       fs/xfs/xfs_inode.h             |   76 --
       fs/xfs/xfs_inode_item.c        |    5
       fs/xfs/xfs_iomap.c             |   85 --
       fs/xfs/xfs_iomap.h             |    8
       fs/xfs/xfs_log.c               |  181 +----
       fs/xfs/xfs_log_priv.h          |   20
       fs/xfs/xfs_log_recover.c       |    1
       fs/xfs/xfs_mount.c             |    2
       fs/xfs/xfs_quota.h             |    8
       fs/xfs/xfs_rename.c            |    1
       fs/xfs/xfs_rtalloc.c           |    1
       fs/xfs/xfs_rw.c                |    3
       fs/xfs/xfs_trans.h             |   47 +
       fs/xfs/xfs_trans_buf.c         |   62 -
       fs/xfs/xfs_vnodeops.c          |    8
       70 files changed, 2151 insertions(+), 2592 deletions(-)
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
  3. 11 Dec, 2009 3 commits
    • Christoph Hellwig's avatar
      xfs: cleanup dmapi macros in the umount path · 30ac0683
      Christoph Hellwig authored
      Stop the flag saving as we never mangle those in the unmount path, and
      hide all the weird arguents to the dmapi code inside the
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
    • Christoph Hellwig's avatar
      xfs: reset the i_iolock lock class in the reclaim path · 033da48f
      Christoph Hellwig authored
      The iolock is used for protecting reads, writes and block truncates
      against each other.  We have two classes of callers, the first one is
      induced by a file operation and requires a reference to the inode be
      held and not dropped after the operation is done:
       - xfs_vm_vmap, xfs_vn_fallocate, xfs_read, xfs_write, xfs_splice_read,
         xfs_splice_write and xfs_setattr are all implementations of VFS
         methods that require a live inode
       - xfs_getbmap and xfs_swap_extents are ioctl subcommand for which the
         same is true
       - xfs_truncate_file is only called on quota inodes just returned from
       - xfs_sync_inode_data does the lock just after an igrab()
       - xfs_filestream_associate and xfs_filestream_new_ag take the iolock
         on the parent inode of an inode which by VFS rules must be referenced
      And we have various calls to truncate blocks past EOF or the whole
      file when dropping the last reference to an inode.  Unfortunately
      lockdep complains when we do memory allocations that can recurse into
      the filesystem in the first class because the second class happens to
      take the same lock.  To avoid this re-init the iolock in the beginning
      of xfs_fs_clear_inode to get a new lock class.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
    • Christoph Hellwig's avatar
      xfs: simplify inode teardown · 848ce8f7
      Christoph Hellwig authored
      Currently the reclaim code for the case where we don't reclaim the
      final reclaim is overly complicated.  We know that the inode is clean
      but instead of just directly reclaiming the clean inode we go through
      the whole process of marking the inode reclaimable just to directly
      reclaim it from the calling context.  Besides being overly complicated
      this introduces a race where iget could recycle an inode between
      marked reclaimable and actually being reclaimed leading to panics.
      This patch gets rid of the existing reclaim path, and replaces it with
      a simple call to xfs_ireclaim if the inode was clean.  While we're at
      it we also use the slightly more lax xfs_inode_clean check we'd use
      later to determine if we need to flush the inode here.
      Finally get rid of xfs_reclaim function and place the remaining small
      bits of reclaim code directly into xfs_fs_destroy_inode.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reported-by: default avatarPatrick Schreurs <patrick@news-service.com>
      Reported-by: default avatarTommy van Leeuwen <tommy@news-service.com>
      Tested-by: default avatarPatrick Schreurs <patrick@news-service.com>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
  4. 08 Oct, 2009 2 commits
    • Christoph Hellwig's avatar
      xfs: cleanup ->sync_fs · 69961a26
      Christoph Hellwig authored
      Sort out ->sync_fs to not perform a superblock writeback for the wait = 0 case
      as that is just an optional first pass and the superblock will be written back
      properly in the next call with wait = 1.  Instead perform an opportunistic
      quota writeback to have less work later.  Also remove the freeze special case
      as we do a proper wait = 1 call in the freeze code anyway.
      Also rename the function to xfs_fs_sync_fs to match the normal naming
      convention, update comments and avoid calling into the laptop_mode logic on
      an error.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
    • Christoph Hellwig's avatar
      xfs: implement ->dirty_inode to fix timestamp handling · f9581b14
      Christoph Hellwig authored
      This is picking up on Felix's repost of Dave's patch to implement a
      .dirty_inode method.  We really need this notification because
      the VFS keeps writing directly into the inode structure instead
      of going through methods to update this state.  In addition to
      the long-known atime issue we now also have a caller in VM code
      that updates c/mtime that way for shared writeable mmaps.  And
      I found another one that no one has noticed in practice in the FIFO
      So implement ->dirty_inode to set i_update_core whenever the
      inode gets externally dirtied, and switch the c/mtime handling to
      the same scheme we already use for atime (always picking up
      the value from the Linux inode).
      Note that this patch also removes the xfs_synchronize_atime call
      in xfs_reclaim it was superflous as we already synchronize the time
      when writing the inode via the log (xfs_inode_item_format) or the
      normal buffers (xfs_iflush_int).
      In addition also remove the I_CLEAR check before copying the Linux
      timestamps - now that we always have the Linux inode available
      we can always use the timestamps in it.
      Also switch to just using file_update_time for regular reads/writes -
      that will get us all optimization done to it for free and make
      sure we notice early when it breaks.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarFelix Blyakher <felixb@sgi.com>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
  5. 22 Sep, 2009 1 commit
  6. 02 Sep, 2009 1 commit
    • Alex Elder's avatar
      xfs: xfs_showargs() reports group *and* project quotas enabled · 988abe40
      Alex Elder authored
      If you enable group or project quotas on an XFS file system, then the
      mount table presented through /proc/self/mounts erroneously shows
      that both options are in effect for the file system.  The root of
      the problem is some bad logic in the xfs_showargs() function, which
      is used to format the file system type-specific options in effect
      for a file system.
      The problem originated in this GIT commit:
          Move platform specific mount option parse out of core XFS code
          Date: 11/22/07
          Author: Dave Chinner
          SHA1 ID: a67d7c5f
      For XFS quotas, project and group quota management are mutually
      exclusive--only one can be in effect at a time.  There are two
      parts to managing quotas:  aggregating usage information; and
      enforcing limits.  It is possible to have a quota in effect
      (aggregating usage) but not enforced.
      These features are recorded on an XFS mount point using these flags:
          XFS_PQUOTA_ACCT - Project quotas are aggregated
          XFS_GQUOTA_ACCT - Group quotas are aggregated
          XFS_OQUOTA_ENFD - Project/group quotas are enforced
      The code in error is in fs/xfs/linux-2.6/xfs_super.c:
              if (mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
                      seq_puts(m, "," MNTOPT_PRJQUOTA);
              else if (mp->m_qflags & XFS_PQUOTA_ACCT)
                      seq_puts(m, "," MNTOPT_PQUOTANOENF);
              if (mp->m_qflags & (XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD))
                      seq_puts(m, "," MNTOPT_GRPQUOTA);
              else if (mp->m_qflags & XFS_GQUOTA_ACCT)
                      seq_puts(m, "," MNTOPT_GQUOTANOENF);
      The problem is that XFS_OQUOTA_ENFD will be set in mp->m_qflags
      if either group or project quotas are enforced, and as a result
      both MNTOPT_PRJQUOTA and MNTOPT_GRPQUOTA will be shown as mount
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarFelix Blyakher <felixb@sgi.com>
  7. 31 Aug, 2009 1 commit
  8. 01 Jul, 2009 1 commit
  9. 19 Jun, 2009 1 commit
  10. 11 Jun, 2009 1 commit
  11. 10 Jun, 2009 1 commit
  12. 08 Jun, 2009 2 commits
    • Christoph Hellwig's avatar
      xfs: split xfs_sync_inodes · 075fe102
      Christoph Hellwig authored
      xfs_sync_inodes is used to write back either file data or inode metadata.
      In general we always do these separately, except for one fishy case in
      xfs_fs_put_super that does both.  So separate xfs_sync_inodes into
      separate xfs_sync_data and xfs_sync_attr functions.  In xfs_fs_put_super
      we first call the data sync and then the attr sync as that was the previous
      order.  The moved log force in that path doesn't make a difference because
      we will force the log again as part of the real unmount process.
      The filesystem readonly checks are not performed by the new function but
      instead moved into the callers, given that most callers alredy have it
      further up in the stack.  Also add debug checks that we do not pass in
      incorrect flags in the new xfs_sync_data and xfs_sync_attr function and
      fix the one place that did pass in a wrong flag.
      Also remove a comment mentioning xfs_sync_inodes that has been incorrect
      for a while because we always take either the iolock or ilock in the
      sync path these days.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarEric Sandeen <sandeen@sandeen.net>
    • Christoph Hellwig's avatar
      xfs: kill xfs_qmops · 7d095257
      Christoph Hellwig authored
      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
      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
      Eventually we should also kill xfs_qm_bhv.c, but that's left for a later
      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
       - 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: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarEric Sandeen <sandeen@sandeen.net>
  13. 29 Mar, 2009 1 commit
  14. 06 Mar, 2009 2 commits
  15. 04 Mar, 2009 1 commit
  16. 09 Feb, 2009 2 commits
  17. 04 Feb, 2009 1 commit
  18. 18 Jan, 2009 2 commits
  19. 09 Jan, 2009 1 commit
    • Takashi Sato's avatar
      filesystem freeze: add error handling of write_super_lockfs/unlockfs · c4be0c1d
      Takashi Sato authored
      Currently, ext3 in mainline Linux doesn't have the freeze feature which
      suspends write requests.  So, we cannot take a backup which keeps the
      filesystem's consistency with the storage device's features (snapshot and
      replication) while it is mounted.
      In many case, a commercial filesystem (e.g.  VxFS) has the freeze feature
      and it would be used to get the consistent backup.
      If Linux's standard filesystem ext3 has the freeze feature, we can do it
      without a commercial filesystem.
      So I have implemented the ioctls of the freeze feature.
      I think we can take the consistent backup with the following steps.
      1. Freeze the filesystem with the freeze ioctl.
      2. Separate the replication volume or create the snapshot
         with the storage device's feature.
      3. Unfreeze the filesystem with the unfreeze ioctl.
      4. Take the backup from the separated replication volume
         or the snapshot.
      This patch:
      Changed the type of write_super_lockfs and unlockfs from "void"
      to "int" so that they can return an error.
      Rename write_super_lockfs and unlockfs of the super block operation
      freeze_fs and unfreeze_fs to avoid a confusion.
      ext3, ext4, xfs, gfs2, jfs:
      Changed the type of write_super_lockfs and unlockfs from "void"
      to "int" so that write_super_lockfs returns an error if needed,
      and unlockfs always returns 0.
      Changed the type of write_super_lockfs and unlockfs from "void"
      to "int" so that they always return 0 (success) to keep a current behavior.
      Signed-off-by: default avatarTakashi Sato <t-sato@yk.jp.nec.com>
      Signed-off-by: default avatarMasayuki Hamaguchi <m-hamaguchi@ys.jp.nec.com>
      Cc: <xfs-masters@oss.sgi.com>
      Cc: <linux-ext4@vger.kernel.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dave Kleikamp <shaggy@austin.ibm.com>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Alasdair G Kergon <agk@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  20. 06 Jan, 2009 1 commit
  21. 03 Dec, 2008 4 commits
  22. 30 Nov, 2008 3 commits
  23. 30 Oct, 2008 6 commits