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
Kirill Smelkov
linux
Commits
3b57ec8d
Commit
3b57ec8d
authored
Apr 24, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Apr 24, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] (5/15) big struct block_device * push (first series)
- switch blk_{get,set}_readahead() to struct block_device *
parent
7290bad4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
14 deletions
+18
-14
drivers/block/blkpg.c
drivers/block/blkpg.c
+2
-2
drivers/block/ll_rw_blk.c
drivers/block/ll_rw_blk.c
+8
-5
drivers/md/md.c
drivers/md/md.c
+1
-1
include/linux/blkdev.h
include/linux/blkdev.h
+2
-2
mm/readahead.c
mm/readahead.c
+5
-4
No files found.
drivers/block/blkpg.c
View file @
3b57ec8d
...
...
@@ -240,13 +240,13 @@ int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg)
case
BLKFRASET
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EACCES
;
return
blk_set_readahead
(
dev
,
arg
);
return
blk_set_readahead
(
b
dev
,
arg
);
case
BLKRAGET
:
case
BLKFRAGET
:
if
(
!
arg
)
return
-
EINVAL
;
return
put_user
(
blk_get_readahead
(
dev
),
(
long
*
)
arg
);
return
put_user
(
blk_get_readahead
(
b
dev
),
(
long
*
)
arg
);
case
BLKSECTGET
:
if
((
q
=
blk_get_queue
(
dev
))
==
NULL
)
...
...
drivers/block/ll_rw_blk.c
View file @
3b57ec8d
...
...
@@ -115,13 +115,14 @@ inline request_queue_t *blk_get_queue(kdev_t dev)
*
* Returns zero on success, else negative errno
*/
int
blk_set_readahead
(
kdev_t
dev
,
unsigned
sectors
)
int
blk_set_readahead
(
struct
block_device
*
b
dev
,
unsigned
sectors
)
{
int
ret
=
-
EINVAL
;
request_queue_t
*
q
=
blk_get_queue
(
dev
);
request_queue_t
*
q
=
blk_get_queue
(
to_kdev_t
(
bdev
->
bd_dev
)
);
if
(
q
)
{
q
->
ra_sectors
=
sectors
;
blk_put_queue
(
q
);
ret
=
0
;
}
return
ret
;
...
...
@@ -139,13 +140,15 @@ int blk_set_readahead(kdev_t dev, unsigned sectors)
* Will return zero if the queue has never had its readahead
* setting altered.
*/
unsigned
blk_get_readahead
(
kdev_t
dev
)
unsigned
blk_get_readahead
(
struct
block_device
*
b
dev
)
{
unsigned
ret
=
0
;
request_queue_t
*
q
=
blk_get_queue
(
dev
);
request_queue_t
*
q
=
blk_get_queue
(
to_kdev_t
(
bdev
->
bd_dev
)
);
if
(
q
)
if
(
q
)
{
ret
=
q
->
ra_sectors
;
blk_put_queue
(
q
);
}
return
ret
;
}
...
...
drivers/md/md.c
View file @
3b57ec8d
...
...
@@ -1577,7 +1577,7 @@ static int device_size_calculation(mddev_t * mddev)
if
(
!
md_size
[
mdidx
(
mddev
)])
md_size
[
mdidx
(
mddev
)]
=
sb
->
size
*
data_disks
;
readahead
=
(
blk_get_readahead
(
rdev
->
dev
)
*
512
)
/
PAGE_SIZE
;
readahead
=
(
blk_get_readahead
(
rdev
->
b
dev
)
*
512
)
/
PAGE_SIZE
;
if
(
!
sb
->
level
||
(
sb
->
level
==
4
)
||
(
sb
->
level
==
5
))
{
readahead
=
(
mddev
->
sb
->
chunk_size
>>
PAGE_SHIFT
)
*
4
*
data_disks
;
if
(
readahead
<
data_disks
*
(
MAX_SECTORS
>>
(
PAGE_SHIFT
-
9
))
*
2
)
...
...
include/linux/blkdev.h
View file @
3b57ec8d
...
...
@@ -314,8 +314,8 @@ extern void blk_queue_hardsect_size(request_queue_t *q, unsigned short);
extern
void
blk_queue_segment_boundary
(
request_queue_t
*
q
,
unsigned
long
);
extern
void
blk_queue_assign_lock
(
request_queue_t
*
q
,
spinlock_t
*
);
extern
void
blk_queue_prep_rq
(
request_queue_t
*
q
,
prep_rq_fn
*
pfn
);
extern
int
blk_set_readahead
(
kdev_t
dev
,
unsigned
sectors
);
extern
unsigned
blk_get_readahead
(
kdev_t
dev
);
extern
int
blk_set_readahead
(
struct
block_device
*
b
dev
,
unsigned
sectors
);
extern
unsigned
blk_get_readahead
(
struct
block_device
*
b
dev
);
extern
int
blk_rq_map_sg
(
request_queue_t
*
,
struct
request
*
,
struct
scatterlist
*
);
extern
void
blk_dump_rq_flags
(
struct
request
*
,
char
*
);
...
...
mm/readahead.c
View file @
3b57ec8d
...
...
@@ -35,10 +35,11 @@ static int get_max_readahead(struct inode *inode)
{
unsigned
blk_ra_kbytes
=
0
;
blk_ra_kbytes
=
blk_get_readahead
(
inode
->
i_dev
)
/
2
;
if
(
blk_ra_kbytes
<
VM_MIN_READAHEAD
)
blk_ra_kbytes
=
VM_MAX_READAHEAD
;
if
(
inode
->
i_sb
->
s_bdev
)
{
blk_ra_kbytes
=
blk_get_readahead
(
inode
->
i_sb
->
s_bdev
)
/
2
;
if
(
blk_ra_kbytes
<
VM_MIN_READAHEAD
)
blk_ra_kbytes
=
VM_MAX_READAHEAD
;
}
return
blk_ra_kbytes
>>
(
PAGE_CACHE_SHIFT
-
10
);
}
...
...
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