/* create and submit bios for the compressed pages */
bytes_left = compressed_len;
- while(bytes_left > 0) {
+ for (page_index = 0; page_index < cb->nr_pages; page_index++) {
page = compressed_pages[page_index];
page->mapping = inode->i_mapping;
if (bio->bi_size)
bio->bi_end_io = end_compressed_bio_write;
bio_add_page(bio, page, PAGE_CACHE_SIZE, 0);
}
- page_index++;
+ if (bytes_left < PAGE_CACHE_SIZE) {
+ printk("bytes left %lu compress len %lu nr %lu\n",
+ bytes_left, cb->compressed_len, cb->nr_pages);
+ }
bytes_left -= PAGE_CACHE_SIZE;
first_byte += PAGE_CACHE_SIZE;
}
if (!btrfs_test_flag(inode, NOCOMPRESS) &&
btrfs_test_opt(root, COMPRESS)) {
WARN_ON(pages);
- pages = kmalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
+ pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
/* we want to make sure the amount of IO required to satisfy
* a random read is reasonably small, so we limit the size