Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block: (41 commits)
  Revert "Seperate read and write statistics of in_flight requests"
  cfq-iosched: don't delay async queue if it hasn't dispatched at all
  block: Topology ioctls
  cfq-iosched: use assigned slice sync value, not default
  cfq-iosched: rename 'desktop' sysfs entry to 'low_latency'
  cfq-iosched: implement slower async initiate and queue ramp up
  cfq-iosched: delay async IO dispatch, if sync IO was just done
  cfq-iosched: add a knob for desktop interactiveness
  Add a tracepoint for block request remapping
  block: allow large discard requests
  block: use normal I/O path for discard requests
  swapfile: avoid NULL pointer dereference in swapon when s_bdev is NULL
  fs/bio.c: move EXPORT* macros to line after function
  Add missing blk_trace_remove_sysfs to be in pair with blk_trace_init_sysfs
  cciss: fix build when !PROC_FS
  block: Do not clamp max_hw_sectors for stacking devices
  block: Set max_sectors correctly for stacking devices
  cciss: cciss_host_attr_groups should be const
  cciss: Dynamically allocate the drive_info_struct for each logical drive.
  cciss: Add usage_count attribute to each logical drive in /sys
  ...
This commit is contained in:
Linus Torvalds
2009-10-04 12:39:14 -07:00
26 changed files with 1002 additions and 483 deletions

View File

