pnfs: revoke device info on bulk layout recall

20.3. CB_LAYOUTRECALL
"LAYOUTRECALL4_FSID and LAYOUTRECALL4_ALL specify that all the storage device ID to storage device address mappings in the affected file system(s) are also recalled."

pnfs_file_layout_recall() now takes a nfs41_client instead of just the pnfs_file_layout_list, because both the layout list and device list are accessible from nfs41_client.  for bulk recalls, calls new function pnfs_file_device_list_invalidate().  each device with layout_count=0 is removed and freed, and devices in use are flagged as REVOKED and freed when layout_count->0

layout_recall_return() now takes a pnfs_file_layout instead of pnfs_layout for access to pnfs_file_layout.device.  pnfs_layout_io_start() and pnfs_layout_io_finish() do the same, because pnfs_layout_io_finish() calls layout_recall_return().  layout_recall_return() calls pnfs_file_device_put() to release its reference on the device

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-12-02 10:32:15 -05:00
parent e3119c281e
commit 9cd9744567
5 changed files with 86 additions and 40 deletions

View file

@ -156,6 +156,37 @@ void pnfs_file_device_list_free(
free(devices);
}
void pnfs_file_device_list_invalidate(
IN struct pnfs_file_device_list *devices)
{
struct list_entry *entry, *tmp;
pnfs_file_device *device;
dprintf(FDLVL, "--> pnfs_file_device_list_invalidate()\n");
EnterCriticalSection(&devices->lock);
list_for_each_tmp(entry, tmp, &devices->head) {
device = device_entry(entry);
EnterCriticalSection(&device->device.lock);
/* if there are layouts still using the device, flag it
* as revoked and clean up on last reference */
if (device->device.layout_count) {
device->device.status |= PNFS_DEVICE_REVOKED;
LeaveCriticalSection(&device->device.lock);
} else {
LeaveCriticalSection(&device->device.lock);
/* no layouts are using it, so it's safe to free */
list_remove(entry);
file_device_free(device);
}
}
LeaveCriticalSection(&devices->lock);
dprintf(FDLVL, "<-- pnfs_file_device_list_invalidate()\n");
}
/* pnfs_file_device */
enum pnfs_status pnfs_file_device_get(