mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-27 16:28:56 +00:00
stop the watchdog while merging.
This commit is contained in:
parent
7985a9310b
commit
d9b75b2fda
@ -412,15 +412,15 @@ file_end(coffee_page_t start)
|
|||||||
* are zeroes, then these are skipped from the calculation.
|
* are zeroes, then these are skipped from the calculation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(page = start + hdr.max_pages - 1; page >= start; page--) {
|
for(page = hdr.max_pages - 1; page >= 0; page--) {
|
||||||
watchdog_periodic();
|
watchdog_periodic();
|
||||||
COFFEE_READ(buf, sizeof(buf), page * COFFEE_PAGE_SIZE);
|
COFFEE_READ(buf, sizeof(buf), (start + page) * COFFEE_PAGE_SIZE);
|
||||||
for(i = COFFEE_PAGE_SIZE - 1; i >= 0; i--) {
|
for(i = COFFEE_PAGE_SIZE - 1; i >= 0; i--) {
|
||||||
if(buf[i] != 0) {
|
if(buf[i] != 0) {
|
||||||
if(page == start && i < sizeof(hdr)) {
|
if(page == 0 && i < sizeof(hdr)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1 + i + ((page - start) * COFFEE_PAGE_SIZE) - sizeof(hdr);
|
return 1 + i + (page * COFFEE_PAGE_SIZE) - sizeof(hdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,7 +544,6 @@ reserve(const char *name, coffee_page_t pages,
|
|||||||
|
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
memset(&hdr, 0, sizeof(hdr));
|
||||||
memcpy(hdr.name, name, sizeof(hdr.name) - 1);
|
memcpy(hdr.name, name, sizeof(hdr.name) - 1);
|
||||||
hdr.name[sizeof(hdr.name) - 1] = '\0';
|
|
||||||
hdr.max_pages = pages;
|
hdr.max_pages = pages;
|
||||||
hdr.flags = HDR_FLAG_ALLOCATED | flags;
|
hdr.flags = HDR_FLAG_ALLOCATED | flags;
|
||||||
write_header(&hdr, page);
|
write_header(&hdr, page);
|
||||||
@ -708,13 +707,14 @@ merge_log(coffee_page_t file_page, int extend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
watchdog_stop();
|
||||||
do {
|
do {
|
||||||
char buf[hdr.log_record_size == 0 ? COFFEE_PAGE_SIZE : hdr.log_record_size];
|
char buf[hdr.log_record_size == 0 ? COFFEE_PAGE_SIZE : hdr.log_record_size];
|
||||||
watchdog_periodic();
|
|
||||||
n = cfs_read(fd, buf, sizeof(buf));
|
n = cfs_read(fd, buf, sizeof(buf));
|
||||||
if(n < 0) {
|
if(n < 0) {
|
||||||
remove_by_page(new_file->page, 0, 0);
|
remove_by_page(new_file->page, 0, 0);
|
||||||
cfs_close(fd);
|
cfs_close(fd);
|
||||||
|
watchdog_start();
|
||||||
return -1;
|
return -1;
|
||||||
} else if(n > 0) {
|
} else if(n > 0) {
|
||||||
COFFEE_WRITE(buf, n,
|
COFFEE_WRITE(buf, n,
|
||||||
@ -722,6 +722,7 @@ merge_log(coffee_page_t file_page, int extend)
|
|||||||
offset += n;
|
offset += n;
|
||||||
}
|
}
|
||||||
} while(n != 0);
|
} while(n != 0);
|
||||||
|
watchdog_start();
|
||||||
|
|
||||||
for(i = 0; i < COFFEE_FD_SET_SIZE; i++) {
|
for(i = 0; i < COFFEE_FD_SET_SIZE; i++) {
|
||||||
if(coffee_fd_set[i].flags != COFFEE_FD_FREE &&
|
if(coffee_fd_set[i].flags != COFFEE_FD_FREE &&
|
||||||
|
Loading…
Reference in New Issue
Block a user