1. 29 Oct, 2002 5 commits
    • 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
    • Andrew Morton's avatar
      [PATCH] libfs a_ops correctnes · 303c9cf6
      Andrew Morton authored
      simple_prepare_write() currently memsets the entire page.  It only
      needs to clear the parts which are outside the to-be-written region.
      This change makes no difference to performance - that memset was just a
      cache preload for the copy_from_user() in generic_file_write().  But
      it's more correct.
      
      Also, mark the page dirty in simple_commit_write(), not in
      simple_prepare_write().  Because the page's contents are changed after
      prepare_write().  This doesn't matter in practice, but it is setting a
      bad example.
      
      Also, add a flush_dcache_page() to simple_prepare_write().  Again, not
      really needed because the page cannot be mapped into pagetables if it
      is not uptodate.  But it is example code and should not be missing such
      things.
      303c9cf6
    • Andrew Morton's avatar
      [PATCH] move ramfs a_ops into libfs · 3ee477f0
      Andrew Morton authored
      From Bill Irwin.
      
      Abstract out ramfs readpage(), prepare_write(), and commit_write()
      operations.
      
      Ram-backed filesystems are going to be doing a lot of zero-filled read
      and write operations.  So in this patch, ramfs' implementations are
      moved to libfs in anticipation of other callers.
      3ee477f0
    • Andrew Morton's avatar
      [PATCH] blkdev_get_block fix · f596aeef
      Andrew Morton authored
      Patch from Hugh Dickins <hugh@veritas.com>
      
      Fix premature -EIO from blkdev_get_block: bdget initialize
      bd_block_size consistent with bd_inode->i_blkbits (assigned by
      new_inode).  Otherwise, subsequent set_blocksize can find bd_block_size
      doesn't need updating, and skip updating i_blkbits, leaving them
      inconsistent.
      f596aeef
    • Andrew Morton's avatar
      [PATCH] fid dmi compile warning · ba3d6419
      Andrew Morton authored
      Local variable `data' is only used for debugging.
      ba3d6419
  2. 28 Oct, 2002 35 commits