06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

verify_vol pHILE+ <strong>System</strong> <strong>Calls</strong><br />

manufacturer provides a list of such blocks with each device. They can also be<br />

detected by testing the device prior to its initialization.<br />

Failed Blocks — These are blocks that fail some time after the volume has been<br />

initialized. They are normally detected in the course of reading or writing the<br />

affected block.<br />

Dead blocks are much simpler to handle than failed blocks, because they are<br />

detected before the pHILE+ file system manager has allocated them. To handle these<br />

blocks, perform the following steps:<br />

1. Initialize the volume, taking care not to place the bitmap or FLIST onto any dead<br />

blocks (Note: blocks 2 and 3 must not be dead.)<br />

2. Mount the volume and call verify_vol(), providing a bad block list<br />

containing all dead blocks.<br />

3. Have faultp() always return status = 1 (correct fault and continue) for<br />

fdb_code == VF_BBFRE so that verify_vol() will mark the blocks as in use<br />

(note that the “bad block is marked free” error is correctable).<br />

Failed blocks are harder to handle because the block was already allocated by<br />

pHILE+ file system manager before it failed. The block may or may not contain valid<br />

data, depending on exactly when the failure occurred. However, since the block is<br />

allocated, its corresponding bit is already set. To eliminate such bad blocks,<br />

perform the following steps:<br />

1. Add the failed block to the existing list of bad blocks.<br />

2. Invoke verify_vol(), which will report VF_BBUSE, bad block is in use<br />

by a particular file.<br />

3. By whatever means, salvage as much of the file as possible, and then delete the<br />

file. This returns the bad block to the free block pool and clears its<br />

corresponding bit.<br />

4. Invoke verify_vol() again. verify_vol() now reports VF_BBFRE, “bad<br />

block is marked free”. Now have faultp() use return status = 1, to mark<br />

the bad block as unavailable for allocation.<br />

Step 3 may be complicated. For example, if a bad block occurs within a directory<br />

page, then the entire directory must be deleted after saving as much of its contents<br />

as possible.<br />

2-140 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!