@@ -3208,21 +3208,19 @@ static inline bool io_is_direct(struct file *filp)
static inline bool vma_is_dax(struct vm_area_struct *vma)
{
- return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
+ struct inode *inode;
+
+ if (!vma->vm_file)
+ return false;
+ inode = file_inode(vma->vm_file);
+ return IS_FSDAX(inode) || IS_DEVDAX(inode);
}
static inline bool vma_is_fsdax(struct vm_area_struct *vma)
{
- struct inode *inode;
-
if (!vma->vm_file)
return false;
- if (!vma_is_dax(vma))
- return false;
- inode = file_inode(vma->vm_file);
- if (S_ISCHR(inode->i_mode))
- return false; /* device-dax */
- return true;
+ return IS_FSDAX(file_inode(vma->vm_file));
}
static inline int iocb_flags(struct file *file)
@@ -55,7 +55,8 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
bdi = inode_to_bdi(mapping->host);
- if (IS_DAX(inode) || (bdi == &noop_backing_dev_info)) {
+ if (IS_FSDAX(inode) || IS_DEVDAX(inode)
+ || (bdi == &noop_backing_dev_info)) {
switch (advice) {
case POSIX_FADV_NORMAL:
case POSIX_FADV_RANDOM:
@@ -2357,7 +2357,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
* DAX files, so don't bother trying.
*/
if (retval < 0 || !count || iocb->ki_pos >= size ||
- IS_DAX(inode))
+ IS_FSDAX(inode))
goto out;
}
@@ -3225,7 +3225,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
* not succeed (even if it did, DAX does not handle dirty
* page-cache pages correctly).
*/
- if (written < 0 || !iov_iter_count(from) || IS_DAX(inode))
+ if (written < 0 || !iov_iter_count(from) || IS_FSDAX(inode))
goto out;
status = generic_perform_write(file, from, pos = iocb->ki_pos);
@@ -529,10 +529,12 @@ unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
unsigned long len, unsigned long pgoff, unsigned long flags)
{
loff_t off = (loff_t)pgoff << PAGE_SHIFT;
+ struct inode *inode;
if (addr)
goto out;
- if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD))
+ inode = filp->f_mapping->host;
+ if (!IS_FSDAX(inode) || !IS_ENABLED(CONFIG_FS_DAX_PMD))
goto out;
addr = __thp_get_unmapped_area(filp, len, off, flags, PMD_SIZE);
@@ -275,6 +275,7 @@ static long madvise_willneed(struct vm_area_struct *vma,
unsigned long start, unsigned long end)
{
struct file *file = vma->vm_file;
+ struct inode *inode = file_inode(file);
*prev = vma;
#ifdef CONFIG_SWAP
@@ -293,7 +294,7 @@ static long madvise_willneed(struct vm_area_struct *vma,
return -EBADF;
#endif
- if (IS_DAX(file_inode(file))) {
+ if (IS_FSDAX(inode) || IS_DEVDAX(inode)) {
/* no bad return value, but ignore advice */
return 0;
}