aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/Kconfig10
-rw-r--r--drivers/block/aoe/aoechr.c2
-rw-r--r--drivers/block/cciss.c86
-rw-r--r--drivers/block/cpqarray.c2
-rw-r--r--drivers/block/nbd.c19
-rw-r--r--drivers/block/pktcdvd.c6
-rw-r--r--drivers/block/rd.c2
7 files changed, 71 insertions, 56 deletions
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 93d94749310b..b5382cedf0c0 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -400,6 +400,16 @@ config BLK_DEV_RAM_SIZE
400 what are you doing. If you are using IBM S/390, then set this to 400 what are you doing. If you are using IBM S/390, then set this to
401 8192. 401 8192.
402 402
403config BLK_DEV_RAM_BLOCKSIZE
404 int "Default RAM disk block size (bytes)"
405 depends on BLK_DEV_RAM
406 default "1024"
407 help
408 The default value is 1024 kilobytes. PAGE_SIZE is a much more
409 efficient choice however. The default is kept to ensure initrd
410 setups function - apparently needed by the rd_load_image routine
411 that supposes the filesystem in the image uses a 1024 blocksize.
412
403config BLK_DEV_INITRD 413config BLK_DEV_INITRD
404 bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" 414 bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support"
405 depends on BROKEN || !FRV 415 depends on BROKEN || !FRV
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 5327f553b4f5..1bc1cf9603f1 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -162,7 +162,7 @@ aoechr_open(struct inode *inode, struct file *filp)
162{ 162{
163 int n, i; 163 int n, i;
164 164
165 n = MINOR(inode->i_rdev); 165 n = iminor(inode);
166 filp->private_data = (void *) (unsigned long) n; 166 filp->private_data = (void *) (unsigned long) n;
167 167
168 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 168 for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1c4df22dfd2a..7b0eca703a67 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1233,6 +1233,50 @@ static inline void complete_buffers(struct bio *bio, int status)
1233 } 1233 }
1234} 1234}
1235 1235
1236static void cciss_check_queues(ctlr_info_t *h)
1237{
1238 int start_queue = h->next_to_run;
1239 int i;
1240
1241 /* check to see if we have maxed out the number of commands that can
1242 * be placed on the queue. If so then exit. We do this check here
1243 * in case the interrupt we serviced was from an ioctl and did not
1244 * free any new commands.
1245 */
1246 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
1247 return;
1248
1249 /* We have room on the queue for more commands. Now we need to queue
1250 * them up. We will also keep track of the next queue to run so
1251 * that every queue gets a chance to be started first.
1252 */
1253 for (i = 0; i < h->highest_lun + 1; i++) {
1254 int curr_queue = (start_queue + i) % (h->highest_lun + 1);
1255 /* make sure the disk has been added and the drive is real
1256 * because this can be called from the middle of init_one.
1257 */
1258 if (!(h->drv[curr_queue].queue) || !(h->drv[curr_queue].heads))
1259 continue;
1260 blk_start_queue(h->gendisk[curr_queue]->queue);
1261
1262 /* check to see if we have maxed out the number of commands
1263 * that can be placed on the queue.
1264 */
1265 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) {
1266 if (curr_queue == start_queue) {
1267 h->next_to_run =
1268 (start_queue + 1) % (h->highest_lun + 1);
1269 break;
1270 } else {
1271 h->next_to_run = curr_queue;
1272 break;
1273 }
1274 } else {
1275 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
1276 }
1277 }
1278}
1279
1236static void cciss_softirq_done(struct request *rq) 1280static void cciss_softirq_done(struct request *rq)
1237{ 1281{
1238 CommandList_struct *cmd = rq->completion_data; 1282 CommandList_struct *cmd = rq->completion_data;
@@ -1264,6 +1308,7 @@ static void cciss_softirq_done(struct request *rq)
1264 spin_lock_irqsave(&h->lock, flags); 1308 spin_lock_irqsave(&h->lock, flags);
1265 end_that_request_last(rq, rq->errors); 1309 end_that_request_last(rq, rq->errors);
1266 cmd_free(h, cmd, 1); 1310 cmd_free(h, cmd, 1);
1311 cciss_check_queues(h);
1267 spin_unlock_irqrestore(&h->lock, flags); 1312 spin_unlock_irqrestore(&h->lock, flags);
1268} 1313}
1269 1314
@@ -2528,8 +2573,6 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2528 CommandList_struct *c; 2573 CommandList_struct *c;
2529 unsigned long flags; 2574 unsigned long flags;
2530 __u32 a, a1, a2; 2575 __u32 a, a1, a2;
2531 int j;
2532 int start_queue = h->next_to_run;
2533 2576
2534 if (interrupt_not_for_us(h)) 2577 if (interrupt_not_for_us(h))
2535 return IRQ_NONE; 2578 return IRQ_NONE;
@@ -2588,45 +2631,6 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2588 } 2631 }
2589 } 2632 }
2590 2633
2591 /* check to see if we have maxed out the number of commands that can
2592 * be placed on the queue. If so then exit. We do this check here
2593 * in case the interrupt we serviced was from an ioctl and did not
2594 * free any new commands.
2595 */
2596 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
2597 goto cleanup;
2598
2599 /* We have room on the queue for more commands. Now we need to queue
2600 * them up. We will also keep track of the next queue to run so
2601 * that every queue gets a chance to be started first.
2602 */
2603 for (j = 0; j < h->highest_lun + 1; j++) {
2604 int curr_queue = (start_queue + j) % (h->highest_lun + 1);
2605 /* make sure the disk has been added and the drive is real
2606 * because this can be called from the middle of init_one.
2607 */
2608 if (!(h->drv[curr_queue].queue) || !(h->drv[curr_queue].heads))
2609 continue;
2610 blk_start_queue(h->gendisk[curr_queue]->queue);
2611
2612 /* check to see if we have maxed out the number of commands
2613 * that can be placed on the queue.
2614 */
2615 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) {
2616 if (curr_queue == start_queue) {
2617 h->next_to_run =
2618 (start_queue + 1) % (h->highest_lun + 1);
2619 goto cleanup;
2620 } else {
2621 h->next_to_run = curr_queue;
2622 goto cleanup;
2623 }
2624 } else {
2625 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
2626 }
2627 }
2628
2629 cleanup:
2630 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 2634 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
2631 return IRQ_HANDLED; 2635 return IRQ_HANDLED;
2632} 2636}
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 757f42dd8e86..78082edc14b4 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -1739,8 +1739,6 @@ static void getgeometry(int ctlr)
1739 (log_index < id_ctlr_buf->nr_drvs) 1739 (log_index < id_ctlr_buf->nr_drvs)
1740 && (log_unit < NWD); 1740 && (log_unit < NWD);
1741 log_unit++) { 1741 log_unit++) {
1742 struct gendisk *disk = ida_gendisk[ctlr][log_unit];
1743
1744 size = sizeof(sense_log_drv_stat_t); 1742 size = sizeof(sense_log_drv_stat_t);
1745 1743
1746 /* 1744 /*
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 0a1b1ea36ddc..bdbade9a5cf5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -300,6 +300,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
300 lo->disk->disk_name, result); 300 lo->disk->disk_name, result);
301 goto harderror; 301 goto harderror;
302 } 302 }
303
304 if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
305 printk(KERN_ERR "%s: Wrong magic (0x%lx)\n",
306 lo->disk->disk_name,
307 (unsigned long)ntohl(reply.magic));
308 result = -EPROTO;
309 goto harderror;
310 }
311
303 req = nbd_find_request(lo, reply.handle); 312 req = nbd_find_request(lo, reply.handle);
304 if (unlikely(IS_ERR(req))) { 313 if (unlikely(IS_ERR(req))) {
305 result = PTR_ERR(req); 314 result = PTR_ERR(req);
@@ -312,13 +321,6 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
312 goto harderror; 321 goto harderror;
313 } 322 }
314 323
315 if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
316 printk(KERN_ERR "%s: Wrong magic (0x%lx)\n",
317 lo->disk->disk_name,
318 (unsigned long)ntohl(reply.magic));
319 result = -EPROTO;
320 goto harderror;
321 }
322 if (ntohl(reply.error)) { 324 if (ntohl(reply.error)) {
323 printk(KERN_ERR "%s: Other side returned error (%d)\n", 325 printk(KERN_ERR "%s: Other side returned error (%d)\n",
324 lo->disk->disk_name, ntohl(reply.error)); 326 lo->disk->disk_name, ntohl(reply.error));
@@ -339,7 +341,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
339 printk(KERN_ERR "%s: Receive data failed (result %d)\n", 341 printk(KERN_ERR "%s: Receive data failed (result %d)\n",
340 lo->disk->disk_name, 342 lo->disk->disk_name,
341 result); 343 result);
342 goto harderror; 344 req->errors++;
345 return req;
343 } 346 }
344 dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", 347 dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
345 lo->disk->disk_name, req, bvec->bv_len); 348 lo->disk->disk_name, req, bvec->bv_len);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index bde2c64b6346..451b996bba91 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2577,19 +2577,19 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm
2577 case PKT_CTRL_CMD_SETUP: 2577 case PKT_CTRL_CMD_SETUP:
2578 if (!capable(CAP_SYS_ADMIN)) 2578 if (!capable(CAP_SYS_ADMIN))
2579 return -EPERM; 2579 return -EPERM;
2580 mutex_lock(&ctl_mutex); 2580 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2581 ret = pkt_setup_dev(&ctrl_cmd); 2581 ret = pkt_setup_dev(&ctrl_cmd);
2582 mutex_unlock(&ctl_mutex); 2582 mutex_unlock(&ctl_mutex);
2583 break; 2583 break;
2584 case PKT_CTRL_CMD_TEARDOWN: 2584 case PKT_CTRL_CMD_TEARDOWN:
2585 if (!capable(CAP_SYS_ADMIN)) 2585 if (!capable(CAP_SYS_ADMIN))
2586 return -EPERM; 2586 return -EPERM;
2587 mutex_lock(&ctl_mutex); 2587 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2588 ret = pkt_remove_dev(&ctrl_cmd); 2588 ret = pkt_remove_dev(&ctrl_cmd);
2589 mutex_unlock(&ctl_mutex); 2589 mutex_unlock(&ctl_mutex);
2590 break; 2590 break;
2591 case PKT_CTRL_CMD_STATUS: 2591 case PKT_CTRL_CMD_STATUS:
2592 mutex_lock(&ctl_mutex); 2592 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2593 pkt_get_status(&ctrl_cmd); 2593 pkt_get_status(&ctrl_cmd);
2594 mutex_unlock(&ctl_mutex); 2594 mutex_unlock(&ctl_mutex);
2595 break; 2595 break;
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 3cf246abb5ec..a3f64bfe6b58 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -84,7 +84,7 @@ int rd_size = CONFIG_BLK_DEV_RAM_SIZE; /* Size of the RAM disks */
84 * behaviour. The default is still BLOCK_SIZE (needed by rd_load_image that 84 * behaviour. The default is still BLOCK_SIZE (needed by rd_load_image that
85 * supposes the filesystem in the image uses a BLOCK_SIZE blocksize). 85 * supposes the filesystem in the image uses a BLOCK_SIZE blocksize).
86 */ 86 */
87static int rd_blocksize = BLOCK_SIZE; /* blocksize of the RAM disks */ 87static int rd_blocksize = CONFIG_BLK_DEV_RAM_BLOCKSIZE;
88 88
89/* 89/*
90 * Copyright (C) 2000 Linus Torvalds. 90 * Copyright (C) 2000 Linus Torvalds.