Commit 2756c818 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle)
Browse files

iomap: Simplify is_partially_uptodate a little



Remove the unnecessary variable 'len' and fix a comment to refer to
the folio instead of the page.

Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1e470280
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -435,18 +435,17 @@ bool iomap_is_partially_uptodate(struct folio *folio, size_t from, size_t count)
{
	struct iomap_page *iop = to_iomap_page(folio);
	struct inode *inode = folio->mapping->host;
	size_t len;
	unsigned first, last, i;

	if (!iop)
		return false;

	/* Limit range to this folio */
	len = min(folio_size(folio) - from, count);
	/* Caller's range may extend past the end of this folio */
	count = min(folio_size(folio) - from, count);

	/* First and last blocks in range within page */
	/* First and last blocks in range within folio */
	first = from >> inode->i_blkbits;
	last = (from + len - 1) >> inode->i_blkbits;
	last = (from + count - 1) >> inode->i_blkbits;

	for (i = first; i <= last; i++)
		if (!test_bit(i, iop->uptodate))