vfs: fix vfs_bio_clrbuf() for PAGE_SIZE > block size
Calculate the desired page valid mask using math that will not overflow the types used. Sponsored by: Netflix Reviewed by: mckusick, kib, markj Differential Revision: https://reviews.freebsd.org/D34837
This commit is contained in:
parent
82817f26f8
commit
5bd21cbbd1
@ -4852,7 +4852,8 @@ vfs_bio_set_valid(struct buf *bp, int base, int size)
|
||||
void
|
||||
vfs_bio_clrbuf(struct buf *bp)
|
||||
{
|
||||
int i, j, mask, sa, ea, slide;
|
||||
int i, j, sa, ea, slide, zbits;
|
||||
vm_page_bits_t mask;
|
||||
|
||||
if ((bp->b_flags & (B_VMIO | B_MALLOC)) != B_VMIO) {
|
||||
clrbuf(bp);
|
||||
@ -4871,7 +4872,9 @@ vfs_bio_clrbuf(struct buf *bp)
|
||||
if (bp->b_pages[i] == bogus_page)
|
||||
continue;
|
||||
j = sa / DEV_BSIZE;
|
||||
mask = ((1 << ((ea - sa) / DEV_BSIZE)) - 1) << j;
|
||||
zbits = (sizeof(vm_page_bits_t) * NBBY) -
|
||||
(ea - sa) / DEV_BSIZE;
|
||||
mask = (VM_PAGE_BITS_ALL >> zbits) << j;
|
||||
if ((bp->b_pages[i]->valid & mask) == mask)
|
||||
continue;
|
||||
if ((bp->b_pages[i]->valid & mask) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user