On Mon, 10 Apr 2006, LiBei wrote:
Hello,
I mapped a file to the memory, then copy n chars to this memory.
This should invoke ufs_putpage and the third arg 'len' should be n. However I
found the len is not n but 0. I don't know why the len is 0.
If the code is like below:
char* src;
char buff[] = "Hello";
...
src=mmap(fd, size, ...);
for(i=0; i<sizeof(buff); i++)
src[i] = buff[i];
when the ufs_putpage is called?
When the framework considers it the right time to do so. That is:
- when the page scanner next passes over the page
- when you explicitly call msync()
- when something else happens that causes a filesystem instance
to flush cached data (many conditions cause this)
len == 0 is a specific value - it means "everything". It's up to the
filesystem implementation to be able to identify what parts of a file
actually need writing out if "all" is requested. I.e. the ability to pass
len == 0 makes life easier for consumers of VOP_PUTPAGE().
Best wishes,
FrankH.
_______________________________________________
ufs-discuss mailing list
[email protected]