forked from luck/tmp_suning_uos_patched
a3841f94c7
* Introduce MAP_SYNC and MAP_SHARED_VALIDATE, a mechanism to enable 'userspace flush' of persistent memory updates via filesystem-dax mappings. It arranges for any filesystem metadata updates that may be required to satisfy a write fault to also be flushed ("on disk") before the kernel returns to userspace from the fault handler. Effectively every write-fault that dirties metadata completes an fsync() before returning from the fault handler. The new MAP_SHARED_VALIDATE mapping type guarantees that the MAP_SYNC flag is validated as supported by the filesystem's ->mmap() file operation. * Add support for the standard ACPI 6.2 label access methods that replace the NVDIMM_FAMILY_INTEL (vendor specific) label methods. This enables interoperability with environments that only implement the standardized methods. * Add support for the ACPI 6.2 NVDIMM media error injection methods. * Add support for the NVDIMM_FAMILY_INTEL v1.6 DIMM commands for latch last shutdown status, firmware update, SMART error injection, and SMART alarm threshold control. * Cleanup physical address information disclosures to be root-only. * Fix revalidation of the DIMM "locked label area" status to support dynamic unlock of the label area. * Expand unit test infrastructure to mock the ACPI 6.2 Translate SPA (system-physical-address) command and error injection commands. Acknowledgements that came after the commits were pushed to -next:957ac8c421
dax: fix PMD faults on zero-length files Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>a39e596baa
xfs: support for synchronous DAX faults Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>7b565c9f96
xfs: Implement xfs_filemap_pfn_mkwrite() using __xfs_filemap_fault() Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJaDfvcAAoJEB7SkWpmfYgCk7sP/2qJhBH+VTTdg2osDnhAdAhI co/AGEmsHFlUCMBb/Ek7UnMAmhBYiJU2q4ywPsNFBpusXpMlqNy5Iwo7k4/wQHE/ SJcIM0g4zg0ViFuUhwV+C2T0R5UzFR8JLd9EYWj/YS6aJpurtotm5l4UStaM0Hzo AhxSXJLrBDuqCpbOxbctfiGEmdRL7aRfBEAARTNRKBn/iXxJUcYHlp62rtXQS+t4 I6LC/URCWTNTTMGmzW6TRsgSD9WMfd19xKcGzN3qL6ee0KFccxN4ctFqHA/sFGOh iYLeR0XJUjJxyp+PkWGteXPVZL0Kj3bD/lSTG+Co5bm/ra8a/sh3TSFfgFyoBZD1 EqMN8Ryf80hGp3FabeH2Iw2SviYPZpHSWgjddjxLD0RA6OmpzINc+Wm8eqApjMME sbZDTOijiab4QMQ0XamF4GuDHyQtawv5Y/w2Ehhl1tmiqW+5tKhsKqxkQt+/V3Yt RTVSRe2Pkway66b+cD64IdQ6L2tyonPnmi5IzgkKOhlOEGomy+4/U2Jt2bMbhzq6 ymszKmXp2XI8P06wU8sHrIUeXO5I9qoKn/fZA73Eb8aIzgJe3tBE/5+Ab7RG6HB9 1OVfcMWoXU1gNgNktTs63X1Lsg4aW9kt/K4fPHHcqUcaliEJpJTlAbg9GLF2buoW nQ+0fTRgMRihE3ZA0Fs3 =h2vZ -----END PGP SIGNATURE----- Merge tag 'libnvdimm-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm Pull libnvdimm and dax updates from Dan Williams: "Save for a few late fixes, all of these commits have shipped in -next releases since before the merge window opened, and 0day has given a build success notification. The ext4 touches came from Jan, and the xfs touches have Darrick's reviewed-by. An xfstest for the MAP_SYNC feature has been through a few round of reviews and is on track to be merged. - Introduce MAP_SYNC and MAP_SHARED_VALIDATE, a mechanism to enable 'userspace flush' of persistent memory updates via filesystem-dax mappings. It arranges for any filesystem metadata updates that may be required to satisfy a write fault to also be flushed ("on disk") before the kernel returns to userspace from the fault handler. Effectively every write-fault that dirties metadata completes an fsync() before returning from the fault handler. The new MAP_SHARED_VALIDATE mapping type guarantees that the MAP_SYNC flag is validated as supported by the filesystem's ->mmap() file operation. - Add support for the standard ACPI 6.2 label access methods that replace the NVDIMM_FAMILY_INTEL (vendor specific) label methods. This enables interoperability with environments that only implement the standardized methods. - Add support for the ACPI 6.2 NVDIMM media error injection methods. - Add support for the NVDIMM_FAMILY_INTEL v1.6 DIMM commands for latch last shutdown status, firmware update, SMART error injection, and SMART alarm threshold control. - Cleanup physical address information disclosures to be root-only. - Fix revalidation of the DIMM "locked label area" status to support dynamic unlock of the label area. - Expand unit test infrastructure to mock the ACPI 6.2 Translate SPA (system-physical-address) command and error injection commands. Acknowledgements that came after the commits were pushed to -next: -957ac8c421
("dax: fix PMD faults on zero-length files"): Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> -a39e596baa
("xfs: support for synchronous DAX faults") and7b565c9f96
("xfs: Implement xfs_filemap_pfn_mkwrite() using __xfs_filemap_fault()") Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>" * tag 'libnvdimm-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (49 commits) acpi, nfit: add 'Enable Latch System Shutdown Status' command support dax: fix general protection fault in dax_alloc_inode dax: fix PMD faults on zero-length files dax: stop requiring a live device for dax_flush() brd: remove dax support dax: quiet bdev_dax_supported() fs, dax: unify IOMAP_F_DIRTY read vs write handling policy in the dax core tools/testing/nvdimm: unit test clear-error commands acpi, nfit: validate commands against the device type tools/testing/nvdimm: stricter bounds checking for error injection commands xfs: support for synchronous DAX faults xfs: Implement xfs_filemap_pfn_mkwrite() using __xfs_filemap_fault() ext4: Support for synchronous DAX faults ext4: Simplify error handling in ext4_dax_huge_fault() dax: Implement dax_finish_sync_fault() dax, iomap: Add support for synchronous faults mm: Define MAP_SYNC and VM_SYNC flags dax: Allow tuning whether dax_insert_mapping_entry() dirties entry dax: Allow dax_iomap_fault() to return pfn dax: Fix comment describing dax_iomap_fault() ...
110 lines
4.0 KiB
C
110 lines
4.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef LINUX_IOMAP_H
|
|
#define LINUX_IOMAP_H 1
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct fiemap_extent_info;
|
|
struct inode;
|
|
struct iov_iter;
|
|
struct kiocb;
|
|
struct vm_area_struct;
|
|
struct vm_fault;
|
|
|
|
/*
|
|
* Types of block ranges for iomap mappings:
|
|
*/
|
|
#define IOMAP_HOLE 0x01 /* no blocks allocated, need allocation */
|
|
#define IOMAP_DELALLOC 0x02 /* delayed allocation blocks */
|
|
#define IOMAP_MAPPED 0x03 /* blocks allocated at @addr */
|
|
#define IOMAP_UNWRITTEN 0x04 /* blocks allocated at @addr in unwritten state */
|
|
|
|
/*
|
|
* Flags for all iomap mappings:
|
|
*
|
|
* IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access
|
|
* written data and requires fdatasync to commit them to persistent storage.
|
|
*/
|
|
#define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */
|
|
#define IOMAP_F_BOUNDARY 0x02 /* mapping ends at metadata boundary */
|
|
#define IOMAP_F_DIRTY 0x04 /* uncommitted metadata */
|
|
|
|
/*
|
|
* Flags that only need to be reported for IOMAP_REPORT requests:
|
|
*/
|
|
#define IOMAP_F_MERGED 0x10 /* contains multiple blocks/extents */
|
|
#define IOMAP_F_SHARED 0x20 /* block shared with another file */
|
|
#define IOMAP_F_DATA_INLINE 0x40 /* data inline in the inode */
|
|
|
|
/*
|
|
* Magic value for addr:
|
|
*/
|
|
#define IOMAP_NULL_ADDR -1ULL /* addr is not valid */
|
|
|
|
struct iomap {
|
|
u64 addr; /* disk offset of mapping, bytes */
|
|
loff_t offset; /* file offset of mapping, bytes */
|
|
u64 length; /* length of mapping, bytes */
|
|
u16 type; /* type of mapping */
|
|
u16 flags; /* flags for mapping */
|
|
struct block_device *bdev; /* block device for I/O */
|
|
struct dax_device *dax_dev; /* dax_dev for dax operations */
|
|
};
|
|
|
|
/*
|
|
* Flags for iomap_begin / iomap_end. No flag implies a read.
|
|
*/
|
|
#define IOMAP_WRITE (1 << 0) /* writing, must allocate blocks */
|
|
#define IOMAP_ZERO (1 << 1) /* zeroing operation, may skip holes */
|
|
#define IOMAP_REPORT (1 << 2) /* report extent status, e.g. FIEMAP */
|
|
#define IOMAP_FAULT (1 << 3) /* mapping for page fault */
|
|
#define IOMAP_DIRECT (1 << 4) /* direct I/O */
|
|
#define IOMAP_NOWAIT (1 << 5) /* Don't wait for writeback */
|
|
|
|
struct iomap_ops {
|
|
/*
|
|
* Return the existing mapping at pos, or reserve space starting at
|
|
* pos for up to length, as long as we can do it as a single mapping.
|
|
* The actual length is returned in iomap->length.
|
|
*/
|
|
int (*iomap_begin)(struct inode *inode, loff_t pos, loff_t length,
|
|
unsigned flags, struct iomap *iomap);
|
|
|
|
/*
|
|
* Commit and/or unreserve space previous allocated using iomap_begin.
|
|
* Written indicates the length of the successful write operation which
|
|
* needs to be commited, while the rest needs to be unreserved.
|
|
* Written might be zero if no data was written.
|
|
*/
|
|
int (*iomap_end)(struct inode *inode, loff_t pos, loff_t length,
|
|
ssize_t written, unsigned flags, struct iomap *iomap);
|
|
};
|
|
|
|
ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
|
|
const struct iomap_ops *ops);
|
|
int iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len,
|
|
const struct iomap_ops *ops);
|
|
int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
|
|
bool *did_zero, const struct iomap_ops *ops);
|
|
int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
|
|
const struct iomap_ops *ops);
|
|
int iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops);
|
|
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
|
loff_t start, loff_t len, const struct iomap_ops *ops);
|
|
loff_t iomap_seek_hole(struct inode *inode, loff_t offset,
|
|
const struct iomap_ops *ops);
|
|
loff_t iomap_seek_data(struct inode *inode, loff_t offset,
|
|
const struct iomap_ops *ops);
|
|
|
|
/*
|
|
* Flags for direct I/O ->end_io:
|
|
*/
|
|
#define IOMAP_DIO_UNWRITTEN (1 << 0) /* covers unwritten extent(s) */
|
|
#define IOMAP_DIO_COW (1 << 1) /* covers COW extent(s) */
|
|
typedef int (iomap_dio_end_io_t)(struct kiocb *iocb, ssize_t ret,
|
|
unsigned flags);
|
|
ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
|
|
const struct iomap_ops *ops, iomap_dio_end_io_t end_io);
|
|
|
|
#endif /* LINUX_IOMAP_H */
|