@@ -38,6 +38,7 @@
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/reboot.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
@@ -6422,16 +6423,10 @@ static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
return true;
}
/*
DAC960_ProcReadStatus implements reading /proc/rd/status.
*/
static int DAC960_ProcReadStatus(char *Page, char **Start, off_t Offset,
int Count, int *EOF, void *Data)
static int dac960_proc_show(struct seq_file *m, void *v)
{
unsigned char *StatusMessage = "OK\n";
int ControllerNumber, BytesAvailable;
int ControllerNumber;
for (ControllerNumber = 0;
ControllerNumber < DAC960_ControllerCount;
ControllerNumber++)
@@ -6444,52 +6439,49 @@ static int DAC960_ProcReadStatus(char *Page, char **Start, off_t Offset,
break;
}
}
BytesAvailable = strlen(StatusMessage) - Offset;
if (Count >= BytesAvailable)
{
Count = BytesAvailable;
*EOF = true;
}
if (Count <= 0) return 0;
*Start = Page;
memcpy(Page, &StatusMessage[Offset], Count);
return Count;
seq_puts(m, StatusMessage);
return 0;
}
/*
DAC960_ProcReadInitialStatus implements reading /proc/rd/cN/initial_status.
*/
static int DAC960_ProcReadInitialStatus(char *Page, char **Start, off_t Offset,
int Count, int *EOF, void *Data)
static int dac960_proc_open(struct inode *inode, struct file *file)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
int BytesAvailable = Controller->InitialStatusLength - Offset;
if (Count >= BytesAvailable)
{
Count = BytesAvailable;
*EOF = true;
}
if (Count <= 0) return 0;
*Start = Page;
memcpy(Page, &Controller->CombinedStatusBuffer[Offset], Count);
return Count;
return single_open(file, dac960_proc_show, NULL);
}
static const struct file_operations dac960_proc_fops = {
.owner = THIS_MODULE,
.open = dac960_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/*
DAC960_ProcReadCurrentStatus implements reading /proc/rd/cN/current_status.
*/
static int DAC960_ProcReadCurrentStatus(char *Page, char **Start, off_t Offset,
int Count, int *EOF, void *Data)
static int dac960_initial_status_proc_show(struct seq_file *m, void *v)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private;
seq_printf(m, "%.*s", Controller->InitialStatusLength, Controller->CombinedStatusBuffer);
return 0;
}
static int dac960_initial_status_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, dac960_initial_status_proc_show, PDE(inode)->data);
}
static const struct file_operations dac960_initial_status_proc_fops = {
.owner = THIS_MODULE,
.open = dac960_initial_status_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int dac960_current_status_proc_show(struct seq_file *m, void *v)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) m->private;
unsigned char *StatusMessage =
"No Rebuild or Consistency Check in Progress\n";
int ProgressMessageLength = strlen(StatusMessage);
int BytesAvailable;
if (jiffies != Controller->LastCurrentStatusTime)
{
Controller->CurrentStatusLength = 0;
@@ -6513,49 +6505,41 @@ static int DAC960_ProcReadCurrentStatus(char *Page, char **Start, off_t Offset,
}
Controller->LastCurrentStatusTime = jiffies;
}
BytesAvailable = Controller->CurrentStatusLength - Offset;
if (Count >= BytesAvailable)
{
Count = BytesAvailable;
*EOF = true;
}
if (Count <= 0) return 0;
*Start = Page;
memcpy(Page, &Controller->CurrentStatusBuffer[Offset], Count);
return Count;
seq_printf(m, "%.*s", Controller->CurrentStatusLength, Controller->CurrentStatusBuffer);
return 0;
}
/*
DAC960_ProcReadUserCommand implements reading /proc/rd/cN/user_command.
*/
static int DAC960_ProcReadUserCommand(char *Page, char **Start, off_t Offset,
int Count, int *EOF, void *Data)
static int dac960_current_status_proc_open(struct inode *inode, struct file *file)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
int BytesAvailable = Controller->UserStatusLength - Offset;
if (Count >= BytesAvailable)
{
Count = BytesAvailable;
*EOF = true;
}
if (Count <= 0) return 0;
*Start = Page;
memcpy(Page, &Controller->UserStatusBuffer[Offset], Count);
return Count;
return single_open(file, dac960_current_status_proc_show, PDE(inode)->data);
}
static const struct file_operations dac960_current_status_proc_fops = {
.owner = THIS_MODULE,
.open = dac960_current_status_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/*
DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command.
*/
static int dac960_user_command_proc_show(struct seq_file *m, void *v)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private;
static int DAC960_ProcWriteUserCommand(struct file *file,
seq_printf(m, "%.*s", Controller->UserStatusLength, Controller->UserStatusBuffer);
return 0;
}
static int dac960_user_command_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, dac960_user_command_proc_show, PDE(inode)->data);
}
static ssize_t dac960_user_command_proc_write(struct file *file,
const char __user *Buffer,
unsigned long Count, void *Data)
size_t Count, loff_t *pos)
{
DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file->f_path.dentry->d_inode)->data;
unsigned char CommandBuffer[80];
int Length;
if (Count > sizeof(CommandBuffer)-1) return -EINVAL;
@@ -6572,6 +6556,14 @@ static int DAC960_ProcWriteUserCommand(struct file *file,
? Count : -EBUSY);
}
static const struct file_operations dac960_user_command_proc_fops = {
.owner = THIS_MODULE,
.open = dac960_user_command_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = dac960_user_command_proc_write,
};
/*
DAC960_CreateProcEntries creates the /proc/rd/... entries for the
@@ -6586,23 +6578,17 @@ static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller)
if (DAC960_ProcDirectoryEntry == NULL) {
DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL);
StatusProcEntry = create_proc_read_entry("status", 0,
StatusProcEntry = proc_create("status", 0,
DAC960_ProcDirectoryEntry,
DAC960_ProcReadStatus, NULL);
&dac960_proc_fops);
}
sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber);
ControllerProcEntry = proc_mkdir(Controller->ControllerName,
DAC960_ProcDirectoryEntry);
create_proc_read_entry("initial_status", 0, ControllerProcEntry,
DAC960_ProcReadInitialStatus, Controller);
create_proc_read_entry("current_status", 0, ControllerProcEntry,
DAC960_ProcReadCurrentStatus, Controller);
UserCommandProcEntry =
create_proc_read_entry("user_command", S_IWUSR | S_IRUSR,
ControllerProcEntry, DAC960_ProcReadUserCommand,
Controller);
UserCommandProcEntry->write_proc = DAC960_ProcWriteUserCommand;
proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller);
proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller);
UserCommandProcEntry = proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller);
Controller->ControllerProcEntry = ControllerProcEntry;
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
#define CCISS_H
#include <linux/genhd.h>
#include <linux/mutex.h>
#include "cciss_cmd.h"
@@ -29,7 +30,7 @@ struct access_method {
};
typedef struct _drive_info_struct
{
__u32 LunID;
unsigned char LunID[8];
int usage_count;
struct request_queue *queue;
sector_t nr_blocks;
@@ -51,6 +52,7 @@ typedef struct _drive_info_struct
char vendor[VENDOR_LEN + 1]; /* SCSI vendor string */
char model[MODEL_LEN + 1]; /* SCSI model string */
char rev[REV_LEN + 1]; /* SCSI revision string */
char device_initialized; /* indicates whether dev is initialized */
} drive_info_struct;
struct ctlr_info
@@ -86,7 +88,7 @@ struct ctlr_info
BYTE cciss_read_capacity;
// information about each logical volume
drive_info_struct drv[CISS_MAX_LUN];
drive_info_struct *drv[CISS_MAX_LUN];
struct access_method access;
@@ -108,6 +110,8 @@ struct ctlr_info
int nr_frees;
int busy_configuring;
int busy_initializing;
int busy_scanning;
struct mutex busy_shutting_down;
/* This element holds the zero based queue number of the last
* queue to be started. It is used for fairness.
@@ -122,8 +126,8 @@ struct ctlr_info
/* and saved for later processing */
#endif
unsigned char alive;
struct completion *rescan_wait;
struct task_struct *cciss_scan_thread;
struct list_head scan_list;
struct completion scan_wait;
struct device dev;
};

