Skip to content

Commit 9092b1d

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: simplify xfs_dax_fault
Replace the separate stub with an IS_ENABLED check, and take the call to dax_finish_sync_fault into xfs_dax_fault instead of leaving it in the caller. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent 29bc0dd commit 9092b1d

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

fs/xfs/xfs_file.c

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,31 +1251,27 @@ xfs_file_llseek(
12511251
return vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
12521252
}
12531253

1254-
#ifdef CONFIG_FS_DAX
12551254
static inline vm_fault_t
12561255
xfs_dax_fault(
12571256
struct vm_fault *vmf,
12581257
unsigned int order,
1259-
bool write_fault,
1260-
pfn_t *pfn)
1258+
bool write_fault)
12611259
{
1262-
return dax_iomap_fault(vmf, order, pfn, NULL,
1260+
vm_fault_t ret;
1261+
pfn_t pfn;
1262+
1263+
if (!IS_ENABLED(CONFIG_FS_DAX)) {
1264+
ASSERT(0);
1265+
return VM_FAULT_SIGBUS;
1266+
}
1267+
ret = dax_iomap_fault(vmf, order, &pfn, NULL,
12631268
(write_fault && !vmf->cow_page) ?
12641269
&xfs_dax_write_iomap_ops :
12651270
&xfs_read_iomap_ops);
1271+
if (ret & VM_FAULT_NEEDDSYNC)
1272+
ret = dax_finish_sync_fault(vmf, order, pfn);
1273+
return ret;
12661274
}
1267-
#else
1268-
static inline vm_fault_t
1269-
xfs_dax_fault(
1270-
struct vm_fault *vmf,
1271-
unsigned int order,
1272-
bool write_fault,
1273-
pfn_t *pfn)
1274-
{
1275-
ASSERT(0);
1276-
return VM_FAULT_SIGBUS;
1277-
}
1278-
#endif
12791275

12801276
/*
12811277
* Locking for serialisation of IO during page faults. This results in a lock
@@ -1309,11 +1305,7 @@ __xfs_filemap_fault(
13091305
lock_mode = xfs_ilock_for_write_fault(XFS_I(inode));
13101306

13111307
if (IS_DAX(inode)) {
1312-
pfn_t pfn;
1313-
1314-
ret = xfs_dax_fault(vmf, order, write_fault, &pfn);
1315-
if (ret & VM_FAULT_NEEDDSYNC)
1316-
ret = dax_finish_sync_fault(vmf, order, pfn);
1308+
ret = xfs_dax_fault(vmf, order, write_fault);
13171309
} else if (write_fault) {
13181310
ret = iomap_page_mkwrite(vmf, &xfs_page_mkwrite_iomap_ops);
13191311
} else {

0 commit comments

Comments
 (0)