25 Mar, 2015

1 commit

  • xfs_mru_cache_insert() can be called from within transaction context
    during block allocation like so:

    write(2)
    ....
    xfs_get_blocks
    xfs_iomap_write_direct
    start transaction
    xfs_bmapi_write
    xfs_bmapi_allocate
    xfs_bmap_btalloc
    xfs_bmap_btalloc_filestreams
    xfs_filestream_new_ag
    xfs_filestream_pick_ag
    xfs_mru_cache_insert
    radix_tree_preload(GFP_KERNEL)

    In this case, GFP_KERNEL is incorrect and can potentially lead to
    deadlocks in memory reclaim. It should use GFP_NOFS allocations to
    avoid lock recursion problems.

    [dchinner: rewrote commit message]

    Signed-off-by: Byoungyoung Lee
    Signed-off-by: Sanidhya Kashyap
    Reviewed-by: Dave Chinner
    Signed-off-by: Dave Chinner

    Byoungyoung Lee
     

09 Sep, 2014

1 commit

  • Workqueues must be explicitly set as freezable to ensure they are frozen
    in the assocated part of the hibernation/suspend sequence. Freezing of
    workqueues and kernel threads is important to ensure that modifications
    are not made on-disk after the hibernation image has been created.
    Otherwise, the in-memory state can become inconsistent with what is on
    disk and eventually lead to filesystem corruption. We have reports of
    free space btree corruptions that occur immediately after restore from
    hibernate that suggest the xfs-eofblocks workqueue could be causing
    such problems if it races with hibernation.

    Mark all of the internal XFS workqueues as freezable to ensure nothing
    changes on-disk once the freezer infrastructure freezes kernel threads
    and creates the hibernation image.

    Signed-off-by: Brian Foster
    Reported-by: Carlos E. R.
    Reviewed-by: Dave Chinner
    Signed-off-by: Dave Chinner

    Brian Foster
     

25 Jun, 2014

1 commit

  • Convert all the errors the core XFs code to negative error signs
    like the rest of the kernel and remove all the sign conversion we
    do in the interface layers.

    Errors for conversion (and comparison) found via searches like:

    $ git grep " E" fs/xfs
    $ git grep "return E" fs/xfs
    $ git grep " E[A-Z].*;$" fs/xfs

    Negation points found via searches like:

    $ git grep "= -[a-z,A-Z]" fs/xfs
    $ git grep "return -[a-z,A-D,F-Z]" fs/xfs
    $ git grep " -[a-z].*;" fs/xfs

    [ with some bits I missed from Brian Foster ]

    Signed-off-by: Dave Chinner
    Reviewed-by: Brian Foster
    Signed-off-by: Dave Chinner

    Dave Chinner
     

23 Apr, 2014

2 commits

  • There is no need to do a separate allocation for each mru element, just
    embedd the structure into the parent one in the user. Besides saving
    a memory allocation and the infrastructure required for it this also
    simplifies the API.

    While we do major surgery on xfs_mru_cache.c also de-typedef it and
    make struct mru_cache private to the implementation file.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Dave Chinner

    Christoph Hellwig
     
  • The radix tree code can detect and reject duplicate keys at insert
    time. Make xfs_mru_cache_insert handle this case so that future
    changes to the filestream allocator can take advantage of this.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Signed-off-by: Dave Chinner

    Christoph Hellwig
     

01 Feb, 2011

1 commit

  • Convert from create[_singlethread]_workqueue() to alloc_workqueue().

    * xfsdatad_workqueue and xfsconvertd_workqueue are identity converted.
    Using higher concurrency limit might be useful but given the
    complexity of workqueue usage in xfs, proceeding cautiously seems
    better.

    * xfs_mru_reap_wq is converted to non-ordered workqueue with max
    concurrency of 1 as the work items don't require any specific
    ordering and already have proper synchronization. It seems it was
    singlethreaded to save worker threads, which is no longer a concern.

    Signed-off-by: Tejun Heo
    Cc: Alex Elder
    Cc: xfs-masters@oss.sgi.com
    Cc: Christoph Hellwig

    Tejun Heo
     

15 Dec, 2010

1 commit

  • cancel_rearming_delayed_work[queue]() has been superceded by
    cancel_delayed_work_sync() quite some time ago. Convert all the
    in-kernel users. The conversions are completely equivalent and
    trivial.

    Signed-off-by: Tejun Heo
    Acked-by: "David S. Miller"
    Acked-by: Greg Kroah-Hartman
    Acked-by: Evgeniy Polyakov
    Cc: Jeff Garzik
    Cc: Benjamin Herrenschmidt
    Cc: Mauro Carvalho Chehab
    Cc: netdev@vger.kernel.org
    Cc: Anton Vorontsov
    Cc: David Woodhouse
    Cc: "J. Bruce Fields"
    Cc: Neil Brown
    Cc: Alex Elder
    Cc: xfs-masters@oss.sgi.com
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: Andrew Morton
    Cc: netfilter-devel@vger.kernel.org
    Cc: Trond Myklebust
    Cc: linux-nfs@vger.kernel.org

    Tejun Heo
     

16 Jan, 2010

