if (block_size > deflateBound(1UL << zisofs_block_shift)) {
*errp = -EIO; return0;
} /* Empty block? */ if (block_size == 0) { for ( i = 0 ; i < pcount ; i++ ) { if (!pages[i]) continue;
memzero_page(pages[i], 0, PAGE_SIZE);
SetPageUptodate(pages[i]);
} return ((loff_t)pcount) << PAGE_SHIFT;
}
/* Because zlib is not thread-safe, do all the I/O at the top. */
blocknum = block_start >> bufshift;
bhs = kcalloc(needblocks + 1, sizeof(*bhs), GFP_KERNEL); if (!bhs) {
*errp = -ENOMEM; return0;
}
haveblocks = isofs_get_blocks(inode, blocknum, bhs, needblocks);
bh_read_batch(haveblocks, bhs);
/* Find the pointer to this specific chunk */ /* Note: we're not using isonum_731() here because the data is known aligned */ /* Note: header_size is in 32-bit words (4 bytes) */
blockptr = (header_size + cstart_block) << 2;
bh = isofs_bread(inode, blockptr >> blkbits); if (!bh) return -EIO;
block_start = le32_to_cpu(*(__le32 *)
(bh->b_data + (blockptr & (blksize - 1))));
while (cstart_block < cend_block && pcount > 0) { /* Load end of the compressed block in the file */
blockptr += 4; /* Traversed to next block? */ if (!(blockptr & (blksize - 1))) {
brelse(bh);
if (PAGE_SHIFT <= zisofs_block_shift) { /* We have already been given one page, this is the one
we must do. */
full_page = index & (zisofs_pages_per_cblock - 1);
pcount = min_t(int, zisofs_pages_per_cblock,
end_index - (index & ~(zisofs_pages_per_cblock - 1)));
index -= full_page;
} else {
full_page = 0;
pcount = 1;
}
pages = kcalloc(max_t(unsignedint, zisofs_pages_per_cblock, 1), sizeof(*pages), GFP_KERNEL); if (!pages) {
folio_unlock(folio); return -ENOMEM;
}
pages[full_page] = &folio->page;
for (i = 0; i < pcount; i++, index++) { if (i != full_page)
pages[i] = grab_cache_page_nowait(mapping, index);
}
/* Release any residual pages, do not SetPageUptodate */ for (i = 0; i < pcount; i++) { if (pages[i]) {
flush_dcache_page(pages[i]);
unlock_page(pages[i]); if (i != full_page)
put_page(pages[i]);
}
}
/* At this point, err contains 0 or -EIO depending on the "critical" page */
kfree(pages); return err;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.