Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c14f2880
Commit
c14f2880
authored
Oct 28, 2002
by
Alexander Viro
Committed by
James Bottomley
Oct 28, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] z2ram
* switched to private queues * set ->queue * cleaned up
parent
624a75e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
49 deletions
+33
-49
drivers/block/z2ram.c
drivers/block/z2ram.c
+33
-49
No files found.
drivers/block/z2ram.c
View file @
c14f2880
...
...
@@ -73,54 +73,35 @@ static spinlock_t z2ram_lock = SPIN_LOCK_UNLOCKED;
static
struct
block_device_operations
z2_fops
;
static
struct
gendisk
*
z2ram_gendisk
;
static
void
do_z2_request
(
request_queue_t
*
q
)
static
void
do_z2_request
(
request_queue_t
*
q
)
{
u_long
start
,
len
,
addr
,
size
;
while
(
TRUE
)
{
if
(
blk_queue_empty
(
QUEUE
))
return
;
start
=
CURRENT
->
sector
<<
9
;
len
=
CURRENT
->
current_nr_sectors
<<
9
;
while
(
!
blk_queue_empty
(
q
))
{
struct
request
*
req
=
elv_next_request
(
q
);
unsigned
long
start
=
req
->
sector
<<
9
;
unsigned
long
len
=
req
->
current_nr_sectors
<<
9
;
if
(
(
start
+
len
)
>
z2ram_size
)
{
if
(
start
+
len
>
z2ram_size
)
{
printk
(
KERN_ERR
DEVICE_NAME
": bad access: block=%lu, count=%u
\n
"
,
CURRENT
->
sector
,
CURRENT
->
current_nr_sectors
);
end_request
(
CURRENT
,
FALSE
);
continue
;
}
if
(
(
rq_data_dir
(
CURRENT
)
!=
READ
)
&&
(
rq_data_dir
(
CURRENT
)
!=
WRITE
)
)
{
printk
(
KERN_ERR
DEVICE_NAME
": bad command: %ld
\n
"
,
rq_data_dir
(
CURRENT
)
);
end_request
(
CURRENT
,
FALSE
);
req
->
sector
,
req
->
current_nr_sectors
);
end_request
(
req
,
0
);
continue
;
}
while
(
len
)
{
addr
=
start
&
Z2RAM_CHUNKMASK
;
size
=
Z2RAM_CHUNKSIZE
-
addr
;
if
(
len
<
size
)
while
(
len
)
{
unsigned
long
addr
=
start
&
Z2RAM_CHUNKMASK
;
unsigned
long
size
=
Z2RAM_CHUNKSIZE
-
addr
;
if
(
len
<
size
)
size
=
len
;
addr
+=
z2ram_map
[
start
>>
Z2RAM_CHUNKSHIFT
];
if
(
rq_data_dir
(
CURRENT
)
==
READ
)
memcpy
(
CURRENT
->
buffer
,
(
char
*
)
addr
,
size
);
if
(
rq_data_dir
(
req
)
==
READ
)
memcpy
(
req
->
buffer
,
(
char
*
)
addr
,
size
);
else
memcpy
(
(
char
*
)
addr
,
CURRENT
->
buffer
,
size
);
memcpy
((
char
*
)
addr
,
req
->
buffer
,
size
);
start
+=
size
;
len
-=
size
;
}
end_request
(
CURRENT
,
TRUE
);
end_request
(
req
,
1
);
}
}
...
...
@@ -351,6 +332,8 @@ static struct gendisk *z2_find(dev_t dev, int *part, void *data)
return
get_disk
(
z2ram_gendisk
);
}
static
struct
request_queue
z2_queue
;
int
__init
z2_init
(
void
)
{
...
...
@@ -374,7 +357,8 @@ z2_init( void )
z2ram_gendisk
->
fops
=
&
z2_fops
;
sprintf
(
z2ram_gendisk
->
disk_name
,
"z2ram"
);
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_z2_request
,
&
z2ram_lock
);
blk_init_queue
(
&
z2_queue
,
do_z2_request
,
&
z2ram_lock
);
z2ram_gendisk
->
queue
=
&
z2_queue
;
add_disk
(
z2ram_gendisk
);
blk_register_region
(
MKDEV
(
MAJOR_NR
,
0
),
Z2MINOR_COUNT
,
THIS_MODULE
,
z2_find
,
NULL
,
NULL
);
...
...
@@ -410,7 +394,7 @@ cleanup_module( void )
del_gendisk
(
z2ram_gendisk
);
put_disk
(
z2ram_gendisk
);
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
)
);
blk_cleanup_queue
(
&
z2_queue
);
if
(
current_device
!=
-
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment