drivers/dax/super.c
Source file repositories/reference/linux-study-clean/drivers/dax/super.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dax/super.c- Extension
.c- Size
- 17611 bytes
- Lines
- 713
- Domain
- Driver Families
- Bucket
- drivers/dax
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pagemap.hlinux/module.hlinux/mount.hlinux/pseudo_fs.hlinux/magic.hlinux/cdev.hlinux/slab.hlinux/uio.hlinux/dax.hlinux/fs.hlinux/cacheinfo.hdax-private.hbus.hlinux/blkdev.h
Detected Declarations
struct dax_deviceenum dax_device_flagsfunction dax_read_lockfunction dax_read_unlockfunction dax_add_hostfunction dax_remove_hostfunction fs_dax_get_by_bdevfunction fs_put_daxfunction fs_dax_getfunction dax_direct_accessfunction dax_copy_from_iterfunction dax_copy_to_iterfunction dax_zero_page_rangefunction dax_recovery_writefunction dax_holder_notify_failurefunction dax_flushfunction dax_flushfunction dax_write_cachefunction dax_write_cache_enabledfunction dax_synchronousfunction set_dax_synchronousfunction set_dax_nocachefunction set_dax_nomcfunction boundfunction dax_alivefunction dax_alivefunction run_daxfunction dax_free_inodefunction dax_destroy_inodefunction dax_init_fs_contextfunction dax_testfunction dax_setfunction put_daxfunction dax_holderfunction to_dax_devfunction init_oncefunction dax_fs_initfunction dax_fs_exitfunction dax_core_initfunction dax_core_exitmodule init dax_core_initexport dax_read_lockexport dax_read_unlockexport dax_add_hostexport dax_remove_hostexport fs_dax_get_by_bdevexport fs_put_daxexport fs_dax_get
Annotated Snippet
* via access_ok() in vfs_write, so use the 'no check' version to bypass
* the HARDENED_USERCOPY overhead.
*/
if (test_bit(DAXDEV_NOCACHE, &dax_dev->flags))
return _copy_from_iter_flushcache(addr, bytes, i);
return _copy_from_iter(addr, bytes, i);
}
size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
size_t bytes, struct iov_iter *i)
{
if (!dax_alive(dax_dev))
return 0;
/*
* The userspace address for the memory copy has already been validated
* via access_ok() in vfs_red, so use the 'no check' version to bypass
* the HARDENED_USERCOPY overhead.
*/
if (test_bit(DAXDEV_NOMC, &dax_dev->flags))
return _copy_mc_to_iter(addr, bytes, i);
return _copy_to_iter(addr, bytes, i);
}
int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff,
size_t nr_pages)
{
int ret;
if (!dax_alive(dax_dev))
return -ENXIO;
if (!dax_dev->ops)
return -EOPNOTSUPP;
/*
* There are no callers that want to zero more than one page as of now.
* Once users are there, this check can be removed after the
* device mapper code has been updated to split ranges across targets.
*/
if (nr_pages != 1)
return -EIO;
ret = dax_dev->ops->zero_page_range(dax_dev, pgoff, nr_pages);
return dax_mem2blk_err(ret);
}
EXPORT_SYMBOL_GPL(dax_zero_page_range);
size_t dax_recovery_write(struct dax_device *dax_dev, pgoff_t pgoff,
void *addr, size_t bytes, struct iov_iter *iter)
{
if (!dax_dev->ops || !dax_dev->ops->recovery_write)
return 0;
return dax_dev->ops->recovery_write(dax_dev, pgoff, addr, bytes, iter);
}
EXPORT_SYMBOL_GPL(dax_recovery_write);
int dax_holder_notify_failure(struct dax_device *dax_dev, u64 off,
u64 len, int mf_flags)
{
int rc, id;
id = dax_read_lock();
if (!dax_alive(dax_dev)) {
rc = -ENXIO;
goto out;
}
if (!dax_dev->holder_ops) {
rc = -EOPNOTSUPP;
goto out;
}
rc = dax_dev->holder_ops->notify_failure(dax_dev, off, len, mf_flags);
out:
dax_read_unlock(id);
return rc;
}
EXPORT_SYMBOL_GPL(dax_holder_notify_failure);
#ifdef CONFIG_ARCH_HAS_PMEM_API
void arch_wb_cache_pmem(void *addr, size_t size);
void dax_flush(struct dax_device *dax_dev, void *addr, size_t size)
{
if (unlikely(!dax_write_cache_enabled(dax_dev)))
return;
arch_wb_cache_pmem(addr, size);
}
#else
Annotation
- Immediate include surface: `linux/pagemap.h`, `linux/module.h`, `linux/mount.h`, `linux/pseudo_fs.h`, `linux/magic.h`, `linux/cdev.h`, `linux/slab.h`, `linux/uio.h`.
- Detected declarations: `struct dax_device`, `enum dax_device_flags`, `function dax_read_lock`, `function dax_read_unlock`, `function dax_add_host`, `function dax_remove_host`, `function fs_dax_get_by_bdev`, `function fs_put_dax`, `function fs_dax_get`, `function dax_direct_access`.
- Atlas domain: Driver Families / drivers/dax.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.