diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-04-06 14:32:06 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-04-06 14:32:06 -0400 |
commit | 01f9a4f107dd85beed487464bd90f4406f25c927 (patch) | |
tree | 21e4c9409de26163cea80b588057d84d1c08fb67 | |
parent | bd8be01aa04eb9cc33fcdce89ac6e0fac0ae0fcf (diff) |
bcachefs: allocate sb_read_scratch with __get_free_page
kmalloc allocations aren't guranteed alignment for io
-rw-r--r-- | fs/bcachefs/super-io.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/super.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 83c74af4966e..c0471c891efd 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -648,7 +648,7 @@ static void read_back_super(struct bch_fs *c, struct bch_dev *ca) bio_reset(bio); bio_set_dev(bio, ca->disk_sb.bdev); bio->bi_iter.bi_sector = le64_to_cpu(sb->layout.sb_offset[0]); - bio->bi_iter.bi_size = 4096; + bio->bi_iter.bi_size = PAGE_SIZE; bio->bi_end_io = write_super_endio; bio->bi_private = ca; bio_set_op_attrs(bio, REQ_OP_READ, REQ_SYNC|REQ_META); diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 920bbfbb47bf..3fb73abf9fe7 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -952,7 +952,7 @@ static void bch2_dev_free(struct bch_dev *ca) free_percpu(ca->io_done); bioset_exit(&ca->replica_set); bch2_dev_buckets_free(ca); - kfree(ca->sb_read_scratch); + free_page((unsigned long) ca->sb_read_scratch); bch2_time_stats_exit(&ca->io_latency[WRITE]); bch2_time_stats_exit(&ca->io_latency[READ]); @@ -1066,7 +1066,7 @@ static struct bch_dev *__bch2_dev_alloc(struct bch_fs *c, 0, GFP_KERNEL) || percpu_ref_init(&ca->io_ref, bch2_dev_io_ref_complete, PERCPU_REF_INIT_DEAD, GFP_KERNEL) || - !(ca->sb_read_scratch = kmalloc(4096, GFP_KERNEL)) || + !(ca->sb_read_scratch = (void *) __get_free_page(GFP_KERNEL)) || bch2_dev_buckets_alloc(c, ca) || bioset_init(&ca->replica_set, 4, offsetof(struct bch_write_bio, bio), 0) || |