1 commit

  • The filestreams cache flush is not needed in the sync code as it
    does not affect data writeback, and it is now not used by the growfs
    code, either, so kill it.

    Signed-off-by: Dave Chinner
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Alex Elder

    Dave Chinner
     

01 Sep, 2009

1 commit


28 Jul, 2008

2 commits

  • Currently the xfs module init/exit code is a mess. It's farmed out over a
    lot of function with very little error checking. This patch makes sure we
    propagate all initialization failures properly and clean up after them.
    Various runtime initializations are replaced with compile-time
    initializations where possible to make this easier. The exit path is
    similarly consolidated.

    There's now split out function to create/destroy the kmem zones and
    alloc/free the trace buffers. I've also changed the ktrace allocations to
    KM_MAYFAIL and handled errors resulting from that.

    And yes, we really should replace the XFS_*_TRACE ifdefs with a single
    XFS_TRACE..

    SGI-PV: 976035

    SGI-Modid: xfs-linux-melb:xfs-kern:31354a

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Niv Sardi
    Signed-off-by: Lachlan McIlroy

    Christoph Hellwig
     
  • kmem_free() function takes (ptr, size) arguments but doesn't actually use
    second one.

    This patch removes size argument from all callsites.

    SGI-PV: 981498
    SGI-Modid: xfs-linux-melb:xfs-kern:31050a

    Signed-off-by: Denys Vlasenko
    Signed-off-by: David Chinner
    Signed-off-by: Lachlan McIlroy

    Denys Vlasenko
     

07 Feb, 2008

3 commits

  • These are mostly locking annotations, marking things static, casts where
    needed and declaring stuff in header files.

    SGI-PV: 971186
    SGI-Modid: xfs-linux-melb:xfs-kern:30002a

    Signed-off-by: David Chinner
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Lachlan McIlroy

    David Chinner
     
  • remove spinlock init abstraction macro in spin.h, remove the callers, and
    remove the file. Move no-op spinlock_destroy to xfs_linux.h Cleanup
    spinlock locals in xfs_mount.c

    SGI-PV: 970382
    SGI-Modid: xfs-linux-melb:xfs-kern:29751a

    Signed-off-by: Eric Sandeen
    Signed-off-by: Donald Douwsma
    Signed-off-by: Lachlan McIlroy
    Signed-off-by: Tim Shimmin

    Eric Sandeen
     
  • Un-obfuscate mru_lock, remove mutex_lock->spin_lock macros, call spin_lock
    directly, remove extraneous cookie holdover from old xfs code.

    SGI-PV: 970382
    SGI-Modid: xfs-linux-melb:xfs-kern:29745a

    Signed-off-by: Eric Sandeen
    Signed-off-by: Donald Douwsma
    Signed-off-by: Tim Shimmin

    Eric Sandeen
     

17 Sep, 2007

1 commit

  • Instead of running the mru cache reaper all the time based on a timeout,
    we should only run it when the cache has active objects. This allows CPUs
    to sleep when there is no activity rather than be woken repeatedly just to
    check if there is anything to do.

    SGI-PV: 968554
    SGI-Modid: xfs-linux-melb:xfs-kern:29305a

    Signed-off-by: David Chinner
    Signed-off-by: Donald Douwsma
    Signed-off-by: Tim Shimmin

    David Chinner
     

14 Jul, 2007

1 commit

  • In media spaces, video is often stored in a frame-per-file format. When
    dealing with uncompressed realtime HD video streams in this format, it is
    crucial that files do not get fragmented and that multiple files a placed
    contiguously on disk.

    When multiple streams are being ingested and played out at the same time,
    it is critical that the filesystem does not cross the streams and
    interleave them together as this creates seek and readahead cache miss
    latency and prevents both ingest and playout from meeting frame rate
    targets.

    This patch set creates a "stream of files" concept into the allocator to
    place all the data from a single stream contiguously on disk so that RAID
    array readahead can be used effectively. Each additional stream gets
    placed in different allocation groups within the filesystem, thereby
    ensuring that we don't cross any streams. When an AG fills up, we select a
    new AG for the stream that is not in use.

    The core of the functionality is the stream tracking - each inode that we
    create in a directory needs to be associated with the directories' stream.
    Hence every time we create a file, we look up the directories' stream
    object and associate the new file with that object.

    Once we have a stream object for a file, we use the AG that the stream
    object point to for allocations. If we can't allocate in that AG (e.g. it
    is full) we move the entire stream to another AG. Other inodes in the same
    stream are moved to the new AG on their next allocation (i.e. lazy
    update).

    Stream objects are kept in a cache and hold a reference on the inode.
    Hence the inode cannot be reclaimed while there is an outstanding stream
    reference. This means that on unlink we need to remove the stream
    association and we also need to flush all the associations on certain
    events that want to reclaim all unreferenced inodes (e.g. filesystem
    freeze).

    SGI-PV: 964469
    SGI-Modid: xfs-linux-melb:xfs-kern:29096a

    Signed-off-by: David Chinner
    Signed-off-by: Barry Naujok
    Signed-off-by: Donald Douwsma
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Tim Shimmin
    Signed-off-by: Vlad Apostolov

    David Chinner