Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-14239-914332
进击のOS-os
Commits
ef147b31
Commit
ef147b31
authored
3 years ago
by
某某某
Browse files
Options
Download
Patches
Plain Diff
read
parent
b1f89ff8
master
address_space_1
elf-pagecache
page_buffer_cache
page_frame_reclaiming
submit
swap_1
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/bio.h
+7
-0
include/bio.h
src/fs/bio.c
+44
-0
src/fs/bio.c
src/fs/mpage.c
+1
-1
src/fs/mpage.c
with
52 additions
and
1 deletion
+52
-1
include/
fs/
bio.h
→
include/bio.h
+
7
−
0
View file @
ef147b31
...
...
@@ -11,6 +11,7 @@
struct
bio
{
struct
bio_vec
*
bi_io_vec
;
uint8
bi_rw
;
struct
bio
*
next
;
};
...
...
@@ -24,3 +25,9 @@ struct bio_vec {
struct
bio_vec
*
next
;
/* the pointer of next bio segment */
void
*
buff
;
/* the address to begin read/write */
};
struct
request_queue
{
struct
bio
*
queue_head
;
spinlock_t
rq_lock
;
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/fs/bio.c
+
44
−
0
View file @
ef147b31
...
...
@@ -22,6 +22,7 @@
#include
"defs.h"
#include
"fs/fs.h"
#include
"fs/blk_device.h"
#include
"bio.h"
#ifdef K210
extern
uint8_t
sd_read_sector_dma
(
uint8_t
*
data_buff
,
uint32_t
sector
,
uint32_t
count
);
...
...
@@ -200,3 +201,46 @@ bunpin(struct buf *b) {
}
/*************************new add func**************************/
struct
request_queue
rq
=
{.
queue_head
=
NULL
};
void
submit_bio
(
uint8
rw
,
struct
bio
*
bio
){
acquire
(
&
rq
.
rq_lock
);
bio
->
next
=
rq
.
queue_head
;
rq
.
queue_head
=
bio
;
make_request
(
rw
);
release
(
&
rq
.
rq_lock
);
}
void
make_request
(
uint8
rw
){
struct
bio
*
cur_bio
;
struct
bio_vec
*
cur_bio_vec
;
cur_bio
=
rq
.
queue_head
;
while
(
cur_bio
){
cur_bio_vec
=
cur_bio
->
bi_io_vec
;
/* 对于一次请求的每个段 */
while
(
cur_bio_vec
){
for
(
int
i
=
0
;
i
<
cur_bio_vec
->
count
;
i
++
){
#if defined K210
panic
(
"make_request: not implementation!"
);
#elif defined QEMU
struct
buf
*
b
;
b
->
blockno
=
cur_bio_vec
->
bv_start_num
+
i
;
b
->
data
=
cur_bio_vec
->
buff
+
i
*
BSIZE
;
virtio_disk_rw
(
b
,
rw
);)
#else
panic
(
"no defined platform"
);
#endif
}
cur_bio_vec
=
cur_bio_vec
->
next
;
}
cur_bio
=
cur_bio
->
next
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/fs/mpage.c
+
1
−
1
View file @
ef147b31
...
...
@@ -31,7 +31,7 @@ int readpage(entry_t *entry, uint64 buff, uint32 flpgnum){
struct
bio
*
bio
=
do_readpage
(
entry
,
buff
,
flpgnum
);
if
(
bio
)
submit_bio
(
bio
);
submit_bio
(
READ
,
bio
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets