aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-05-22 12:33:42 -0400
committerChris Mason <chris.mason@oracle.com>2011-05-22 12:33:42 -0400
commit945d8962ceee6bb273365d0bdf42f763225b290f (patch)
tree43f5617022c7c947c3c63664e49eb9575ab82f2f /fs/btrfs/compression.c
parent0d0ca30f180906224be6279788f2b202cfd959d8 (diff)
parent4ea028859bbdad34b84c9951fbb832ae10c6a96c (diff)
Merge branch 'cleanups' of git://repo.or.cz/linux-2.6/btrfs-unstable into inode_numbers
Conflicts: fs/btrfs/extent-tree.c fs/btrfs/free-space-cache.c fs/btrfs/inode.c fs/btrfs/tree-log.c Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 369d5068ac7a..bfe42b03eaf9 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -333,7 +333,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
333 struct compressed_bio *cb; 333 struct compressed_bio *cb;
334 unsigned long bytes_left; 334 unsigned long bytes_left;
335 struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; 335 struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
336 int page_index = 0; 336 int pg_index = 0;
337 struct page *page; 337 struct page *page;
338 u64 first_byte = disk_start; 338 u64 first_byte = disk_start;
339 struct block_device *bdev; 339 struct block_device *bdev;
@@ -367,8 +367,8 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
367 367
368 /* create and submit bios for the compressed pages */ 368 /* create and submit bios for the compressed pages */
369 bytes_left = compressed_len; 369 bytes_left = compressed_len;
370 for (page_index = 0; page_index < cb->nr_pages; page_index++) { 370 for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) {
371 page = compressed_pages[page_index]; 371 page = compressed_pages[pg_index];
372 page->mapping = inode->i_mapping; 372 page->mapping = inode->i_mapping;
373 if (bio->bi_size) 373 if (bio->bi_size)
374 ret = io_tree->ops->merge_bio_hook(page, 0, 374 ret = io_tree->ops->merge_bio_hook(page, 0,
@@ -433,7 +433,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
433 struct compressed_bio *cb) 433 struct compressed_bio *cb)
434{ 434{
435 unsigned long end_index; 435 unsigned long end_index;
436 unsigned long page_index; 436 unsigned long pg_index;
437 u64 last_offset; 437 u64 last_offset;
438 u64 isize = i_size_read(inode); 438 u64 isize = i_size_read(inode);
439 int ret; 439 int ret;
@@ -457,13 +457,13 @@ static noinline int add_ra_bio_pages(struct inode *inode,
457 end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; 457 end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT;
458 458
459 while (last_offset < compressed_end) { 459 while (last_offset < compressed_end) {
460 page_index = last_offset >> PAGE_CACHE_SHIFT; 460 pg_index = last_offset >> PAGE_CACHE_SHIFT;
461 461
462 if (page_index > end_index) 462 if (pg_index > end_index)
463 break; 463 break;
464 464
465 rcu_read_lock(); 465 rcu_read_lock();
466 page = radix_tree_lookup(&mapping->page_tree, page_index); 466 page = radix_tree_lookup(&mapping->page_tree, pg_index);
467 rcu_read_unlock(); 467 rcu_read_unlock();
468 if (page) { 468 if (page) {
469 misses++; 469 misses++;
@@ -477,7 +477,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
477 if (!page) 477 if (!page)
478 break; 478 break;
479 479
480 if (add_to_page_cache_lru(page, mapping, page_index, 480 if (add_to_page_cache_lru(page, mapping, pg_index,
481 GFP_NOFS)) { 481 GFP_NOFS)) {
482 page_cache_release(page); 482 page_cache_release(page);
483 goto next; 483 goto next;
@@ -561,7 +561,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
561 unsigned long uncompressed_len = bio->bi_vcnt * PAGE_CACHE_SIZE; 561 unsigned long uncompressed_len = bio->bi_vcnt * PAGE_CACHE_SIZE;
562 unsigned long compressed_len; 562 unsigned long compressed_len;
563 unsigned long nr_pages; 563 unsigned long nr_pages;
564 unsigned long page_index; 564 unsigned long pg_index;
565 struct page *page; 565 struct page *page;
566 struct block_device *bdev; 566 struct block_device *bdev;
567 struct bio *comp_bio; 567 struct bio *comp_bio;
@@ -614,10 +614,10 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
614 614
615 bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; 615 bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev;
616 616
617 for (page_index = 0; page_index < nr_pages; page_index++) { 617 for (pg_index = 0; pg_index < nr_pages; pg_index++) {
618 cb->compressed_pages[page_index] = alloc_page(GFP_NOFS | 618 cb->compressed_pages[pg_index] = alloc_page(GFP_NOFS |
619 __GFP_HIGHMEM); 619 __GFP_HIGHMEM);
620 if (!cb->compressed_pages[page_index]) 620 if (!cb->compressed_pages[pg_index])
621 goto fail2; 621 goto fail2;
622 } 622 }
623 cb->nr_pages = nr_pages; 623 cb->nr_pages = nr_pages;
@@ -635,8 +635,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
635 comp_bio->bi_end_io = end_compressed_bio_read; 635 comp_bio->bi_end_io = end_compressed_bio_read;
636 atomic_inc(&cb->pending_bios); 636 atomic_inc(&cb->pending_bios);
637 637
638 for (page_index = 0; page_index < nr_pages; page_index++) { 638 for (pg_index = 0; pg_index < nr_pages; pg_index++) {
639 page = cb->compressed_pages[page_index]; 639 page = cb->compressed_pages[pg_index];
640 page->mapping = inode->i_mapping; 640 page->mapping = inode->i_mapping;
641 page->index = em_start >> PAGE_CACHE_SHIFT; 641 page->index = em_start >> PAGE_CACHE_SHIFT;
642 642
@@ -703,8 +703,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
703 return 0; 703 return 0;
704 704
705fail2: 705fail2:
706 for (page_index = 0; page_index < nr_pages; page_index++) 706 for (pg_index = 0; pg_index < nr_pages; pg_index++)
707 free_page((unsigned long)cb->compressed_pages[page_index]); 707 free_page((unsigned long)cb->compressed_pages[pg_index]);
708 708
709 kfree(cb->compressed_pages); 709 kfree(cb->compressed_pages);
710fail1: 710fail1:
@@ -946,7 +946,7 @@ void btrfs_exit_compress(void)
946int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, 946int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
947 unsigned long total_out, u64 disk_start, 947 unsigned long total_out, u64 disk_start,
948 struct bio_vec *bvec, int vcnt, 948 struct bio_vec *bvec, int vcnt,
949 unsigned long *page_index, 949 unsigned long *pg_index,
950 unsigned long *pg_offset) 950 unsigned long *pg_offset)
951{ 951{
952 unsigned long buf_offset; 952 unsigned long buf_offset;
@@ -955,7 +955,7 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
955 unsigned long working_bytes = total_out - buf_start; 955 unsigned long working_bytes = total_out - buf_start;
956 unsigned long bytes; 956 unsigned long bytes;
957 char *kaddr; 957 char *kaddr;
958 struct page *page_out = bvec[*page_index].bv_page; 958 struct page *page_out = bvec[*pg_index].bv_page;
959 959
960 /* 960 /*
961 * start byte is the first byte of the page we're currently 961 * start byte is the first byte of the page we're currently
@@ -996,11 +996,11 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
996 996
997 /* check if we need to pick another page */ 997 /* check if we need to pick another page */
998 if (*pg_offset == PAGE_CACHE_SIZE) { 998 if (*pg_offset == PAGE_CACHE_SIZE) {
999 (*page_index)++; 999 (*pg_index)++;
1000 if (*page_index >= vcnt) 1000 if (*pg_index >= vcnt)
1001 return 0; 1001 return 0;
1002 1002
1003 page_out = bvec[*page_index].bv_page; 1003 page_out = bvec[*pg_index].bv_page;
1004 *pg_offset = 0; 1004 *pg_offset = 0;
1005 start_byte = page_offset(page_out) - disk_start; 1005 start_byte = page_offset(page_out) - disk_start;
1006 1006