aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xsysace.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-08-07 12:25:34 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:25:34 -0400
commit6e9624b8caec290d28b4c6d9ec75749df6372b87 (patch)
tree47225b544e1da82742795553dc4e8aa70c17afdc /drivers/block/xsysace.c
parent8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 (diff)
block: push down BKL into .open and .release
The open and release block_device_operations are currently called with the BKL held. In order to change that, we must first make sure that all drivers that currently rely on this have no regressions. This blindly pushes the BKL into all .open and .release operations for all block drivers to prepare for the next step. The drivers can subsequently replace the BKL with their own locks or remove it completely when it can be shown that it is not needed. The functions blkdev_get and blkdev_put are the only remaining users of the big kernel lock in the block layer, besides a few uses in the ioctl code, none of which need to serialize with blkdev_{get,put}. Most of these two functions is also under the protection of bdev->bd_mutex, including the actual calls to ->open and ->release, and the common code does not access any global data structures that need the BKL. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/xsysace.c')
-rw-r--r--drivers/block/xsysace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index ac278ac908d5..b71888b909a0 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -89,6 +89,7 @@
89#include <linux/delay.h> 89#include <linux/delay.h>
90#include <linux/slab.h> 90#include <linux/slab.h>
91#include <linux/blkdev.h> 91#include <linux/blkdev.h>
92#include <linux/smp_lock.h>
92#include <linux/ata.h> 93#include <linux/ata.h>
93#include <linux/hdreg.h> 94#include <linux/hdreg.h>
94#include <linux/platform_device.h> 95#include <linux/platform_device.h>
@@ -901,11 +902,14 @@ static int ace_open(struct block_device *bdev, fmode_t mode)
901 902
902 dev_dbg(ace->dev, "ace_open() users=%i\n", ace->users + 1); 903 dev_dbg(ace->dev, "ace_open() users=%i\n", ace->users + 1);
903 904
905 lock_kernel();
904 spin_lock_irqsave(&ace->lock, flags); 906 spin_lock_irqsave(&ace->lock, flags);
905 ace->users++; 907 ace->users++;
906 spin_unlock_irqrestore(&ace->lock, flags); 908 spin_unlock_irqrestore(&ace->lock, flags);
907 909
908 check_disk_change(bdev); 910 check_disk_change(bdev);
911 unlock_kernel();
912
909 return 0; 913 return 0;
910} 914}
911 915
@@ -917,6 +921,7 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
917 921
918 dev_dbg(ace->dev, "ace_release() users=%i\n", ace->users - 1); 922 dev_dbg(ace->dev, "ace_release() users=%i\n", ace->users - 1);
919 923
924 lock_kernel();
920 spin_lock_irqsave(&ace->lock, flags); 925 spin_lock_irqsave(&ace->lock, flags);
921 ace->users--; 926 ace->users--;
922 if (ace->users == 0) { 927 if (ace->users == 0) {
@@ -924,6 +929,7 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
924 ace_out(ace, ACE_CTRL, val & ~ACE_CTRL_LOCKREQ); 929 ace_out(ace, ACE_CTRL, val & ~ACE_CTRL_LOCKREQ);
925 } 930 }
926 spin_unlock_irqrestore(&ace->lock, flags); 931 spin_unlock_irqrestore(&ace->lock, flags);
932 unlock_kernel();
927 return 0; 933 return 0;
928} 934}
929 935