Skip to content

Commit c7fe193

Browse files
weiny2stellarhopper
authored andcommitted
fs/dax: Remove unused size parameter
Passing size to copy_user_dax implies it can copy variable sizes of data when in fact it calls copy_user_page() which is exactly a page. We are safe because the only caller uses PAGE_SIZE anyway so just remove the variable for clarity. While we are at it change copy_user_dax() to copy_cow_page_dax() to make it clear it is a singleton helper for this one case not implementing what dax_iomap_actor() does. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ben Widawsky <[email protected]> Reviewed-by: Dan Williams <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 2316097 commit c7fe193

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

fs/dax.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -680,21 +680,20 @@ int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
680680
return __dax_invalidate_entry(mapping, index, false);
681681
}
682682

683-
static int copy_user_dax(struct block_device *bdev, struct dax_device *dax_dev,
684-
sector_t sector, size_t size, struct page *to,
685-
unsigned long vaddr)
683+
static int copy_cow_page_dax(struct block_device *bdev, struct dax_device *dax_dev,
684+
sector_t sector, struct page *to, unsigned long vaddr)
686685
{
687686
void *vto, *kaddr;
688687
pgoff_t pgoff;
689688
long rc;
690689
int id;
691690

692-
rc = bdev_dax_pgoff(bdev, sector, size, &pgoff);
691+
rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, &pgoff);
693692
if (rc)
694693
return rc;
695694

696695
id = dax_read_lock();
697-
rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, NULL);
696+
rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(PAGE_SIZE), &kaddr, NULL);
698697
if (rc < 0) {
699698
dax_read_unlock(id);
700699
return rc;
@@ -1305,8 +1304,8 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
13051304
clear_user_highpage(vmf->cow_page, vaddr);
13061305
break;
13071306
case IOMAP_MAPPED:
1308-
error = copy_user_dax(iomap.bdev, iomap.dax_dev,
1309-
sector, PAGE_SIZE, vmf->cow_page, vaddr);
1307+
error = copy_cow_page_dax(iomap.bdev, iomap.dax_dev,
1308+
sector, vmf->cow_page, vaddr);
13101309
break;
13111310
default:
13121311
WARN_ON_ONCE(1);

0 commit comments

Comments
 (0)