Lines Matching refs:dax_dev
69 bool __generic_fsdax_supported(struct dax_device *dax_dev, in __generic_fsdax_supported() argument
104 len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn); in __generic_fsdax_supported()
105 len2 = dax_direct_access(dax_dev, pgoff_end, 1, &end_kaddr, &end_pfn); in __generic_fsdax_supported()
162 struct dax_device *dax_dev; in __bdev_dax_supported() local
175 dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); in __bdev_dax_supported()
176 if (!dax_dev) { in __bdev_dax_supported()
183 ret = dax_supported(dax_dev, bdev, blocksize, 0, in __bdev_dax_supported()
187 put_dax(dax_dev); in __bdev_dax_supported()
224 struct dax_device *dax_dev = dax_get_by_host(dev_name(dev)); in write_cache_show() local
227 WARN_ON_ONCE(!dax_dev); in write_cache_show()
228 if (!dax_dev) in write_cache_show()
231 rc = sprintf(buf, "%d\n", !!dax_write_cache_enabled(dax_dev)); in write_cache_show()
232 put_dax(dax_dev); in write_cache_show()
241 struct dax_device *dax_dev = dax_get_by_host(dev_name(dev)); in write_cache_store() local
243 WARN_ON_ONCE(!dax_dev); in write_cache_store()
244 if (!dax_dev) in write_cache_store()
250 dax_write_cache(dax_dev, write_cache); in write_cache_store()
252 put_dax(dax_dev); in write_cache_store()
260 struct dax_device *dax_dev = dax_get_by_host(dev_name(dev)); in dax_visible() local
262 WARN_ON_ONCE(!dax_dev); in dax_visible()
263 if (!dax_dev) in dax_visible()
296 long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, in dax_direct_access() argument
301 if (!dax_dev) in dax_direct_access()
304 if (!dax_alive(dax_dev)) in dax_direct_access()
310 avail = dax_dev->ops->direct_access(dax_dev, pgoff, nr_pages, in dax_direct_access()
318 bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, in dax_supported() argument
321 if (!dax_alive(dax_dev)) in dax_supported()
324 return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len); in dax_supported()
327 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, in dax_copy_from_iter() argument
330 if (!dax_alive(dax_dev)) in dax_copy_from_iter()
333 return dax_dev->ops->copy_from_iter(dax_dev, pgoff, addr, bytes, i); in dax_copy_from_iter()
337 size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, in dax_copy_to_iter() argument
340 if (!dax_alive(dax_dev)) in dax_copy_to_iter()
343 return dax_dev->ops->copy_to_iter(dax_dev, pgoff, addr, bytes, i); in dax_copy_to_iter()
349 void dax_flush(struct dax_device *dax_dev, void *addr, size_t size) in dax_flush() argument
351 if (unlikely(!dax_write_cache_enabled(dax_dev))) in dax_flush()
357 void dax_flush(struct dax_device *dax_dev, void *addr, size_t size) in dax_flush() argument
363 void dax_write_cache(struct dax_device *dax_dev, bool wc) in dax_write_cache() argument
366 set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); in dax_write_cache()
368 clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); in dax_write_cache()
372 bool dax_write_cache_enabled(struct dax_device *dax_dev) in dax_write_cache_enabled() argument
374 return test_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); in dax_write_cache_enabled()
378 bool __dax_synchronous(struct dax_device *dax_dev) in __dax_synchronous() argument
380 return test_bit(DAXDEV_SYNC, &dax_dev->flags); in __dax_synchronous()
384 void __set_dax_synchronous(struct dax_device *dax_dev) in __set_dax_synchronous() argument
386 set_bit(DAXDEV_SYNC, &dax_dev->flags); in __set_dax_synchronous()
390 bool dax_alive(struct dax_device *dax_dev) in dax_alive() argument
393 return test_bit(DAXDEV_ALIVE, &dax_dev->flags); in dax_alive()
408 void kill_dax(struct dax_device *dax_dev) in kill_dax() argument
410 if (!dax_dev) in kill_dax()
413 clear_bit(DAXDEV_ALIVE, &dax_dev->flags); in kill_dax()
418 hlist_del_init(&dax_dev->list); in kill_dax()
423 void run_dax(struct dax_device *dax_dev) in run_dax() argument
425 set_bit(DAXDEV_ALIVE, &dax_dev->flags); in run_dax()
431 struct dax_device *dax_dev; in dax_alloc_inode() local
434 dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL); in dax_alloc_inode()
435 if (!dax_dev) in dax_alloc_inode()
438 inode = &dax_dev->inode; in dax_alloc_inode()
450 struct dax_device *dax_dev = to_dax_dev(inode); in dax_free_inode() local
451 kfree(dax_dev->host); in dax_free_inode()
452 dax_dev->host = NULL; in dax_free_inode()
455 kmem_cache_free(dax_cache, dax_dev); in dax_free_inode()
460 struct dax_device *dax_dev = to_dax_dev(inode); in dax_destroy_inode() local
461 WARN_ONCE(test_bit(DAXDEV_ALIVE, &dax_dev->flags), in dax_destroy_inode()
505 struct dax_device *dax_dev; in dax_dev_get() local
514 dax_dev = to_dax_dev(inode); in dax_dev_get()
516 set_bit(DAXDEV_ALIVE, &dax_dev->flags); in dax_dev_get()
517 inode->i_cdev = &dax_dev->cdev; in dax_dev_get()
524 return dax_dev; in dax_dev_get()
527 static void dax_add_host(struct dax_device *dax_dev, const char *host) in dax_add_host() argument
535 INIT_HLIST_NODE(&dax_dev->list); in dax_add_host()
536 dax_dev->host = host; in dax_add_host()
542 hlist_add_head(&dax_dev->list, &dax_host_list[hash]); in dax_add_host()
549 struct dax_device *dax_dev; in alloc_dax() local
563 dax_dev = dax_dev_get(devt); in alloc_dax()
564 if (!dax_dev) in alloc_dax()
567 dax_add_host(dax_dev, host); in alloc_dax()
568 dax_dev->ops = ops; in alloc_dax()
569 dax_dev->private = private; in alloc_dax()
571 set_dax_synchronous(dax_dev); in alloc_dax()
573 return dax_dev; in alloc_dax()
583 void put_dax(struct dax_device *dax_dev) in put_dax() argument
585 if (!dax_dev) in put_dax()
587 iput(&dax_dev->inode); in put_dax()
597 struct dax_device *dax_dev, *found = NULL; in dax_get_by_host() local
607 hlist_for_each_entry(dax_dev, &dax_host_list[hash], list) { in dax_get_by_host()
608 if (!dax_alive(dax_dev) in dax_get_by_host()
609 || strcmp(host, dax_dev->host) != 0) in dax_get_by_host()
612 if (igrab(&dax_dev->inode)) in dax_get_by_host()
613 found = dax_dev; in dax_get_by_host()
638 struct inode *dax_inode(struct dax_device *dax_dev) in dax_inode() argument
640 return &dax_dev->inode; in dax_inode()
644 void *dax_get_private(struct dax_device *dax_dev) in dax_get_private() argument
646 if (!test_bit(DAXDEV_ALIVE, &dax_dev->flags)) in dax_get_private()
648 return dax_dev->private; in dax_get_private()
654 struct dax_device *dax_dev = _dax_dev; in init_once() local
655 struct inode *inode = &dax_dev->inode; in init_once()
657 memset(dax_dev, 0, sizeof(*dax_dev)); in init_once()