Lines Matching refs:dax_dev

90 	struct dax_device *dax_dev, *found = NULL;  in dax_get_by_host()  local
100 hlist_for_each_entry(dax_dev, &dax_host_list[hash], list) { in dax_get_by_host()
101 if (!dax_alive(dax_dev) in dax_get_by_host()
102 || strcmp(host, dax_dev->host) != 0) in dax_get_by_host()
105 if (igrab(&dax_dev->inode)) in dax_get_by_host()
106 found = dax_dev; in dax_get_by_host()
123 bool generic_fsdax_supported(struct dax_device *dax_dev, in generic_fsdax_supported() argument
140 if (!dax_dev) { in generic_fsdax_supported()
159 len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn); in generic_fsdax_supported()
160 len2 = dax_direct_access(dax_dev, pgoff_end, 1, &end_kaddr, &end_pfn); in generic_fsdax_supported()
205 bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, in dax_supported() argument
211 if (!dax_dev) in dax_supported()
215 if (dax_alive(dax_dev) && dax_dev->ops->dax_supported) in dax_supported()
216 ret = dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, in dax_supported()
245 long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, in dax_direct_access() argument
250 if (!dax_dev) in dax_direct_access()
253 if (!dax_alive(dax_dev)) in dax_direct_access()
259 avail = dax_dev->ops->direct_access(dax_dev, pgoff, nr_pages, in dax_direct_access()
267 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, in dax_copy_from_iter() argument
270 if (!dax_alive(dax_dev)) in dax_copy_from_iter()
273 return dax_dev->ops->copy_from_iter(dax_dev, pgoff, addr, bytes, i); in dax_copy_from_iter()
277 size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, in dax_copy_to_iter() argument
280 if (!dax_alive(dax_dev)) in dax_copy_to_iter()
283 return dax_dev->ops->copy_to_iter(dax_dev, pgoff, addr, bytes, i); in dax_copy_to_iter()
287 int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, in dax_zero_page_range() argument
290 if (!dax_alive(dax_dev)) in dax_zero_page_range()
300 return dax_dev->ops->zero_page_range(dax_dev, pgoff, nr_pages); in dax_zero_page_range()
306 void dax_flush(struct dax_device *dax_dev, void *addr, size_t size) in dax_flush() argument
308 if (unlikely(!dax_write_cache_enabled(dax_dev))) in dax_flush()
314 void dax_flush(struct dax_device *dax_dev, void *addr, size_t size) in dax_flush() argument
320 void dax_write_cache(struct dax_device *dax_dev, bool wc) in dax_write_cache() argument
323 set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); in dax_write_cache()
325 clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); in dax_write_cache()
329 bool dax_write_cache_enabled(struct dax_device *dax_dev) in dax_write_cache_enabled() argument
331 return test_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); in dax_write_cache_enabled()
335 bool __dax_synchronous(struct dax_device *dax_dev) in __dax_synchronous() argument
337 return test_bit(DAXDEV_SYNC, &dax_dev->flags); in __dax_synchronous()
341 void __set_dax_synchronous(struct dax_device *dax_dev) in __set_dax_synchronous() argument
343 set_bit(DAXDEV_SYNC, &dax_dev->flags); in __set_dax_synchronous()
347 bool dax_alive(struct dax_device *dax_dev) in dax_alive() argument
350 return test_bit(DAXDEV_ALIVE, &dax_dev->flags); in dax_alive()
360 void kill_dax(struct dax_device *dax_dev) in kill_dax() argument
362 if (!dax_dev) in kill_dax()
365 clear_bit(DAXDEV_ALIVE, &dax_dev->flags); in kill_dax()
370 hlist_del_init(&dax_dev->list); in kill_dax()
375 void run_dax(struct dax_device *dax_dev) in run_dax() argument
377 set_bit(DAXDEV_ALIVE, &dax_dev->flags); in run_dax()
383 struct dax_device *dax_dev; in dax_alloc_inode() local
386 dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL); in dax_alloc_inode()
387 if (!dax_dev) in dax_alloc_inode()
390 inode = &dax_dev->inode; in dax_alloc_inode()
402 struct dax_device *dax_dev = to_dax_dev(inode); in dax_free_inode() local
403 kfree(dax_dev->host); in dax_free_inode()
404 dax_dev->host = NULL; in dax_free_inode()
407 kmem_cache_free(dax_cache, dax_dev); in dax_free_inode()
412 struct dax_device *dax_dev = to_dax_dev(inode); in dax_destroy_inode() local
413 WARN_ONCE(test_bit(DAXDEV_ALIVE, &dax_dev->flags), in dax_destroy_inode()
457 struct dax_device *dax_dev; in dax_dev_get() local
466 dax_dev = to_dax_dev(inode); in dax_dev_get()
468 set_bit(DAXDEV_ALIVE, &dax_dev->flags); in dax_dev_get()
469 inode->i_cdev = &dax_dev->cdev; in dax_dev_get()
476 return dax_dev; in dax_dev_get()
479 static void dax_add_host(struct dax_device *dax_dev, const char *host) in dax_add_host() argument
487 INIT_HLIST_NODE(&dax_dev->list); in dax_add_host()
488 dax_dev->host = host; in dax_add_host()
494 hlist_add_head(&dax_dev->list, &dax_host_list[hash]); in dax_add_host()
501 struct dax_device *dax_dev; in alloc_dax() local
522 dax_dev = dax_dev_get(devt); in alloc_dax()
523 if (!dax_dev) in alloc_dax()
526 dax_add_host(dax_dev, host); in alloc_dax()
527 dax_dev->ops = ops; in alloc_dax()
528 dax_dev->private = private; in alloc_dax()
530 set_dax_synchronous(dax_dev); in alloc_dax()
532 return dax_dev; in alloc_dax()
542 void put_dax(struct dax_device *dax_dev) in put_dax() argument
544 if (!dax_dev) in put_dax()
546 iput(&dax_dev->inode); in put_dax()
565 struct inode *dax_inode(struct dax_device *dax_dev) in dax_inode() argument
567 return &dax_dev->inode; in dax_inode()
571 void *dax_get_private(struct dax_device *dax_dev) in dax_get_private() argument
573 if (!test_bit(DAXDEV_ALIVE, &dax_dev->flags)) in dax_get_private()
575 return dax_dev->private; in dax_get_private()
581 struct dax_device *dax_dev = _dax_dev; in init_once() local
582 struct inode *inode = &dax_dev->inode; in init_once()
584 memset(dax_dev, 0, sizeof(*dax_dev)); in init_once()