aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/compression.c7
-rw-r--r--fs/btrfs/inode.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index c5470367ca5c..9adaa79adad9 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -296,7 +296,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
296 296
297 /* create and submit bios for the compressed pages */ 297 /* create and submit bios for the compressed pages */
298 bytes_left = compressed_len; 298 bytes_left = compressed_len;
299 while(bytes_left > 0) { 299 for (page_index = 0; page_index < cb->nr_pages; page_index++) {
300 page = compressed_pages[page_index]; 300 page = compressed_pages[page_index];
301 page->mapping = inode->i_mapping; 301 page->mapping = inode->i_mapping;
302 if (bio->bi_size) 302 if (bio->bi_size)
@@ -324,7 +324,10 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
324 bio->bi_end_io = end_compressed_bio_write; 324 bio->bi_end_io = end_compressed_bio_write;
325 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); 325 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0);
326 } 326 }
327 page_index++; 327 if (bytes_left < PAGE_CACHE_SIZE) {
328 printk("bytes left %lu compress len %lu nr %lu\n",
329 bytes_left, cb->compressed_len, cb->nr_pages);
330 }
328 bytes_left -= PAGE_CACHE_SIZE; 331 bytes_left -= PAGE_CACHE_SIZE;
329 first_byte += PAGE_CACHE_SIZE; 332 first_byte += PAGE_CACHE_SIZE;
330 } 333 }
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9797592dc86b..6739424c0fe6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -338,7 +338,7 @@ again:
338 if (!btrfs_test_flag(inode, NOCOMPRESS) && 338 if (!btrfs_test_flag(inode, NOCOMPRESS) &&
339 btrfs_test_opt(root, COMPRESS)) { 339 btrfs_test_opt(root, COMPRESS)) {
340 WARN_ON(pages); 340 WARN_ON(pages);
341 pages = kmalloc(sizeof(struct page *) * nr_pages, GFP_NOFS); 341 pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
342 342
343 /* we want to make sure the amount of IO required to satisfy 343 /* we want to make sure the amount of IO required to satisfy
344 * a random read is reasonably small, so we limit the size 344 * a random read is reasonably small, so we limit the size