Skip to content

Commit

Permalink
fixed a bug that was causing changes reads to not look at the cow fil…
Browse files Browse the repository at this point in the history
…e for data
  • Loading branch information
Tom Caputi committed Jan 23, 2016
1 parent a58eee0 commit b2e1c54
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dattobd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,6 +1917,7 @@ static int snap_handle_read_bio(struct snap_device *dev, struct bio *bio){
void *orig_private;
bio_end_io_t *orig_end_io;
char *data;
sector_t bio_orig_sect;
unsigned int bio_orig_idx, bio_orig_size, bytes_written;
uint64_t block_mapping, curr_byte, curr_end_byte = bio_sector(bio) * KERNEL_SECTOR_SIZE;

Expand All @@ -1925,6 +1926,7 @@ static int snap_handle_read_bio(struct snap_device *dev, struct bio *bio){
orig_end_io = bio->bi_end_io;
bio_orig_idx = bio_idx(bio);
bio_orig_size = bio_size(bio);
bio_orig_sect = bio_sector(bio);

bio->bi_bdev = dev->sd_base_dev;

Expand All @@ -1935,6 +1937,11 @@ static int snap_handle_read_bio(struct snap_device *dev, struct bio *bio){
goto snap_handle_bio_read_out;
}

//reset the bio
bio_idx(bio) = bio_orig_idx;
bio_size(bio) = bio_orig_size;
bio_sector(bio) = bio_orig_sect;

//iterate over all the segments and fill the bio. this more complex than writing since we don't have the block aligned guarantee
bio_for_each_segment(bvec, bio, iter){
//reset the number of bytes we have written to this bio_vec
Expand Down

0 comments on commit b2e1c54

Please sign in to comment.