pnfs: xdr for CB_NOTIFY_DEVICEID

calls stub function pnfs_file_device_notify() for each deviceid

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-06-16 12:33:39 -04:00 committed by unknown
parent c570ba2383
commit 98dc722ccc
6 changed files with 172 additions and 7 deletions

View file

@ -26,6 +26,7 @@
#include <stdio.h>
#include "nfs41_ops.h"
#include "nfs41_callback.h"
#include "daemon_debug.h"
@ -420,3 +421,44 @@ enum pnfs_status pnfs_file_device_io_unit(
io->length = pattern->offset_end - offset;
return status;
}
/* CB_NOTIFY_DEVICEID */
enum pnfs_status pnfs_file_device_notify(
IN struct pnfs_file_device_list *devices,
IN const struct notify_deviceid4 *change)
{
struct list_entry *entry;
enum pnfs_status status = PNFSERR_NO_DEVICE;
dprintf(FDLVL, "--> pnfs_file_device_notify(%u, %0llX:%0llX)\n",
change->type, change->deviceid);
if (change->layouttype != PNFS_LAYOUTTYPE_FILE) {
status = PNFSERR_NOT_SUPPORTED;
goto out;
}
EnterCriticalSection(&devices->lock);
entry = list_search(&devices->head, change->deviceid, deviceid_compare);
if (entry) {
dprintf(FDLVL, "found file device %p\n", device_entry(entry));
if (change->type == NOTIFY_DEVICEID4_CHANGE) {
/* if (change->immediate) ... */
dprintf(FDLVL, "CHANGE (%u)\n", change->immediate);
} else if (change->type == NOTIFY_DEVICEID4_DELETE) {
/* This notification MUST NOT be sent if the client
* has a layout that refers to the device ID. */
dprintf(FDLVL, "DELETE\n");
}
status = PNFS_SUCCESS;
}
LeaveCriticalSection(&devices->lock);
out:
dprintf(FDLVL, "<-- pnfs_file_device_notify() returning %s\n",
pnfs_error_string(status));
return status;
}