aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dax.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-11-01 11:36:37 -0400
committerDan Williams <dan.j.williams@intel.com>2017-11-03 09:26:24 -0400
commit302a5e312b3a106fec49ba08da3f6545c9b7ee18 (patch)
tree187a44f040cc48f8f06201f93cc75952e2b2e8eb /fs/dax.c
parent1b5a1cb21e0cdfb001050c76dc31039cdece1a63 (diff)
dax: Inline dax_pmd_insert_mapping() into the callsite
dax_pmd_insert_mapping() has only one callsite and we will need to further fine tune what it does for synchronous faults. Just inline it into the callsite so that we don't have to pass awkward bools around. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 5b20c6456926..675fab8ec41f 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1235,33 +1235,11 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf,
1235} 1235}
1236 1236
1237#ifdef CONFIG_FS_DAX_PMD 1237#ifdef CONFIG_FS_DAX_PMD
1238static int dax_pmd_insert_mapping(struct vm_fault *vmf, struct iomap *iomap, 1238/*
1239 loff_t pos, void *entry) 1239 * The 'colour' (ie low bits) within a PMD of a page offset. This comes up
1240{ 1240 * more often than one might expect in the below functions.
1241 struct address_space *mapping = vmf->vma->vm_file->f_mapping; 1241 */
1242 const sector_t sector = dax_iomap_sector(iomap, pos); 1242#define PG_PMD_COLOUR ((PMD_SIZE >> PAGE_SHIFT) - 1)
1243 struct inode *inode = mapping->host;
1244 void *ret = NULL;
1245 pfn_t pfn = {};
1246 int rc;
1247
1248 rc = dax_iomap_pfn(iomap, pos, PMD_SIZE, &pfn);
1249 if (rc < 0)
1250 goto fallback;
1251
1252 ret = dax_insert_mapping_entry(mapping, vmf, entry, sector,
1253 RADIX_DAX_PMD);
1254 if (IS_ERR(ret))
1255 goto fallback;
1256
1257 trace_dax_pmd_insert_mapping(inode, vmf, PMD_SIZE, pfn, ret);
1258 return vmf_insert_pfn_pmd(vmf->vma, vmf->address, vmf->pmd,
1259 pfn, vmf->flags & FAULT_FLAG_WRITE);
1260
1261fallback:
1262 trace_dax_pmd_insert_mapping_fallback(inode, vmf, PMD_SIZE, pfn, ret);
1263 return VM_FAULT_FALLBACK;
1264}
1265 1243
1266static int dax_pmd_load_hole(struct vm_fault *vmf, struct iomap *iomap, 1244static int dax_pmd_load_hole(struct vm_fault *vmf, struct iomap *iomap,
1267 void *entry) 1245 void *entry)
@@ -1317,6 +1295,7 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf,
1317 void *entry; 1295 void *entry;
1318 loff_t pos; 1296 loff_t pos;
1319 int error; 1297 int error;
1298 pfn_t pfn;
1320 1299
1321 /* 1300 /*
1322 * Check whether offset isn't beyond end of file now. Caller is 1301 * Check whether offset isn't beyond end of file now. Caller is
@@ -1394,7 +1373,19 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf,
1394 1373
1395 switch (iomap.type) { 1374 switch (iomap.type) {
1396 case IOMAP_MAPPED: 1375 case IOMAP_MAPPED:
1397 result = dax_pmd_insert_mapping(vmf, &iomap, pos, entry); 1376 error = dax_iomap_pfn(&iomap, pos, PMD_SIZE, &pfn);
1377 if (error < 0)
1378 goto finish_iomap;
1379
1380 entry = dax_insert_mapping_entry(mapping, vmf, entry,
1381 dax_iomap_sector(&iomap, pos),
1382 RADIX_DAX_PMD);
1383 if (IS_ERR(entry))
1384 goto finish_iomap;
1385
1386 trace_dax_pmd_insert_mapping(inode, vmf, PMD_SIZE, pfn, entry);
1387 result = vmf_insert_pfn_pmd(vma, vmf->address, vmf->pmd, pfn,
1388 write);
1398 break; 1389 break;
1399 case IOMAP_UNWRITTEN: 1390 case IOMAP_UNWRITTEN:
1400 case IOMAP_HOLE: 1391 case IOMAP_HOLE: