Skip to content

Commit 2756c81

Browse files
author
Matthew Wilcox (Oracle)
committed
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: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1e47028 commit 2756c81

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

fs/iomap/buffered-io.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,17 @@ bool iomap_is_partially_uptodate(struct folio *folio, size_t from, size_t count)
435435
{
436436
struct iomap_page *iop = to_iomap_page(folio);
437437
struct inode *inode = folio->mapping->host;
438-
size_t len;
439438
unsigned first, last, i;
440439

441440
if (!iop)
442441
return false;
443442

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

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

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

0 commit comments

Comments
 (0)