An error occurred fetching the project authors.
  1. 29 Oct, 2002 1 commit
    • Andrew Morton's avatar
      [PATCH] invalidate_inode_pages fixes · caa2f807
      Andrew Morton authored
      Two fixes here.
      
      First:
      
      Fixes a BUG() which occurs if you try to perform O_DIRECT IO against a
      blockdev which has an fs mounted on it.  (We should be able to do
      that).
      
      What happens is that do_invalidatepage() ends up calling
      discard_buffer() on buffers which it couldn't strip.  That clears
      buffer_mapped() against useful things like the superblock buffer_head.
      The next submit_bh() goes BUG over the write of an unmapped buffer.
      
      So just run try_to_release_page() (aka try_to_free_buffers()) on the
      invalidate path.
      
      
      Second:
      
      The invalidate_inode_pages() functions are best-effort pagecache
      shrinkers.  They are used against pages inside i_size and are not
      supposed to throw away dirty data.
      
      However it is possible for another CPU to run set_page_dirty() against
      one of these pages after invalidate_inode_pages() has decided that it
      is clean.  This could happen if someone was performing O_DIRECT IO
      against a file which was also mapped with MAP_SHARED.
      
      So recheck the dirty state of the page inside the mapping->page_lock
      and back out if the page has just been marked dirty.
      
      This will also prevent the remove_from_page_cache() BUG which will occur
      if someone marks the page dirty between the clear_page_dirty() and
      remove_from_page_cache() calls in truncate_complete_page().
      caa2f807
  2. 05 Oct, 2002 1 commit
    • Andrew Morton's avatar
      [PATCH] truncate fixes · 911ceab5
      Andrew Morton authored
      The new truncate code needs to check page->mapping after acquiring the
      page lock.  Because the page could have been unmapped by page reclaim
      or by invalidate_inode_pages() while we waited for the page lock.
      
      Also, the page may have been moved between a tmpfs inode and
      swapper_space.  Because we don't hold the mapping->page_lock across the
      entire truncate operation any more.
      
      Also, change the initial truncate scan (the non-blocking one which is
      there to stop as much writeout as possible) so that it is immune to
      other CPUs decreasing page->index.
      
      Also fix negated test in invalidate_inode_pages2().  Not sure how that
      got in there.
      911ceab5
  3. 03 Oct, 2002 1 commit
    • Andrew Morton's avatar
      [PATCH] truncate/invalidate_inode_pages rewrite · 735a2573
      Andrew Morton authored
      Rewrite these functions to use gang lookup.
      
      - This probably has similar performance to the old code in the common case.
      
      - It will be vastly quicker than current code for the worst case
        (single-page truncate).
      
      - invalidate_inode_pages() has been changed.  It used to use
        page_count(page) as the "is it mapped into pagetables" heuristic.  It
        now uses the (page->pte.direct != 0) heuristic.
      
      - Removes the worst cause of scheduling latency in the kernel.
      
      - It's a big code cleanup.
      
      - invalidate_inode_pages() has been changed to take an address_space
        *, not an inode *.
      
      - the maximum hold times for mapping->page_lock are enormously reduced,
        making it quite feasible to turn this into an irq-safe lock.  Which, it
        seems, is a requirement for sane AIO<->direct-io integration, as well
        as possibly other AIO things.
      
      (Thanks Hugh for fixing a bug in this one as well).
      
      (Christoph added some stuff too)
      735a2573