Commit 4a2d7d59 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dan Williams
Browse files

fsdax: simplify the offset check in dax_iomap_zero



The file relative offset must have the same alignment as the storage
offset, so use that and get rid of the call to iomap_sector.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20211129102203.2243509-17-hch@lst.de


Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent f1ba5faf
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1123,7 +1123,6 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,

s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap)
{
	sector_t sector = iomap_sector(iomap, pos & PAGE_MASK);
	pgoff_t pgoff = dax_iomap_pgoff(iomap, pos);
	long rc, id;
	void *kaddr;
@@ -1131,8 +1130,7 @@ s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap)
	unsigned offset = offset_in_page(pos);
	unsigned size = min_t(u64, PAGE_SIZE - offset, length);

	if (IS_ALIGNED(sector << SECTOR_SHIFT, PAGE_SIZE) &&
	    (size == PAGE_SIZE))
	if (IS_ALIGNED(pos, PAGE_SIZE) && size == PAGE_SIZE)
		page_aligned = true;

	id = dax_read_lock();