What is it you are trying to duplicate, seeing if your file contents
have been updated or not after a panic? There is no guarentee that the
changes will have be pushed back to disk when you panic, so the contents
of the file itself are unpredictable when a panic occurs. If logging is
used, the content of the metadata that represents the file is guarenteed
to be valid. Metadata changes are tracked in the delta_map, and moved
to the log_map when a synchronous logging operation completes, not
necessarily when the file is closed.
(unless you do Yuen L. Lee wrote:
Understood! Correct me if I'm wrong here. In my understanding, the updated data block should be pushed to the filesystem and the metadata changes logged to the delta_map and then moved to the log_map after the file is closed. I have attempted to replicate the problem. Unfortunately, I'm unable to duplicate it. Here is my little testing code fragment.
. . .
#define BLKSIZE 512
. . .
unsigned char * bitmap;
int n;
unsigned char bit;
int fd;
. . .
bitmap = (char *) malloc(sizeof(char)*BLKSIZE);
if ((fd = open("/home/yl126874/image/test.img", O_WRONLY, 0)) == -1){
printf("\nOpen file fail\n");
return NULL;
}
n = read( fd, bitmap, BLKSIZE);
bit = 0x0 << 32;
bit = ~bit; /* turns on a bright spot */
for ( int i = 63; i < 70; i++) {
bitmap[i] |= bit;
}
lseek(fd, 0L, 0); /* rewind to the begginning of the
file */
write (fd, bitmap, BLKSIZE);
closed(fd);
. . .
The system crashed after my test code is executed. The first block of the
test.img was retrieved and displayed on the terminal, The bright spot was not
presented at the upper left corner. My impression is it looks like the updated
data block was never flushed to the filesystem. It contradicts my
understanding on how the lufs works: update in-core page (data) block, log
the metadata change to the delta_map, log the metadata change to log_map after
the file is closed. My test case suggests my understanding is incorrect. Can
you correct my mis-understanding on the lufs I/O mechanism? Thanks.
This message posted from opensolaris.org
_______________________________________________
ufs-discuss mailing list
[email protected]
_______________________________________________
ufs-discuss mailing list
[email protected]