Skip to content

Commit

Permalink
Merge pull request torvalds#113 from yshui/master
Browse files Browse the repository at this point in the history
Blind fix for torvalds#111
  • Loading branch information
koverstreet authored May 22, 2020
2 parents 8b23a1b + 9d5b00e commit def100d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fs/bcachefs/fs-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ static void bchfs_read(struct btree_trans *trans, struct btree_iter *iter,
sectors = k.k->size - offset_into_extent;

ret = bch2_read_indirect_extent(trans,
&offset_into_extent, sk.k);
&offset_into_extent, &sk);
if (ret)
break;

Expand Down
2 changes: 1 addition & 1 deletion fs/bcachefs/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
sectors = k.k->size - offset_into_extent;

ret = bch2_read_indirect_extent(&trans,
&offset_into_extent, cur.k);
&offset_into_extent, &cur);
if (ret)
break;

Expand Down
10 changes: 5 additions & 5 deletions fs/bcachefs/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ static void bch2_read_retry(struct bch_fs *c, struct bch_read_bio *rbio,
sectors = k.k->size - offset_into_extent;

ret = bch2_read_indirect_extent(&trans,
&offset_into_extent, sk.k);
&offset_into_extent, &sk);
if (ret)
break;

Expand Down Expand Up @@ -1943,14 +1943,14 @@ static void bch2_read_endio(struct bio *bio)

int __bch2_read_indirect_extent(struct btree_trans *trans,
unsigned *offset_into_extent,
struct bkey_i *orig_k)
struct bkey_on_stack *orig_k)
{
struct btree_iter *iter;
struct bkey_s_c k;
u64 reflink_offset;
int ret;

reflink_offset = le64_to_cpu(bkey_i_to_reflink_p(orig_k)->v.idx) +
reflink_offset = le64_to_cpu(bkey_i_to_reflink_p(orig_k->k)->v.idx) +
*offset_into_extent;

iter = bch2_trans_get_iter(trans, BTREE_ID_REFLINK,
Expand All @@ -1973,7 +1973,7 @@ int __bch2_read_indirect_extent(struct btree_trans *trans,
}

*offset_into_extent = iter->pos.offset - bkey_start_offset(k.k);
bkey_reassemble(orig_k, k);
bkey_on_stack_reassemble(orig_k, trans->c, k);
err:
bch2_trans_iter_put(trans, iter);
return ret;
Expand Down Expand Up @@ -2273,7 +2273,7 @@ void bch2_read(struct bch_fs *c, struct bch_read_bio *rbio, u64 inode)
k = bkey_i_to_s_c(sk.k);

ret = bch2_read_indirect_extent(&trans,
&offset_into_extent, sk.k);
&offset_into_extent, &sk);
if (ret)
goto err;

Expand Down
7 changes: 4 additions & 3 deletions fs/bcachefs/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define _BCACHEFS_IO_H

#include "checksum.h"
#include "bkey_on_stack.h"
#include "io_types.h"

#define to_wbio(_bio) \
Expand Down Expand Up @@ -110,13 +111,13 @@ struct cache_promote_op;
struct extent_ptr_decoded;

int __bch2_read_indirect_extent(struct btree_trans *, unsigned *,
struct bkey_i *);
struct bkey_on_stack *);

static inline int bch2_read_indirect_extent(struct btree_trans *trans,
unsigned *offset_into_extent,
struct bkey_i *k)
struct bkey_on_stack *k)
{
return k->k.type == KEY_TYPE_reflink_p
return k->k->k.type == KEY_TYPE_reflink_p
? __bch2_read_indirect_extent(trans, offset_into_extent, k)
: 0;
}
Expand Down

0 comments on commit def100d

Please sign in to comment.