From 07c50cc200f4bd24429ec24acdf1295fe244d667 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Tue, 17 Feb 2009 18:50:29 +0000 Subject: [PATCH] corrected file cache status checks in previous commit. --- core/cfs/cfs-coffee.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/cfs/cfs-coffee.c b/core/cfs/cfs-coffee.c index 47d63bb72..71bf1f063 100644 --- a/core/cfs/cfs-coffee.c +++ b/core/cfs/cfs-coffee.c @@ -286,7 +286,7 @@ load_file(const char *name, struct file_header *hdr, coffee_page_t start) struct file *file; /* - * We prefer to overwrite a free slot since unreferences ones + * We prefer to overwrite a free slot since unreferenced ones * contain usable data. Free slots are designated by the page * value INVALID_PAGE. */ @@ -325,7 +325,7 @@ find_file(const char *name) /* First check if the file metadata is cached. */ for(i = 0; i < COFFEE_MAX_OPEN_FILES; i++) { - if(coffee_files[i].page == INVALID_PAGE) { + if(coffee_files[i].max_pages == 0) { continue; } @@ -506,6 +506,7 @@ remove_by_page(coffee_page_t page, int remove_log, int close_fds) if(last_valid >= 0) { coffee_fd_set[last_valid].file->page = INVALID_PAGE; + coffee_fd_set[last_valid].file->references = 0; } } @@ -1014,7 +1015,6 @@ cfs_read(int fd, void *buf, unsigned size) fdp = &coffee_fd_set[fd]; file = fdp->file; - if(fdp->offset + size > file->end) { size = file->end - fdp->offset; }