• Andrew Morton's avatar
    [PATCH] bdev: open() changes · a1864a75
    Andrew Morton authored
    The first of a series which move us toward blockdev hotplug support.  After
    these we have achieved the following:
    
    a) For "normal" (not bdevfs) inodes of block devices we never look at
       ->i_mapping.
    
    b) For the same inodes we only look at ->i_bdev in bd_acquire() where it's
       used only as "here's what we'd found the last time" sort of cached value.
       If it's NULL, we just recalculate it.
    
    c) Lots of messy expressions had been trimmed down, while we are at it.
    
    (a) and (b) allow us to start doing proper block hotplug - we can destroy the
    association between inode and bdev at any time, unhash bdev in question and
    have new open() do everything from scratch, without waiting for old opened
    files to close.  The goal is to be able to say "revoke everything over that
    gendisk"/"revoke that partition" and have it do the right thing.
    
    
    This patch:
    
    Where the old code called (block device) ->open(inode, file), use
    ->open(inode->i_bdev->bd_inode, file).  Changes in drivers:
    
    * none to those that only used inode->i_bdev and inode->i_rdev in their
      ->open() (bdev->bd_inode->i_bdev == bdev, so we are OK)
    
    * floppy.c and floppy98.c used to call permission(inode, ...) in
      floppy_open().  Switched to permission(file->f_dentry->d_inode, ...)
    a1864a75
block_dev.c 21.1 KB