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]