Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 129000
b: refs/heads/master
c: af09abf
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Nov 7, 2008
1 parent 683bad5 commit c4cf2e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4366211ccd050e00674b3276b5ed81981b2d7793
refs/heads/master: af09abfece59aa50bfbf16f6f1f85822554e061f
17 changes: 15 additions & 2 deletions trunk/fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
PAGE_CACHE_SIZE) {
bio_get(bio);

/*
* inc the count before we submit the bio so
* we know the end IO handler won't happen before
* we inc the count. Otherwise, the cb might get
* freed before we're done setting it up
*/
atomic_inc(&cb->pending_bios);
ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
BUG_ON(ret);

Expand All @@ -323,7 +330,6 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
bio_put(bio);

bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS);
atomic_inc(&cb->pending_bios);
bio->bi_private = cb;
bio->bi_end_io = end_compressed_bio_write;
bio_add_page(bio, page, PAGE_CACHE_SIZE, 0);
Expand Down Expand Up @@ -573,14 +579,21 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
ret = btrfs_bio_wq_end_io(root->fs_info, comp_bio, 0);
BUG_ON(ret);

/*
* inc the count before we submit the bio so
* we know the end IO handler won't happen before
* we inc the count. Otherwise, the cb might get
* freed before we're done setting it up
*/
atomic_inc(&cb->pending_bios);

ret = btrfs_map_bio(root, READ, comp_bio, 0, 0);
BUG_ON(ret);

bio_put(comp_bio);

comp_bio = compressed_bio_alloc(bdev, cur_disk_byte,
GFP_NOFS);
atomic_inc(&cb->pending_bios);
comp_bio->bi_private = cb;
comp_bio->bi_end_io = end_compressed_bio_read;

Expand Down

0 comments on commit c4cf2e3

Please sign in to comment.