Subject: vfs advice needed!
To: None <>
From: Reinoud Zandijk <>
List: tech-kern
Date: 10/25/2007 17:38:28
Hi folks,

i've been battling with vfs in my UDF implementation. As in FFS, UDF can 
store file/directory contents for small files inside the node on disc in 
the space where normally the block pointers are located.

The problem now arises when i need to grow the node beyond the maximum 
internal space on a write and i need to evacuate the data into the cache. 

One method i tried was to allocate some memory, copy the contents to 
preserve into it and then when the node was converted, write the preserved 
contents with vn_rdwr() on the node, wich calls VOP_WRITE() again and uses 
the ubc to update the data; it then returns to the origional VOP_WRITE() 
that then adds the rest of the data... conceptually it should work but it 
doesn't. When i read the data back later on it is mostly zero(!) i.e. some 
vm page stuff is going wrong in (prolly) genfs and only the appended data 
is visible. First i thought it was an uvm_vnp_setsize() issue but that 
turned out to be not the case. Calling uvm_vnp_setsize(oldsize) before the 
vn_rdwr() does have the effect that most is preserved(!) but not all... 
could it be a race condition? should i hold a lock? or specify an IO_ flag 
to vn_rdwr() ?

With regards,