This procedure is called by “itrunc” (7435, 7438, 7442) to reinsert a simple storage block into the available list for a device.
It is not clear why the “s_fmod” flag is set here as well as at the end of the procedure (line 7026). Any suggestions?
Observe the locking protocol;
If no free blocks previously existed for the device, restore the situation by setting up a one element list containing an entry for block #0. This value will subsequently be interpreted as an “end of list” sentinel;
If the available list in the “super block” is already full, it is time to write it out onto the FSV. Set “s_flock”;
Get a buffer, associated with the block now being entered in the free list;
Copy the contents of the super block list, preceded by a count of the number of valid blocks, into the buffer; write the buffer; unset the lock and “wakeup” anybody waiting,
Add the returned block to the available list.