summaryrefslogtreecommitdiff
path: root/libbcachefs/fs-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/fs-io.c')
-rw-r--r--libbcachefs/fs-io.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libbcachefs/fs-io.c b/libbcachefs/fs-io.c
index d8113b29..d635ebb5 100644
--- a/libbcachefs/fs-io.c
+++ b/libbcachefs/fs-io.c
@@ -676,8 +676,8 @@ static int bch2_page_reservation_get(struct bch_fs *c,
if (!s)
return -ENOMEM;
- for (i = offset / 512;
- i < DIV_ROUND_UP(offset + len, 512);
+ for (i = round_down(offset, block_bytes(c)) >> 9;
+ i < round_up(offset + len, block_bytes(c)) >> 9;
i++) {
disk_sectors += sectors_to_reserve(&s->s[i],
res->disk.nr_replicas);
@@ -749,8 +749,8 @@ static void bch2_set_page_dirty(struct bch_fs *c,
struct bch_page_state *s = bch2_page_state(page);
unsigned i, dirty_sectors = 0;
- for (i = offset / 512;
- i < DIV_ROUND_UP(offset + len, 512);
+ for (i = round_down(offset, block_bytes(c)) >> 9;
+ i < round_up(offset + len, block_bytes(c)) >> 9;
i++) {
unsigned sectors = sectors_to_reserve(&s->s[i],
res->disk.nr_replicas);
@@ -1086,7 +1086,7 @@ retry:
bkey_start_offset(k.k);
sectors = k.k->size - offset_into_extent;
- ret = bch2_read_indirect_extent(trans, iter,
+ ret = bch2_read_indirect_extent(trans,
&offset_into_extent, &tmp.k);
if (ret)
break;