Lines Matching refs:device
49 pnfs_file_device *device; in file_device_create() local
51 device = calloc(1, sizeof(pnfs_file_device)); in file_device_create()
52 if (device == NULL) { in file_device_create()
57 memcpy(device->device.deviceid, deviceid, PNFS_DEVICEID_SIZE); in file_device_create()
58 device->devices = devices; in file_device_create()
59 InitializeCriticalSection(&device->device.lock); in file_device_create()
60 *device_out = device; in file_device_create()
66 IN pnfs_file_device *device) in file_device_free() argument
68 free(device->servers.arr); in file_device_free()
69 free(device->stripes.arr); in file_device_free()
70 DeleteCriticalSection(&device->device.lock); in file_device_free()
71 free(device); in file_device_free()
78 const pnfs_file_device *device = device_entry(entry); in deviceid_compare() local
79 return memcmp(device->device.deviceid, deviceid, PNFS_DEVICEID_SIZE); in deviceid_compare()
98 pnfs_file_device *device; in file_device_find_or_create() local
99 status = file_device_create(deviceid, devices, &device); in file_device_find_or_create()
102 list_add_tail(&devices->head, &device->entry); in file_device_find_or_create()
103 *device_out = device; in file_device_find_or_create()
106 "returning new device %p\n", device); in file_device_find_or_create()
163 pnfs_file_device *device; in pnfs_file_device_list_invalidate() local
170 device = device_entry(entry); in pnfs_file_device_list_invalidate()
171 EnterCriticalSection(&device->device.lock); in pnfs_file_device_list_invalidate()
174 if (device->device.layout_count) { in pnfs_file_device_list_invalidate()
175 device->device.status |= PNFS_DEVICE_REVOKED; in pnfs_file_device_list_invalidate()
176 LeaveCriticalSection(&device->device.lock); in pnfs_file_device_list_invalidate()
178 LeaveCriticalSection(&device->device.lock); in pnfs_file_device_list_invalidate()
181 file_device_free(device); in pnfs_file_device_list_invalidate()
198 pnfs_file_device *device; in pnfs_file_device_get() local
204 status = file_device_find_or_create(deviceid, devices, &device); in pnfs_file_device_get()
208 EnterCriticalSection(&device->device.lock); in pnfs_file_device_get()
211 if (device->device.status & PNFS_DEVICE_REVOKED) in pnfs_file_device_get()
213 else if (device->device.status & PNFS_DEVICE_GRANTED) in pnfs_file_device_get()
216 nfsstat = pnfs_rpc_getdeviceinfo(session, deviceid, device); in pnfs_file_device_get()
218 device->device.status = PNFS_DEVICE_GRANTED; in pnfs_file_device_get()
222 dprint_device(FDLVL, device); in pnfs_file_device_get()
232 device->device.layout_count++; in pnfs_file_device_get()
234 device->device.layout_count); in pnfs_file_device_get()
235 *device_out = device; in pnfs_file_device_get()
238 LeaveCriticalSection(&device->device.lock); in pnfs_file_device_get()
246 IN pnfs_file_device *device) in pnfs_file_device_put() argument
249 EnterCriticalSection(&device->device.lock); in pnfs_file_device_put()
250 count = --device->device.layout_count; in pnfs_file_device_put()
254 if (count == 0 && device->device.status & PNFS_DEVICE_REVOKED) { in pnfs_file_device_put()
255 EnterCriticalSection(&device->devices->lock); in pnfs_file_device_put()
256 list_remove(&device->entry); in pnfs_file_device_put()
257 LeaveCriticalSection(&device->devices->lock); in pnfs_file_device_put()
259 LeaveCriticalSection(&device->device.lock); in pnfs_file_device_put()
261 file_device_free(device); in pnfs_file_device_put()
264 LeaveCriticalSection(&device->device.lock); in pnfs_file_device_put()