View File

@@ -32,6 +32,7 @@
#include <linux/blkpg.h>
#include <linux/timer.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/hdreg.h>
#include <linux/spinlock.h>
@@ -177,7 +178,6 @@ static int cpqarray_register_ctlr(int ctlr, struct pci_dev *pdev);
#ifdef CONFIG_PROC_FS
static void ida_procinit(int i);
static int ida_proc_get_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data);
#else
static void ida_procinit(int i) {}
#endif
@@ -206,6 +206,7 @@ static const struct block_device_operations ida_fops = {
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_array;
static const struct file_operations ida_proc_fops;
/*
* Get us a file in /proc/array that says something about each controller.
@@ -218,19 +219,16 @@ static void __init ida_procinit(int i)
if (!proc_array) return;
}
create_proc_read_entry(hba[i]->devname, 0, proc_array,
ida_proc_get_info, hba[i]);
proc_create_data(hba[i]->devname, 0, proc_array, &ida_proc_fops, hba[i]);
}
/*
* Report information about this controller.
*/
static int ida_proc_get_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
static int ida_proc_show(struct seq_file *m, void *v)
{
off_t pos = 0;
off_t len = 0;
int size, i, ctlr;
ctlr_info_t *h = (ctlr_info_t*)data;
int i, ctlr;
ctlr_info_t *h = (ctlr_info_t*)m->private;
drv_info_t *drv;
#ifdef CPQ_PROC_PRINT_QUEUES
cmdlist_t *c;
@@ -238,7 +236,7 @@ static int ida_proc_get_info(char *buffer, char **start, off_t offset, int lengt
#endif
ctlr = h->ctlr;
size = sprintf(buffer, "%s: Compaq %s Controller\n"
seq_printf(m, "%s: Compaq %s Controller\n"
" Board ID: 0x%08lx\n"
" Firmware Revision: %c%c%c%c\n"
" Controller Sig: 0x%08lx\n"
@@ -258,55 +256,54 @@ static int ida_proc_get_info(char *buffer, char **start, off_t offset, int lengt
h->log_drives, h->phys_drives,
h->Qdepth, h->maxQsinceinit);
pos += size; len += size;
size = sprintf(buffer+len, "Logical Drive Info:\n");
pos += size; len += size;
seq_puts(m, "Logical Drive Info:\n");
for(i=0; i<h->log_drives; i++) {
drv = &h->drv[i];
size = sprintf(buffer+len, "ida/c%dd%d: blksz=%d nr_blks=%d\n",
seq_printf(m, "ida/c%dd%d: blksz=%d nr_blks=%d\n",
ctlr, i, drv->blk_size, drv->nr_blks);
pos += size; len += size;
}
#ifdef CPQ_PROC_PRINT_QUEUES
spin_lock_irqsave(IDA_LOCK(h->ctlr), flags);
size = sprintf(buffer+len, "\nCurrent Queues:\n");
pos += size; len += size;
seq_puts(m, "\nCurrent Queues:\n");
c = h->reqQ;
size = sprintf(buffer+len, "reqQ = %p", c); pos += size; len += size;
seq_printf(m, "reqQ = %p", c);
if (c) c=c->next;
while(c && c != h->reqQ) {
size = sprintf(buffer+len, "->%p", c);
pos += size; len += size;
seq_printf(m, "->%p", c);
c=c->next;
}
c = h->cmpQ;
size = sprintf(buffer+len, "\ncmpQ = %p", c); pos += size; len += size;
seq_printf(m, "\ncmpQ = %p", c);
if (c) c=c->next;
while(c && c != h->cmpQ) {
size = sprintf(buffer+len, "->%p", c);
pos += size; len += size;
seq_printf(m, "->%p", c);
c=c->next;
}
size = sprintf(buffer+len, "\n"); pos += size; len += size;
seq_putc(m, '\n');
spin_unlock_irqrestore(IDA_LOCK(h->ctlr), flags);
#endif
size = sprintf(buffer+len, "nr_allocs = %d\nnr_frees = %d\n",
seq_printf(m, "nr_allocs = %d\nnr_frees = %d\n",
h->nr_allocs, h->nr_frees);
pos += size; len += size;
*eof = 1;
*start = buffer+offset;
len -= offset;
if (len>length)
len = length;
return len;
return 0;
}
static int ida_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, ida_proc_show, PDE(inode)->data);
}
static const struct file_operations ida_proc_fops = {
.owner = THIS_MODULE,
.open = ida_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* CONFIG_PROC_FS */
module_param_array(eisa, int, NULL, 0);