pnfs: added status flags and ref count to struct pnfs_device

pnfs_device.status remembers whether a given device has been GRANTED/REVOKED

pnfs_device.layout_count tracks the number of layouts using the device, incremented by pnfs_file_device_get() and decremented by pnfs_file_device_put().  when pnfs_file_device_put() takes layout_count to 0, remove and free the device only if it's flagged as REVOKED

because pnfs_file_device_get() modifies pnfs_device.layout_count, we can no longer use a shared lock; changed pnfs_file_device.lock from SRWLOCK to CRITICAL_SECTION, and moved to pnfs_device.lock to document the fact that it's used for pnfs_device.status and pnfs_device.layout_count

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-12-01 15:06:22 -05:00
parent 2286f7a1e3
commit e3119c281e
3 changed files with 68 additions and 25 deletions

View file

@ -65,6 +65,7 @@ out:
static void layout_free(
IN pnfs_file_layout *layout)
{
if (layout->device) pnfs_file_device_put(layout->device);
free(layout->filehandles.arr);
free(layout);
}