aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-04 11:08:05 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-04 11:08:05 -0500
commitce932967b9f77c130d4936d1e20d619a628ae08f (patch)
treeaf0274e83664d9563468f0647b178427d3b18560 /drivers
parent8727e28ddebb031d80b5e261c98c24f1dcb9a82f (diff)
parentcc66b4512cae8df4ed1635483210aabf7690ec27 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: block: fix blkdev_issue_flush() not detecting and passing EOPNOTSUPP back block: fix shadowed variable warning in blk-map.c block: remove extern on function definition cciss: remove READ_AHEAD define and use block layer defaults make cdrom.c:check_for_audio_disc() static block/genhd.c: proper externs unexport blk_rq_map_user_iov unexport blk_{get,put}_queue block/genhd.c: cleanups proper prototype for blk_dev_init() block/blk-tag.c should #include "blk.h" Fix DMA access of block device in 64-bit kernel on some non-x86 systems with 4GB or upper 4GB memory block: separate out padding from alignment block: restore the meaning of rq->data_len to the true data length resubmit: cciss: procfs updates to display info about many splice: only return -EAGAIN if there's hope of more data block: fix kernel-docbook parameters and files
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-scsi.c9
-rw-r--r--drivers/block/cciss.c256
-rw-r--r--drivers/block/cciss_scsi.c10
-rw-r--r--drivers/cdrom/cdrom.c4
4 files changed, 167 insertions, 112 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7b1f1ee8131d..8f0e8f2bc628 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -862,9 +862,10 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
862 struct request_queue *q = sdev->request_queue; 862 struct request_queue *q = sdev->request_queue;
863 void *buf; 863 void *buf;
864 864
865 /* set the min alignment */ 865 /* set the min alignment and padding */
866 blk_queue_update_dma_alignment(sdev->request_queue, 866 blk_queue_update_dma_alignment(sdev->request_queue,
867 ATA_DMA_PAD_SZ - 1); 867 ATA_DMA_PAD_SZ - 1);
868 blk_queue_dma_pad(sdev->request_queue, ATA_DMA_PAD_SZ - 1);
868 869
869 /* configure draining */ 870 /* configure draining */
870 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL); 871 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
@@ -2538,7 +2539,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2538 } 2539 }
2539 2540
2540 qc->tf.command = ATA_CMD_PACKET; 2541 qc->tf.command = ATA_CMD_PACKET;
2541 qc->nbytes = scsi_bufflen(scmd); 2542 qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len;
2542 2543
2543 /* check whether ATAPI DMA is safe */ 2544 /* check whether ATAPI DMA is safe */
2544 if (!using_pio && ata_check_atapi_dma(qc)) 2545 if (!using_pio && ata_check_atapi_dma(qc))
@@ -2549,7 +2550,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2549 * want to set it properly, and for DMA where it is 2550 * want to set it properly, and for DMA where it is
2550 * effectively meaningless. 2551 * effectively meaningless.
2551 */ 2552 */
2552 nbytes = min(scmd->request->raw_data_len, (unsigned int)63 * 1024); 2553 nbytes = min(scmd->request->data_len, (unsigned int)63 * 1024);
2553 2554
2554 /* Most ATAPI devices which honor transfer chunk size don't 2555 /* Most ATAPI devices which honor transfer chunk size don't
2555 * behave according to the spec when odd chunk size which 2556 * behave according to the spec when odd chunk size which
@@ -2875,7 +2876,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2875 * TODO: find out if we need to do more here to 2876 * TODO: find out if we need to do more here to
2876 * cover scatter/gather case. 2877 * cover scatter/gather case.
2877 */ 2878 */
2878 qc->nbytes = scsi_bufflen(scmd); 2879 qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len;
2879 2880
2880 /* request result TF and be quiet about device error */ 2881 /* request result TF and be quiet about device error */
2881 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; 2882 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 9715be3f2487..55bd35c0f082 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -33,6 +33,7 @@
33#include <linux/blkpg.h> 33#include <linux/blkpg.h>
34#include <linux/timer.h> 34#include <linux/timer.h>
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/seq_file.h>
36#include <linux/init.h> 37#include <linux/init.h>
37#include <linux/hdreg.h> 38#include <linux/hdreg.h>
38#include <linux/spinlock.h> 39#include <linux/spinlock.h>
@@ -131,7 +132,6 @@ static struct board_type products[] = {
131/*define how many times we will try a command because of bus resets */ 132/*define how many times we will try a command because of bus resets */
132#define MAX_CMD_RETRIES 3 133#define MAX_CMD_RETRIES 3
133 134
134#define READ_AHEAD 1024
135#define MAX_CTLR 32 135#define MAX_CTLR 32
136 136
137/* Originally cciss driver only supports 8 major numbers */ 137/* Originally cciss driver only supports 8 major numbers */
@@ -174,8 +174,6 @@ static int sendcmd_withirq(__u8 cmd, int ctlr, void *buff, size_t size,
174static void fail_all_cmds(unsigned long ctlr); 174static void fail_all_cmds(unsigned long ctlr);
175 175
176#ifdef CONFIG_PROC_FS 176#ifdef CONFIG_PROC_FS
177static int cciss_proc_get_info(char *buffer, char **start, off_t offset,
178 int length, int *eof, void *data);
179static void cciss_procinit(int i); 177static void cciss_procinit(int i);
180#else 178#else
181static void cciss_procinit(int i) 179static void cciss_procinit(int i)
@@ -240,24 +238,46 @@ static inline CommandList_struct *removeQ(CommandList_struct **Qptr,
240 */ 238 */
241#define ENG_GIG 1000000000 239#define ENG_GIG 1000000000
242#define ENG_GIG_FACTOR (ENG_GIG/512) 240#define ENG_GIG_FACTOR (ENG_GIG/512)
241#define ENGAGE_SCSI "engage scsi"
243static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG", 242static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
244 "UNKNOWN" 243 "UNKNOWN"
245}; 244};
246 245
247static struct proc_dir_entry *proc_cciss; 246static struct proc_dir_entry *proc_cciss;
248 247
249static int cciss_proc_get_info(char *buffer, char **start, off_t offset, 248static void cciss_seq_show_header(struct seq_file *seq)
250 int length, int *eof, void *data)
251{ 249{
252 off_t pos = 0; 250 ctlr_info_t *h = seq->private;
253 off_t len = 0; 251
254 int size, i, ctlr; 252 seq_printf(seq, "%s: HP %s Controller\n"
255 ctlr_info_t *h = (ctlr_info_t *) data; 253 "Board ID: 0x%08lx\n"
256 drive_info_struct *drv; 254 "Firmware Version: %c%c%c%c\n"
257 unsigned long flags; 255 "IRQ: %d\n"
258 sector_t vol_sz, vol_sz_frac; 256 "Logical drives: %d\n"
257 "Current Q depth: %d\n"
258 "Current # commands on controller: %d\n"
259 "Max Q depth since init: %d\n"
260 "Max # commands on controller since init: %d\n"
261 "Max SG entries since init: %d\n",
262 h->devname,
263 h->product_name,
264 (unsigned long)h->board_id,
265 h->firm_ver[0], h->firm_ver[1], h->firm_ver[2],
266 h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT],
267 h->num_luns,
268 h->Qdepth, h->commands_outstanding,
269 h->maxQsinceinit, h->max_outstanding, h->maxSG);
259 270
260 ctlr = h->ctlr; 271#ifdef CONFIG_CISS_SCSI_TAPE
272 cciss_seq_tape_report(seq, h->ctlr);
273#endif /* CONFIG_CISS_SCSI_TAPE */
274}
275
276static void *cciss_seq_start(struct seq_file *seq, loff_t *pos)
277{
278 ctlr_info_t *h = seq->private;
279 unsigned ctlr = h->ctlr;
280 unsigned long flags;
261 281
262 /* prevent displaying bogus info during configuration 282 /* prevent displaying bogus info during configuration
263 * or deconfiguration of a logical volume 283 * or deconfiguration of a logical volume
@@ -265,115 +285,155 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset,
265 spin_lock_irqsave(CCISS_LOCK(ctlr), flags); 285 spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
266 if (h->busy_configuring) { 286 if (h->busy_configuring) {
267 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); 287 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
268 return -EBUSY; 288 return ERR_PTR(-EBUSY);
269 } 289 }
270 h->busy_configuring = 1; 290 h->busy_configuring = 1;
271 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); 291 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
272 292
273 size = sprintf(buffer, "%s: HP %s Controller\n" 293 if (*pos == 0)
274 "Board ID: 0x%08lx\n" 294 cciss_seq_show_header(seq);
275 "Firmware Version: %c%c%c%c\n"
276 "IRQ: %d\n"
277 "Logical drives: %d\n"
278 "Max sectors: %d\n"
279 "Current Q depth: %d\n"
280 "Current # commands on controller: %d\n"
281 "Max Q depth since init: %d\n"
282 "Max # commands on controller since init: %d\n"
283 "Max SG entries since init: %d\n\n",
284 h->devname,
285 h->product_name,
286 (unsigned long)h->board_id,
287 h->firm_ver[0], h->firm_ver[1], h->firm_ver[2],
288 h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT],
289 h->num_luns,
290 h->cciss_max_sectors,
291 h->Qdepth, h->commands_outstanding,
292 h->maxQsinceinit, h->max_outstanding, h->maxSG);
293
294 pos += size;
295 len += size;
296 cciss_proc_tape_report(ctlr, buffer, &pos, &len);
297 for (i = 0; i <= h->highest_lun; i++) {
298
299 drv = &h->drv[i];
300 if (drv->heads == 0)
301 continue;
302 295
303 vol_sz = drv->nr_blocks; 296 return pos;
304 vol_sz_frac = sector_div(vol_sz, ENG_GIG_FACTOR); 297}
305 vol_sz_frac *= 100; 298
306 sector_div(vol_sz_frac, ENG_GIG_FACTOR); 299static int cciss_seq_show(struct seq_file *seq, void *v)
300{
301 sector_t vol_sz, vol_sz_frac;
302 ctlr_info_t *h = seq->private;
303 unsigned ctlr = h->ctlr;
304 loff_t *pos = v;
305 drive_info_struct *drv = &h->drv[*pos];
306
307 if (*pos > h->highest_lun)
308 return 0;
309
310 if (drv->heads == 0)
311 return 0;
312
313 vol_sz = drv->nr_blocks;
314 vol_sz_frac = sector_div(vol_sz, ENG_GIG_FACTOR);
315 vol_sz_frac *= 100;
316 sector_div(vol_sz_frac, ENG_GIG_FACTOR);
317
318 if (drv->raid_level > 5)
319 drv->raid_level = RAID_UNKNOWN;
320 seq_printf(seq, "cciss/c%dd%d:"
321 "\t%4u.%02uGB\tRAID %s\n",
322 ctlr, (int) *pos, (int)vol_sz, (int)vol_sz_frac,
323 raid_label[drv->raid_level]);
324 return 0;
325}
326
327static void *cciss_seq_next(struct seq_file *seq, void *v, loff_t *pos)
328{
329 ctlr_info_t *h = seq->private;
330
331 if (*pos > h->highest_lun)
332 return NULL;
333 *pos += 1;
334
335 return pos;
336}
337
338static void cciss_seq_stop(struct seq_file *seq, void *v)
339{
340 ctlr_info_t *h = seq->private;
341
342 /* Only reset h->busy_configuring if we succeeded in setting
343 * it during cciss_seq_start. */
344 if (v == ERR_PTR(-EBUSY))
345 return;
307 346
308 if (drv->raid_level > 5)
309 drv->raid_level = RAID_UNKNOWN;
310 size = sprintf(buffer + len, "cciss/c%dd%d:"
311 "\t%4u.%02uGB\tRAID %s\n",
312 ctlr, i, (int)vol_sz, (int)vol_sz_frac,
313 raid_label[drv->raid_level]);
314 pos += size;
315 len += size;
316 }
317
318 *eof = 1;
319 *start = buffer + offset;
320 len -= offset;
321 if (len > length)
322 len = length;
323 h->busy_configuring = 0; 347 h->busy_configuring = 0;
324 return len;
325} 348}
326 349
327static int 350static struct seq_operations cciss_seq_ops = {
328cciss_proc_write(struct file *file, const char __user *buffer, 351 .start = cciss_seq_start,
329 unsigned long count, void *data) 352 .show = cciss_seq_show,
353 .next = cciss_seq_next,
354 .stop = cciss_seq_stop,
355};
356
357static int cciss_seq_open(struct inode *inode, struct file *file)
330{ 358{
331 unsigned char cmd[80]; 359 int ret = seq_open(file, &cciss_seq_ops);
332 int len; 360 struct seq_file *seq = file->private_data;
333#ifdef CONFIG_CISS_SCSI_TAPE 361
334 ctlr_info_t *h = (ctlr_info_t *) data; 362 if (!ret)
335 int rc; 363 seq->private = PDE(inode)->data;
364
365 return ret;
366}
367
368static ssize_t
369cciss_proc_write(struct file *file, const char __user *buf,
370 size_t length, loff_t *ppos)
371{
372 int err;
373 char *buffer;
374
375#ifndef CONFIG_CISS_SCSI_TAPE
376 return -EINVAL;
336#endif 377#endif
337 378
338 if (count > sizeof(cmd) - 1) 379 if (!buf || length > PAGE_SIZE - 1)
339 return -EINVAL; 380 return -EINVAL;
340 if (copy_from_user(cmd, buffer, count)) 381
341 return -EFAULT; 382 buffer = (char *)__get_free_page(GFP_KERNEL);
342 cmd[count] = '\0'; 383 if (!buffer)
343 len = strlen(cmd); // above 3 lines ensure safety 384 return -ENOMEM;
344 if (len && cmd[len - 1] == '\n') 385
345 cmd[--len] = '\0'; 386 err = -EFAULT;
346# ifdef CONFIG_CISS_SCSI_TAPE 387 if (copy_from_user(buffer, buf, length))
347 if (strcmp("engage scsi", cmd) == 0) { 388 goto out;
389 buffer[length] = '\0';
390
391#ifdef CONFIG_CISS_SCSI_TAPE
392 if (strncmp(ENGAGE_SCSI, buffer, sizeof ENGAGE_SCSI - 1) == 0) {
393 struct seq_file *seq = file->private_data;
394 ctlr_info_t *h = seq->private;
395 int rc;
396
348 rc = cciss_engage_scsi(h->ctlr); 397 rc = cciss_engage_scsi(h->ctlr);
349 if (rc != 0) 398 if (rc != 0)
350 return -rc; 399 err = -rc;
351 return count; 400 else
352 } 401 err = length;
402 } else
403#endif /* CONFIG_CISS_SCSI_TAPE */
404 err = -EINVAL;
353 /* might be nice to have "disengage" too, but it's not 405 /* might be nice to have "disengage" too, but it's not
354 safely possible. (only 1 module use count, lock issues.) */ 406 safely possible. (only 1 module use count, lock issues.) */
355# endif 407
356 return -EINVAL; 408out:
409 free_page((unsigned long)buffer);
410 return err;
357} 411}
358 412
359/* 413static struct file_operations cciss_proc_fops = {
360 * Get us a file in /proc/cciss that says something about each controller. 414 .owner = THIS_MODULE,
361 * Create /proc/cciss if it doesn't exist yet. 415 .open = cciss_seq_open,
362 */ 416 .read = seq_read,
417 .llseek = seq_lseek,
418 .release = seq_release,
419 .write = cciss_proc_write,
420};
421
363static void __devinit cciss_procinit(int i) 422static void __devinit cciss_procinit(int i)
364{ 423{
365 struct proc_dir_entry *pde; 424 struct proc_dir_entry *pde;
366 425
367 if (proc_cciss == NULL) { 426 if (proc_cciss == NULL)
368 proc_cciss = proc_mkdir("cciss", proc_root_driver); 427 proc_cciss = proc_mkdir("cciss", proc_root_driver);
369 if (!proc_cciss) 428 if (!proc_cciss)
370 return; 429 return;
371 } 430 pde = proc_create(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP |
431 S_IROTH, proc_cciss,
432 &cciss_proc_fops);
433 if (!pde)
434 return;
372 435
373 pde = create_proc_read_entry(hba[i]->devname, 436 pde->data = hba[i];
374 S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH,
375 proc_cciss, cciss_proc_get_info, hba[i]);
376 pde->write_proc = cciss_proc_write;
377} 437}
378#endif /* CONFIG_PROC_FS */ 438#endif /* CONFIG_PROC_FS */
379 439
@@ -1341,7 +1401,6 @@ geo_inq:
1341 disk->private_data = &h->drv[drv_index]; 1401 disk->private_data = &h->drv[drv_index];
1342 1402
1343 /* Set up queue information */ 1403 /* Set up queue information */
1344 disk->queue->backing_dev_info.ra_pages = READ_AHEAD;
1345 blk_queue_bounce_limit(disk->queue, hba[ctlr]->pdev->dma_mask); 1404 blk_queue_bounce_limit(disk->queue, hba[ctlr]->pdev->dma_mask);
1346 1405
1347 /* This is a hardware imposed limit. */ 1406 /* This is a hardware imposed limit. */
@@ -3434,7 +3493,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3434 } 3493 }
3435 drv->queue = q; 3494 drv->queue = q;
3436 3495
3437 q->backing_dev_info.ra_pages = READ_AHEAD;
3438 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); 3496 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
3439 3497
3440 /* This is a hardware imposed limit. */ 3498 /* This is a hardware imposed limit. */
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 55178e9973a0..45ac09300eb3 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1404,21 +1404,18 @@ cciss_engage_scsi(int ctlr)
1404} 1404}
1405 1405
1406static void 1406static void
1407cciss_proc_tape_report(int ctlr, unsigned char *buffer, off_t *pos, off_t *len) 1407cciss_seq_tape_report(struct seq_file *seq, int ctlr)
1408{ 1408{
1409 unsigned long flags; 1409 unsigned long flags;
1410 int size;
1411
1412 *pos = *pos -1; *len = *len - 1; // cut off the last trailing newline
1413 1410
1414 CPQ_TAPE_LOCK(ctlr, flags); 1411 CPQ_TAPE_LOCK(ctlr, flags);
1415 size = sprintf(buffer + *len, 1412 seq_printf(seq,
1416 "Sequential access devices: %d\n\n", 1413 "Sequential access devices: %d\n\n",
1417 ccissscsi[ctlr].ndevices); 1414 ccissscsi[ctlr].ndevices);
1418 CPQ_TAPE_UNLOCK(ctlr, flags); 1415 CPQ_TAPE_UNLOCK(ctlr, flags);
1419 *pos += size; *len += size;
1420} 1416}
1421 1417
1418
1422/* Need at least one of these error handlers to keep ../scsi/hosts.c from 1419/* Need at least one of these error handlers to keep ../scsi/hosts.c from
1423 * complaining. Doing a host- or bus-reset can't do anything good here. 1420 * complaining. Doing a host- or bus-reset can't do anything good here.
1424 * Despite what it might say in scsi_error.c, there may well be commands 1421 * Despite what it might say in scsi_error.c, there may well be commands
@@ -1498,6 +1495,5 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd)
1498#define cciss_scsi_setup(cntl_num) 1495#define cciss_scsi_setup(cntl_num)
1499#define cciss_unregister_scsi(ctlr) 1496#define cciss_unregister_scsi(ctlr)
1500#define cciss_register_scsi(ctlr) 1497#define cciss_register_scsi(ctlr)
1501#define cciss_proc_tape_report(ctlr, buffer, pos, len)
1502 1498
1503#endif /* CONFIG_CISS_SCSI_TAPE */ 1499#endif /* CONFIG_CISS_SCSI_TAPE */
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index db259e60289b..12f5baea439b 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1152,8 +1152,8 @@ clean_up_and_return:
1152/* This code is similar to that in open_for_data. The routine is called 1152/* This code is similar to that in open_for_data. The routine is called
1153 whenever an audio play operation is requested. 1153 whenever an audio play operation is requested.
1154*/ 1154*/
1155int check_for_audio_disc(struct cdrom_device_info * cdi, 1155static int check_for_audio_disc(struct cdrom_device_info * cdi,
1156 struct cdrom_device_ops * cdo) 1156 struct cdrom_device_ops * cdo)
1157{ 1157{
1158 int ret; 1158 int ret;
1159 tracktype tracks; 1159 tracktype tracks;