aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtd_blkdevs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:22:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:22:42 -0400
commit2f9e825d3e0e2b407ae8f082de5c00afcf7378fb (patch)
treef8b3ee40674ce4acd5508a0a0bf52a30904caf6c /drivers/mtd/mtd_blkdevs.c
parent7ae0dea900b027cd90e8a3e14deca9a19e17638b (diff)
parentde75d60d5ea235e6e09f4962ab22541ce0fe176a (diff)
Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block: (149 commits) block: make sure that REQ_* types are seen even with CONFIG_BLOCK=n xen-blkfront: fix missing out label blkdev: fix blkdev_issue_zeroout return value block: update request stacking methods to support discards block: fix missing export of blk_types.h writeback: fix bad _bh spinlock nesting drbd: revert "delay probes", feature is being re-implemented differently drbd: Initialize all members of sync_conf to their defaults [Bugz 315] drbd: Disable delay probes for the upcomming release writeback: cleanup bdi_register writeback: add new tracepoints writeback: remove unnecessary init_timer call writeback: optimize periodic bdi thread wakeups writeback: prevent unnecessary bdi threads wakeups writeback: move bdi threads exiting logic to the forker thread writeback: restructure bdi forker loop a little writeback: move last_active to bdi writeback: do not remove bdi from bdi_list writeback: simplify bdi code a little writeback: do not lose wake-ups in bdi threads ... Fixed up pretty trivial conflicts in drivers/block/virtio_blk.c and drivers/scsi/scsi_error.c as per Jens.
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r--drivers/mtd/mtd_blkdevs.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 1d2144d77470..62e68707b07f 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -29,6 +29,7 @@
29#include <linux/blkdev.h> 29#include <linux/blkdev.h>
30#include <linux/blkpg.h> 30#include <linux/blkpg.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/smp_lock.h>
32#include <linux/hdreg.h> 33#include <linux/hdreg.h>
33#include <linux/init.h> 34#include <linux/init.h>
34#include <linux/mutex.h> 35#include <linux/mutex.h>
@@ -87,14 +88,14 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
87 88
88 buf = req->buffer; 89 buf = req->buffer;
89 90
90 if (!blk_fs_request(req)) 91 if (req->cmd_type != REQ_TYPE_FS)
91 return -EIO; 92 return -EIO;
92 93
93 if (blk_rq_pos(req) + blk_rq_cur_sectors(req) > 94 if (blk_rq_pos(req) + blk_rq_cur_sectors(req) >
94 get_capacity(req->rq_disk)) 95 get_capacity(req->rq_disk))
95 return -EIO; 96 return -EIO;
96 97
97 if (blk_discard_rq(req)) 98 if (req->cmd_flags & REQ_DISCARD)
98 return tr->discard(dev, block, nsect); 99 return tr->discard(dev, block, nsect);
99 100
100 switch(rq_data_dir(req)) { 101 switch(rq_data_dir(req)) {
@@ -178,8 +179,9 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
178 int ret; 179 int ret;
179 180
180 if (!dev) 181 if (!dev)
181 return -ERESTARTSYS; 182 return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/
182 183
184 lock_kernel();
183 mutex_lock(&dev->lock); 185 mutex_lock(&dev->lock);
184 186
185 if (!dev->mtd) { 187 if (!dev->mtd) {
@@ -196,6 +198,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
196unlock: 198unlock:
197 mutex_unlock(&dev->lock); 199 mutex_unlock(&dev->lock);
198 blktrans_dev_put(dev); 200 blktrans_dev_put(dev);
201 unlock_kernel();
199 return ret; 202 return ret;
200} 203}
201 204
@@ -207,6 +210,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
207 if (!dev) 210 if (!dev)
208 return ret; 211 return ret;
209 212
213 lock_kernel();
210 mutex_lock(&dev->lock); 214 mutex_lock(&dev->lock);
211 215
212 /* Release one reference, we sure its not the last one here*/ 216 /* Release one reference, we sure its not the last one here*/
@@ -219,6 +223,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
219unlock: 223unlock:
220 mutex_unlock(&dev->lock); 224 mutex_unlock(&dev->lock);
221 blktrans_dev_put(dev); 225 blktrans_dev_put(dev);
226 unlock_kernel();
222 return ret; 227 return ret;
223} 228}
224 229
@@ -251,6 +256,7 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
251 if (!dev) 256 if (!dev)
252 return ret; 257 return ret;
253 258
259 lock_kernel();
254 mutex_lock(&dev->lock); 260 mutex_lock(&dev->lock);
255 261
256 if (!dev->mtd) 262 if (!dev->mtd)
@@ -265,6 +271,7 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
265 } 271 }
266unlock: 272unlock:
267 mutex_unlock(&dev->lock); 273 mutex_unlock(&dev->lock);
274 unlock_kernel();
268 blktrans_dev_put(dev); 275 blktrans_dev_put(dev);
269 return ret; 276 return ret;
270} 277}
@@ -273,7 +280,7 @@ static const struct block_device_operations mtd_blktrans_ops = {
273 .owner = THIS_MODULE, 280 .owner = THIS_MODULE,
274 .open = blktrans_open, 281 .open = blktrans_open,
275 .release = blktrans_release, 282 .release = blktrans_release,
276 .locked_ioctl = blktrans_ioctl, 283 .ioctl = blktrans_ioctl,
277 .getgeo = blktrans_getgeo, 284 .getgeo = blktrans_getgeo,
278}; 285};
279 286