Commit b21866f5 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Darrick J. Wong

iomap: Use bitmap ops to set uptodate bits

Now that the bitmap is protected by a spinlock, we can use the
more efficient bitmap ops instead of individual test/set bit ops.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent a6901d4d
...@@ -134,19 +134,11 @@ iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len) ...@@ -134,19 +134,11 @@ iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len)
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
unsigned first = off >> inode->i_blkbits; unsigned first = off >> inode->i_blkbits;
unsigned last = (off + len - 1) >> inode->i_blkbits; unsigned last = (off + len - 1) >> inode->i_blkbits;
bool uptodate = true;
unsigned long flags; unsigned long flags;
unsigned int i;
spin_lock_irqsave(&iop->uptodate_lock, flags); spin_lock_irqsave(&iop->uptodate_lock, flags);
for (i = 0; i < i_blocks_per_page(inode, page); i++) { bitmap_set(iop->uptodate, first, last - first + 1);
if (i >= first && i <= last) if (bitmap_full(iop->uptodate, i_blocks_per_page(inode, page)))
set_bit(i, iop->uptodate);
else if (!test_bit(i, iop->uptodate))
uptodate = false;
}
if (uptodate)
SetPageUptodate(page); SetPageUptodate(page);
spin_unlock_irqrestore(&iop->uptodate_lock, flags); spin_unlock_irqrestore(&iop->uptodate_lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment