Commit 1e215a63 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] stram switched to private queue

        * switched to private queues
        * set ->queue
parent 50fbecd2
...@@ -978,17 +978,10 @@ static int refcnt = 0; ...@@ -978,17 +978,10 @@ static int refcnt = 0;
static void do_stram_request(request_queue_t *q) static void do_stram_request(request_queue_t *q)
{ {
void *start; while (!blk_queue_empty(q)) {
unsigned long len; struct request *req = elv_next_request(q);
void *start = swap_start + (req->sector << 9);
while (1) { unsigned long len = req->current_nr_sectors << 9;
struct request *req;
if (blk_queue_empty(QUEUE))
return;
req = CURRENT;
start = swap_start + (req->sector << 9);
len = req->current_nr_sectors << 9;
if ((start + len) > swap_end) { if ((start + len) > swap_end) {
printk( KERN_ERR "stram: bad access beyond end of device: " printk( KERN_ERR "stram: bad access beyond end of device: "
"block=%ld, count=%ld\n", "block=%ld, count=%ld\n",
...@@ -1045,6 +1038,8 @@ static struct block_device_operations stram_fops = { ...@@ -1045,6 +1038,8 @@ static struct block_device_operations stram_fops = {
}; };
static struct gendisk *stram_disk; static struct gendisk *stram_disk;
static struct request_queue stram_queue;
static spinlock_t stram_lock = SPIN_LOCK_UNLOCKED;
int __init stram_device_init(void) int __init stram_device_init(void)
{ {
...@@ -1065,10 +1060,11 @@ int __init stram_device_init(void) ...@@ -1065,10 +1060,11 @@ int __init stram_device_init(void)
return -ENXIO; return -ENXIO;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(STRAM_MAJOR), do_stram_request); blk_init_queue(&stram_queue, do_stram_request, &stram_lock);
stram_disk->major = STRAM_MAJOR; stram_disk->major = STRAM_MAJOR;
stram_disk->first_minor = STRAM_MINOR; stram_disk->first_minor = STRAM_MINOR;
stram_disk->fops = &stram_fops; stram_disk->fops = &stram_fops;
stram_disk->queue = &stram_queue;
sprintf(stram_disk->disk_name, "stram"); sprintf(stram_disk->disk_name, "stram");
set_capacity(stram_disk, (swap_end - swap_start)/512); set_capacity(stram_disk, (swap_end - swap_start)/512);
add_disk(stram_disk); add_disk(stram_disk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment