git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
laying out the iso9660 structure definitions
[lunaix-os.git]
/
lunaix-os
/
kernel
/
fs
/
pcache.c
diff --git
a/lunaix-os/kernel/fs/pcache.c
b/lunaix-os/kernel/fs/pcache.c
index 9d883f90485402f702617dbd8a721040315d925b..c27f78ba6bf8282139c0f487eb761acb4e456f9d 100644
(file)
--- a/
lunaix-os/kernel/fs/pcache.c
+++ b/
lunaix-os/kernel/fs/pcache.c
@@
-76,7
+76,7
@@
pcache_set_dirty(struct pcache* pcache, struct pcache_pg* pg)
}
}
}
}
-struct pcache_pg*
+int
pcache_get_page(struct pcache* pcache,
uint32_t index,
uint32_t* offset,
pcache_get_page(struct pcache* pcache,
uint32_t index,
uint32_t* offset,
@@
-137,10
+137,10
@@
pcache_read(struct v_inode* inode, void* data, uint32_t len, uint32_t fpos)
}
// Filling up the page
}
// Filling up the page
- errno = inode->default_fops
.
read(inode, pg->pg, PG_SIZE, pg->fpos);
+ errno = inode->default_fops
->
read(inode, pg->pg, PG_SIZE, pg->fpos);
if (errno >= 0 && errno < PG_SIZE) {
// EOF
if (errno >= 0 && errno < PG_SIZE) {
// EOF
- len =
buf_off + errno
;
+ len =
MIN(len, buf_off + errno)
;
} else if (errno < 0) {
break;
}
} else if (errno < 0) {
break;
}
@@
-175,7
+175,8
@@
pcache_commit(struct v_inode* inode, struct pcache_pg* page)
return;
}
return;
}
- int errno = inode->default_fops.write(inode, page->pg, PG_SIZE, page->fpos);
+ int errno =
+ inode->default_fops->write(inode, page->pg, PG_SIZE, page->fpos);
if (!errno) {
page->flags &= ~PCACHE_DIRTY;
if (!errno) {
page->flags &= ~PCACHE_DIRTY;
@@
-189,6
+190,10
@@
pcache_commit(struct v_inode* inode, struct pcache_pg* page)
void
pcache_commit_all(struct v_inode* inode)
{
void
pcache_commit_all(struct v_inode* inode)
{
+ if (!inode->pg_cache) {
+ return;
+ }
+
struct pcache* cache = inode->pg_cache;
struct pcache_pg *pos, *n;
struct pcache* cache = inode->pg_cache;
struct pcache_pg *pos, *n;