diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/checksum.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/data_update.c | 10 | ||||
-rw-r--r-- | fs/bcachefs/data_update.h | 8 | ||||
-rw-r--r-- | fs/bcachefs/extents.c | 6 | ||||
-rw-r--r-- | fs/bcachefs/extents.h | 4 | ||||
-rw-r--r-- | fs/bcachefs/fs-io-buffered.c | 12 | ||||
-rw-r--r-- | fs/bcachefs/fs-io-direct.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/fs-io.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/inode.c | 19 | ||||
-rw-r--r-- | fs/bcachefs/inode.h | 9 | ||||
-rw-r--r-- | fs/bcachefs/io_misc.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/io_misc.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/io_read.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/io_read.h | 4 | ||||
-rw-r--r-- | fs/bcachefs/io_write.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/io_write_types.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/journal_io.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/move.c | 44 | ||||
-rw-r--r-- | fs/bcachefs/move.h | 14 | ||||
-rw-r--r-- | fs/bcachefs/opts.c | 11 | ||||
-rw-r--r-- | fs/bcachefs/opts.h | 6 | ||||
-rw-r--r-- | fs/bcachefs/rebalance.c | 18 | ||||
-rw-r--r-- | fs/bcachefs/rebalance.h | 6 | ||||
-rw-r--r-- | fs/bcachefs/reflink.c | 2 |
24 files changed, 104 insertions, 99 deletions
diff --git a/fs/bcachefs/checksum.h b/fs/bcachefs/checksum.h index 7bd9cf6104ca..10bfadcde80a 100644 --- a/fs/bcachefs/checksum.h +++ b/fs/bcachefs/checksum.h @@ -130,7 +130,7 @@ static inline enum bch_csum_type bch2_csum_opt_to_type(enum bch_csum_opt type, } static inline enum bch_csum_type bch2_data_checksum_type(struct bch_fs *c, - struct bch_io_opts opts) + struct bch_inode_opts opts) { if (opts.nocow) return 0; diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c index 2c997fddefb3..968850da0d23 100644 --- a/fs/bcachefs/data_update.c +++ b/fs/bcachefs/data_update.c @@ -613,7 +613,7 @@ int bch2_update_unwritten_extent(struct btree_trans *trans, } void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { if (!out->nr_tabstops) @@ -681,7 +681,7 @@ void bch2_data_update_inflight_to_text(struct printbuf *out, struct data_update int bch2_extent_drop_ptrs(struct btree_trans *trans, struct btree_iter *iter, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { struct bch_fs *c = trans->c; @@ -731,7 +731,7 @@ int bch2_extent_drop_ptrs(struct btree_trans *trans, } static int __bch2_data_update_bios_init(struct data_update *m, struct bch_fs *c, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, unsigned buf_bytes) { unsigned nr_vecs = DIV_ROUND_UP(buf_bytes, PAGE_SIZE); @@ -758,7 +758,7 @@ static int __bch2_data_update_bios_init(struct data_update *m, struct bch_fs *c, } int bch2_data_update_bios_init(struct data_update *m, struct bch_fs *c, - struct bch_io_opts *io_opts) + struct bch_inode_opts *io_opts) { struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(bkey_i_to_s_c(m->k.k)); const union bch_extent_entry *entry; @@ -830,7 +830,7 @@ int bch2_data_update_init(struct btree_trans *trans, struct moving_context *ctxt, struct data_update *m, struct write_point_specifier wp, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts data_opts, enum btree_id btree_id, struct bkey_s_c k) diff --git a/fs/bcachefs/data_update.h b/fs/bcachefs/data_update.h index fc12aa65366f..3b0ba6f6497f 100644 --- a/fs/bcachefs/data_update.h +++ b/fs/bcachefs/data_update.h @@ -23,7 +23,7 @@ struct data_update_opts { }; void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *, - struct bch_io_opts *, struct data_update_opts *); + struct bch_inode_opts *, struct data_update_opts *); #define BCH_DATA_UPDATE_TYPES() \ x(copygc, 0) \ @@ -76,18 +76,18 @@ void bch2_data_update_read_done(struct data_update *); int bch2_extent_drop_ptrs(struct btree_trans *, struct btree_iter *, struct bkey_s_c, - struct bch_io_opts *, + struct bch_inode_opts *, struct data_update_opts *); int bch2_data_update_bios_init(struct data_update *, struct bch_fs *, - struct bch_io_opts *); + struct bch_inode_opts *); void bch2_data_update_exit(struct data_update *); int bch2_data_update_init(struct btree_trans *, struct btree_iter *, struct moving_context *, struct data_update *, struct write_point_specifier, - struct bch_io_opts *, struct data_update_opts, + struct bch_inode_opts *, struct data_update_opts, enum btree_id, struct bkey_s_c); void bch2_data_update_opts_normalize(struct bkey_s_c, struct data_update_opts *); diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c index 68a61f7bc737..016242ffc98d 100644 --- a/fs/bcachefs/extents.c +++ b/fs/bcachefs/extents.c @@ -1151,7 +1151,7 @@ bch2_extent_has_ptr(struct bkey_s_c k1, struct extent_ptr_decoded p1, struct bke return NULL; } -static bool want_cached_ptr(struct bch_fs *c, struct bch_io_opts *opts, +static bool want_cached_ptr(struct bch_fs *c, struct bch_inode_opts *opts, struct bch_extent_ptr *ptr) { unsigned target = opts->promote_target ?: opts->foreground_target; @@ -1165,7 +1165,7 @@ static bool want_cached_ptr(struct bch_fs *c, struct bch_io_opts *opts, } void bch2_extent_ptr_set_cached(struct bch_fs *c, - struct bch_io_opts *opts, + struct bch_inode_opts *opts, struct bkey_s k, struct bch_extent_ptr *ptr) { @@ -1241,7 +1241,7 @@ bool bch2_extent_normalize(struct bch_fs *c, struct bkey_s k) * the promote target. */ bool bch2_extent_normalize_by_opts(struct bch_fs *c, - struct bch_io_opts *opts, + struct bch_inode_opts *opts, struct bkey_s k) { struct bkey_ptrs ptrs; diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h index f6dcb17108cd..03ea7c689d9a 100644 --- a/fs/bcachefs/extents.h +++ b/fs/bcachefs/extents.h @@ -686,10 +686,10 @@ bool bch2_extents_match(struct bkey_s_c, struct bkey_s_c); struct bch_extent_ptr * bch2_extent_has_ptr(struct bkey_s_c, struct extent_ptr_decoded, struct bkey_s); -void bch2_extent_ptr_set_cached(struct bch_fs *, struct bch_io_opts *, +void bch2_extent_ptr_set_cached(struct bch_fs *, struct bch_inode_opts *, struct bkey_s, struct bch_extent_ptr *); -bool bch2_extent_normalize_by_opts(struct bch_fs *, struct bch_io_opts *, struct bkey_s); +bool bch2_extent_normalize_by_opts(struct bch_fs *, struct bch_inode_opts *, struct bkey_s); bool bch2_extent_normalize(struct bch_fs *, struct bkey_s); void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *, const struct bch_extent_ptr *); diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c index 9532f1a73053..a027992d769c 100644 --- a/fs/bcachefs/fs-io-buffered.c +++ b/fs/bcachefs/fs-io-buffered.c @@ -284,12 +284,12 @@ void bch2_readahead(struct readahead_control *ractl) { struct bch_inode_info *inode = to_bch_ei(ractl->mapping->host); struct bch_fs *c = inode->v.i_sb->s_fs_info; - struct bch_io_opts opts; struct folio *folio; struct readpages_iter readpages_iter; struct blk_plug plug; - bch2_inode_opts_get(&opts, c, &inode->ei_inode); + struct bch_inode_opts opts; + bch2_inode_opts_get_inode(c, &inode->ei_inode, &opts); int ret = readpages_iter_init(&readpages_iter, ractl); if (ret) @@ -350,7 +350,7 @@ int bch2_read_single_folio(struct folio *folio, struct address_space *mapping) struct bch_inode_info *inode = to_bch_ei(mapping->host); struct bch_fs *c = inode->v.i_sb->s_fs_info; struct bch_read_bio *rbio; - struct bch_io_opts opts; + struct bch_inode_opts opts; struct blk_plug plug; int ret; DECLARE_COMPLETION_ONSTACK(done); @@ -361,7 +361,7 @@ int bch2_read_single_folio(struct folio *folio, struct address_space *mapping) if (!bch2_folio_create(folio, GFP_KERNEL)) return -ENOMEM; - bch2_inode_opts_get(&opts, c, &inode->ei_inode); + bch2_inode_opts_get_inode(c, &inode->ei_inode, &opts); rbio = rbio_init(bio_alloc_bioset(NULL, 1, REQ_OP_READ, GFP_KERNEL, &c->bio_read), c, @@ -407,7 +407,7 @@ struct bch_writepage_io { struct bch_writepage_state { struct bch_writepage_io *io; - struct bch_io_opts opts; + struct bch_inode_opts opts; struct bch_folio_sector *tmp; unsigned tmp_sectors; struct blk_plug plug; @@ -683,7 +683,7 @@ int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc struct bch_fs *c = mapping->host->i_sb->s_fs_info; struct bch_writepage_state *w = kzalloc(sizeof(*w), GFP_NOFS|__GFP_NOFAIL); - bch2_inode_opts_get(&w->opts, c, &to_bch_ei(mapping->host)->ei_inode); + bch2_inode_opts_get_inode(c, &to_bch_ei(mapping->host)->ei_inode, &w->opts); blk_start_plug(&w->plug); int ret = bch2_write_cache_pages(mapping, wbc, w); diff --git a/fs/bcachefs/fs-io-direct.c b/fs/bcachefs/fs-io-direct.c index 79823234160f..a104b9d70bea 100644 --- a/fs/bcachefs/fs-io-direct.c +++ b/fs/bcachefs/fs-io-direct.c @@ -68,7 +68,6 @@ static int bch2_direct_IO_read(struct kiocb *req, struct iov_iter *iter) struct file *file = req->ki_filp; struct bch_inode_info *inode = file_bch_inode(file); struct bch_fs *c = inode->v.i_sb->s_fs_info; - struct bch_io_opts opts; struct dio_read *dio; struct bio *bio; struct blk_plug plug; @@ -78,7 +77,8 @@ static int bch2_direct_IO_read(struct kiocb *req, struct iov_iter *iter) size_t shorten; ssize_t ret; - bch2_inode_opts_get(&opts, c, &inode->ei_inode); + struct bch_inode_opts opts; + bch2_inode_opts_get_inode(c, &inode->ei_inode, &opts); /* bios must be 512 byte aligned: */ if ((offset|iter->count) & (SECTOR_SIZE - 1)) @@ -445,13 +445,13 @@ static __always_inline long bch2_dio_write_loop(struct dio_write *dio) struct kiocb *req = dio->req; struct address_space *mapping = dio->mapping; struct bch_inode_info *inode = dio->inode; - struct bch_io_opts opts; + struct bch_inode_opts opts; struct bio *bio = &dio->op.wbio.bio; unsigned unaligned, iter_count; bool sync = dio->sync, dropped_locks; long ret; - bch2_inode_opts_get(&opts, c, &inode->ei_inode); + bch2_inode_opts_get_inode(c, &inode->ei_inode, &opts); while (1) { iter_count = dio->iter.count; diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index de0d965f3fde..57e9459afa07 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -627,10 +627,10 @@ static noinline int __bchfs_fallocate(struct bch_inode_info *inode, int mode, { struct bch_fs *c = inode->v.i_sb->s_fs_info; struct bpos end_pos = POS(inode->v.i_ino, end_sector); - struct bch_io_opts opts; + struct bch_inode_opts opts; int ret = 0; - bch2_inode_opts_get(&opts, c, &inode->ei_inode); + bch2_inode_opts_get_inode(c, &inode->ei_inode, &opts); CLASS(btree_trans, trans)(c); CLASS(btree_iter, iter)(trans, BTREE_ID_extents, diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index 4aa130ff7cf6..b7fcdb76483c 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -1224,24 +1224,25 @@ struct bch_opts bch2_inode_opts_to_opts(struct bch_inode_unpacked *inode) return ret; } -void bch2_inode_opts_get(struct bch_io_opts *opts, struct bch_fs *c, - struct bch_inode_unpacked *inode) +void bch2_inode_opts_get_inode(struct bch_fs *c, + struct bch_inode_unpacked *inode, + struct bch_inode_opts *ret) { #define x(_name, _bits) \ if ((inode)->bi_##_name) { \ - opts->_name = inode->bi_##_name - 1; \ - opts->_name##_from_inode = true; \ + ret->_name = inode->bi_##_name - 1; \ + ret->_name##_from_inode = true; \ } else { \ - opts->_name = c->opts._name; \ - opts->_name##_from_inode = false; \ + ret->_name = c->opts._name; \ + ret->_name##_from_inode = false; \ } BCH_INODE_OPTS() #undef x - bch2_io_opts_fixups(opts); + bch2_io_opts_fixups(ret); } -int bch2_inum_opts_get(struct btree_trans *trans, subvol_inum inum, struct bch_io_opts *opts) +int bch2_inum_opts_get(struct btree_trans *trans, subvol_inum inum, struct bch_inode_opts *opts) { struct bch_inode_unpacked inode; int ret = lockrestart_do(trans, bch2_inode_find_by_inum_trans(trans, inum, &inode)); @@ -1249,7 +1250,7 @@ int bch2_inum_opts_get(struct btree_trans *trans, subvol_inum inum, struct bch_i if (ret) return ret; - bch2_inode_opts_get(opts, trans->c, &inode); + bch2_inode_opts_get_inode(trans->c, &inode, opts); return 0; } diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h index 79092ea74844..12e0a104c196 100644 --- a/fs/bcachefs/inode.h +++ b/fs/bcachefs/inode.h @@ -289,9 +289,8 @@ int bch2_inode_nlink_inc(struct bch_inode_unpacked *); void bch2_inode_nlink_dec(struct btree_trans *, struct bch_inode_unpacked *); struct bch_opts bch2_inode_opts_to_opts(struct bch_inode_unpacked *); -void bch2_inode_opts_get(struct bch_io_opts *, struct bch_fs *, - struct bch_inode_unpacked *); -int bch2_inum_opts_get(struct btree_trans *, subvol_inum, struct bch_io_opts *); +void bch2_inode_opts_get_inode(struct bch_fs *, struct bch_inode_unpacked *, struct bch_inode_opts *); +int bch2_inum_opts_get(struct btree_trans *, subvol_inum, struct bch_inode_opts *); int bch2_inode_set_casefold(struct btree_trans *, subvol_inum, struct bch_inode_unpacked *, unsigned); @@ -300,8 +299,8 @@ int bch2_inode_set_casefold(struct btree_trans *, subvol_inum, static inline struct bch_extent_rebalance bch2_inode_rebalance_opts_get(struct bch_fs *c, struct bch_inode_unpacked *inode) { - struct bch_io_opts io_opts; - bch2_inode_opts_get(&io_opts, c, inode); + struct bch_inode_opts io_opts; + bch2_inode_opts_get_inode(c, inode, &io_opts); return io_opts_to_rebalance_opts(c, &io_opts); } diff --git a/fs/bcachefs/io_misc.c b/fs/bcachefs/io_misc.c index fa0b06e17d17..5e03574059e0 100644 --- a/fs/bcachefs/io_misc.c +++ b/fs/bcachefs/io_misc.c @@ -24,7 +24,7 @@ int bch2_extent_fallocate(struct btree_trans *trans, subvol_inum inum, struct btree_iter *iter, u64 sectors, - struct bch_io_opts opts, + struct bch_inode_opts opts, s64 *i_sectors_delta, struct write_point_specifier write_point) { @@ -373,7 +373,7 @@ static int __bch2_resume_logged_op_finsert(struct btree_trans *trans, struct btree_iter iter; struct bkey_i_logged_op_finsert *op = bkey_i_to_logged_op_finsert(op_k); subvol_inum inum = { le32_to_cpu(op->v.subvol), le64_to_cpu(op->v.inum) }; - struct bch_io_opts opts; + struct bch_inode_opts opts; u64 dst_offset = le64_to_cpu(op->v.dst_offset); u64 src_offset = le64_to_cpu(op->v.src_offset); s64 shift = dst_offset - src_offset; diff --git a/fs/bcachefs/io_misc.h b/fs/bcachefs/io_misc.h index b93e4d4b3c0c..6a294f2a6dd6 100644 --- a/fs/bcachefs/io_misc.h +++ b/fs/bcachefs/io_misc.h @@ -3,7 +3,7 @@ #define _BCACHEFS_IO_MISC_H int bch2_extent_fallocate(struct btree_trans *, subvol_inum, struct btree_iter *, - u64, struct bch_io_opts, s64 *, + u64, struct bch_inode_opts, s64 *, struct write_point_specifier); int bch2_fpunch_snapshot(struct btree_trans *, struct bpos, struct bpos); diff --git a/fs/bcachefs/io_read.c b/fs/bcachefs/io_read.c index e7d53ab1cf55..74c3238230fe 100644 --- a/fs/bcachefs/io_read.c +++ b/fs/bcachefs/io_read.c @@ -158,7 +158,7 @@ static bool ptr_being_rewritten(struct bch_read_bio *orig, unsigned dev) static inline int should_promote(struct bch_fs *c, struct bkey_s_c k, struct bpos pos, - struct bch_io_opts opts, + struct bch_inode_opts opts, unsigned flags, struct bch_io_failures *failed) { diff --git a/fs/bcachefs/io_read.h b/fs/bcachefs/io_read.h index 1e1c0476bd03..df4632f6fe9e 100644 --- a/fs/bcachefs/io_read.h +++ b/fs/bcachefs/io_read.h @@ -74,7 +74,7 @@ struct bch_read_bio { struct bpos data_pos; struct bversion version; - struct bch_io_opts opts; + struct bch_inode_opts opts; struct work_struct work; @@ -192,7 +192,7 @@ static inline struct bch_read_bio *rbio_init_fragment(struct bio *bio, static inline struct bch_read_bio *rbio_init(struct bio *bio, struct bch_fs *c, - struct bch_io_opts opts, + struct bch_inode_opts opts, bio_end_io_t end_io) { struct bch_read_bio *rbio = to_rbio(bio); diff --git a/fs/bcachefs/io_write.h b/fs/bcachefs/io_write.h index 2c0a8f35ee1f..6c05ba6e15d6 100644 --- a/fs/bcachefs/io_write.h +++ b/fs/bcachefs/io_write.h @@ -31,7 +31,7 @@ int bch2_extent_update(struct btree_trans *, subvol_inum, struct disk_reservation *, u64, s64 *, bool); static inline void bch2_write_op_init(struct bch_write_op *op, struct bch_fs *c, - struct bch_io_opts opts) + struct bch_inode_opts opts) { op->c = c; op->end_io = NULL; diff --git a/fs/bcachefs/io_write_types.h b/fs/bcachefs/io_write_types.h index 5da4eb8bb6f6..ab36b03e0a46 100644 --- a/fs/bcachefs/io_write_types.h +++ b/fs/bcachefs/io_write_types.h @@ -90,7 +90,7 @@ struct bch_write_op { struct bch_devs_list devs_have; u16 target; u16 nonce; - struct bch_io_opts opts; + struct bch_inode_opts opts; u32 subvol; struct bpos pos; diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index 0a9fbc76f363..44328d02cf67 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -216,7 +216,9 @@ nocompact: if (seq < c->journal_entries_base_seq || seq >= c->journal_entries_base_seq + U32_MAX) { - bch_err(c, "journal entry sequence numbers span too large a range: cannot reply, contact developers"); + bch_err(c, "journal entry sequence numbers span too large a range: cannot replay, contact developers\n" + "base %llu last_seq currently %llu, but have seq %llu", + c->journal_entries_base_seq, jlist->last_seq, seq); return bch_err_throw(c, ENOMEM_journal_entry_add); } diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 4f41f1f6ec6c..03b3060f1964 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -46,12 +46,12 @@ struct evacuate_bucket_arg { static bool evacuate_bucket_pred(struct bch_fs *, void *, enum btree_id, struct bkey_s_c, - struct bch_io_opts *, + struct bch_inode_opts *, struct data_update_opts *); static noinline void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { CLASS(printbuf, buf)(); @@ -72,7 +72,7 @@ static noinline void trace_io_move_read2(struct bch_fs *c, struct bkey_s_c k) static noinline void trace_io_move_pred2(struct bch_fs *c, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts, move_pred_fn pred, void *_arg, bool p) { @@ -325,7 +325,7 @@ int bch2_move_extent(struct moving_context *ctxt, struct move_bucket *bucket_in_flight, struct btree_iter *iter, struct bkey_s_c k, - struct bch_io_opts io_opts, + struct bch_inode_opts io_opts, struct data_update_opts data_opts) { struct btree_trans *trans = ctxt->trans; @@ -447,7 +447,7 @@ err: return ret; } -struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *trans, +struct bch_inode_opts *bch2_move_get_io_opts(struct btree_trans *trans, struct per_snapshot_io_opts *io_opts, struct bpos extent_pos, /* extent_iter, extent_k may be in reflink btree */ struct btree_iter *extent_iter, @@ -455,7 +455,7 @@ struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *trans, { struct bch_fs *c = trans->c; u32 restart_count = trans->restart_count; - struct bch_io_opts *opts_ret = &io_opts->fs_io_opts; + struct bch_inode_opts *opts_ret = &io_opts->fs_io_opts; int ret = 0; if (btree_iter_path(trans, extent_iter)->level) @@ -481,7 +481,7 @@ struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *trans, break; struct snapshot_io_opts_entry e = { .snapshot = k.k->p.snapshot }; - bch2_inode_opts_get(&e.io_opts, trans->c, &inode); + bch2_inode_opts_get_inode(trans->c, &inode, &e.io_opts); darray_push(&io_opts->d, e); })); @@ -506,13 +506,13 @@ out: } int bch2_move_get_io_opts_one(struct btree_trans *trans, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct btree_iter *extent_iter, struct bkey_s_c extent_k) { struct bch_fs *c = trans->c; - *io_opts = bch2_opts_to_inode_opts(c->opts); + bch2_inode_opts_get(c, io_opts); /* reflink btree? */ if (extent_k.k->p.inode) { @@ -527,7 +527,7 @@ int bch2_move_get_io_opts_one(struct btree_trans *trans, if (!ret && bkey_is_inode(inode_k.k)) { struct bch_inode_unpacked inode; bch2_inode_unpack(inode_k, &inode); - bch2_inode_opts_get(io_opts, c, &inode); + bch2_inode_opts_get_inode(c, &inode, io_opts); } } @@ -618,7 +618,7 @@ int bch2_move_data_btree(struct moving_context *ctxt, struct btree_trans *trans = ctxt->trans; struct bch_fs *c = trans->c; struct per_snapshot_io_opts snapshot_io_opts; - struct bch_io_opts *io_opts; + struct bch_inode_opts *io_opts; struct bkey_buf sk; struct btree_iter iter, reflink_iter = {}; struct bkey_s_c k; @@ -855,7 +855,6 @@ static int __bch2_move_data_phys(struct moving_context *ctxt, struct btree_trans *trans = ctxt->trans; struct bch_fs *c = trans->c; bool is_kthread = current->flags & PF_KTHREAD; - struct bch_io_opts io_opts = bch2_opts_to_inode_opts(c->opts); struct btree_iter iter = {}; struct bkey_buf sk; struct bkey_s_c k; @@ -863,6 +862,9 @@ static int __bch2_move_data_phys(struct moving_context *ctxt, u64 check_mismatch_done = bucket_start; int ret = 0; + struct bch_inode_opts io_opts; + bch2_inode_opts_get(c, &io_opts); + CLASS(bch2_dev_tryget, ca)(c, dev); if (!ca) return 0; @@ -1034,7 +1036,7 @@ int bch2_move_data_phys(struct bch_fs *c, static bool evacuate_bucket_pred(struct bch_fs *c, void *_arg, enum btree_id btree, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { struct evacuate_bucket_arg *arg = _arg; @@ -1075,7 +1077,7 @@ int bch2_evacuate_bucket(struct moving_context *ctxt, } typedef bool (*move_btree_pred)(struct bch_fs *, void *, - struct btree *, struct bch_io_opts *, + struct btree *, struct bch_inode_opts *, struct data_update_opts *); static int bch2_move_btree(struct bch_fs *c, @@ -1085,7 +1087,6 @@ static int bch2_move_btree(struct bch_fs *c, struct bch_move_stats *stats) { bool kthread = (current->flags & PF_KTHREAD) != 0; - struct bch_io_opts io_opts = bch2_opts_to_inode_opts(c->opts); struct moving_context ctxt; struct btree_trans *trans; struct btree_iter iter; @@ -1094,6 +1095,9 @@ static int bch2_move_btree(struct bch_fs *c, struct data_update_opts data_opts; int ret = 0; + struct bch_inode_opts io_opts; + bch2_inode_opts_get(c, &io_opts); + bch2_moving_ctxt_init(&ctxt, c, NULL, stats, writepoint_ptr(&c->btree_write_point), true); @@ -1154,7 +1158,7 @@ next: static bool rereplicate_pred(struct bch_fs *c, void *arg, enum btree_id btree, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { unsigned nr_good = bch2_bkey_durability(c, k); @@ -1185,7 +1189,7 @@ static bool rereplicate_pred(struct bch_fs *c, void *arg, static bool migrate_pred(struct bch_fs *c, void *arg, enum btree_id btree, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); @@ -1222,7 +1226,7 @@ static bool bformat_needs_redo(struct bkey_format *f) static bool rewrite_old_nodes_pred(struct bch_fs *c, void *arg, struct btree *b, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { if (b->version_ondisk != c->sb.version || @@ -1259,7 +1263,7 @@ int bch2_scan_old_btree_nodes(struct bch_fs *c, struct bch_move_stats *stats) static bool drop_extra_replicas_pred(struct bch_fs *c, void *arg, enum btree_id btree, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { unsigned durability = bch2_bkey_durability(c, k); @@ -1297,7 +1301,7 @@ static bool drop_extra_replicas_pred(struct bch_fs *c, void *arg, static bool scrub_pred(struct bch_fs *c, void *_arg, enum btree_id btree, struct bkey_s_c k, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { struct bch_ioctl_data *arg = _arg; diff --git a/fs/bcachefs/move.h b/fs/bcachefs/move.h index 481026ff99ab..18021d2c51d0 100644 --- a/fs/bcachefs/move.h +++ b/fs/bcachefs/move.h @@ -73,7 +73,7 @@ do { \ } while (1) typedef bool (*move_pred_fn)(struct bch_fs *, void *, enum btree_id, struct bkey_s_c, - struct bch_io_opts *, struct data_update_opts *); + struct bch_inode_opts *, struct data_update_opts *); extern const char * const bch2_data_ops_strs[]; @@ -90,19 +90,19 @@ int bch2_move_ratelimit(struct moving_context *); /* Inodes in different snapshots may have different IO options: */ struct snapshot_io_opts_entry { u32 snapshot; - struct bch_io_opts io_opts; + struct bch_inode_opts io_opts; }; struct per_snapshot_io_opts { u64 cur_inum; - struct bch_io_opts fs_io_opts; + struct bch_inode_opts fs_io_opts; DARRAY(struct snapshot_io_opts_entry) d; }; static inline void per_snapshot_io_opts_init(struct per_snapshot_io_opts *io_opts, struct bch_fs *c) { memset(io_opts, 0, sizeof(*io_opts)); - io_opts->fs_io_opts = bch2_opts_to_inode_opts(c->opts); + bch2_inode_opts_get(c, &io_opts->fs_io_opts); } static inline void per_snapshot_io_opts_exit(struct per_snapshot_io_opts *io_opts) @@ -110,7 +110,7 @@ static inline void per_snapshot_io_opts_exit(struct per_snapshot_io_opts *io_opt darray_exit(&io_opts->d); } -int bch2_move_get_io_opts_one(struct btree_trans *, struct bch_io_opts *, +int bch2_move_get_io_opts_one(struct btree_trans *, struct bch_inode_opts *, struct btree_iter *, struct bkey_s_c); int bch2_scan_old_btree_nodes(struct bch_fs *, struct bch_move_stats *); @@ -119,10 +119,10 @@ int bch2_move_extent(struct moving_context *, struct move_bucket *, struct btree_iter *, struct bkey_s_c, - struct bch_io_opts, + struct bch_inode_opts, struct data_update_opts); -struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *, +struct bch_inode_opts *bch2_move_get_io_opts(struct btree_trans *, struct per_snapshot_io_opts *, struct bpos, struct btree_iter *, struct bkey_s_c); diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index c3ef35dc01e2..10d472d3e7d1 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -802,16 +802,15 @@ bool bch2_opt_set_sb(struct bch_fs *c, struct bch_dev *ca, /* io opts: */ -struct bch_io_opts bch2_opts_to_inode_opts(struct bch_opts src) +void bch2_inode_opts_get(struct bch_fs *c, struct bch_inode_opts *ret) { - struct bch_io_opts opts = { -#define x(_name, _bits) ._name = src._name, + memset(ret, 0, sizeof(*ret)); + +#define x(_name, _bits) ret->_name = c->opts._name, BCH_INODE_OPTS() #undef x - }; - bch2_io_opts_fixups(&opts); - return opts; + bch2_io_opts_fixups(ret); } bool bch2_opt_is_inode_opt(enum bch_opt_id id) diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h index 31a3abcbd83e..9e0c73b7bd3a 100644 --- a/fs/bcachefs/opts.h +++ b/fs/bcachefs/opts.h @@ -670,7 +670,7 @@ int bch2_parse_mount_opts(struct bch_fs *, struct bch_opts *, struct printbuf *, /* inode opts: */ -struct bch_io_opts { +struct bch_inode_opts { #define x(_name, _bits) u##_bits _name; BCH_INODE_OPTS() #undef x @@ -679,7 +679,7 @@ struct bch_io_opts { #undef x }; -static inline void bch2_io_opts_fixups(struct bch_io_opts *opts) +static inline void bch2_io_opts_fixups(struct bch_inode_opts *opts) { if (!opts->background_target) opts->background_target = opts->foreground_target; @@ -692,7 +692,7 @@ static inline void bch2_io_opts_fixups(struct bch_io_opts *opts) } } -struct bch_io_opts bch2_opts_to_inode_opts(struct bch_opts); +void bch2_inode_opts_get(struct bch_fs *, struct bch_inode_opts *); bool bch2_opt_is_inode_opt(enum bch_opt_id); #endif /* _BCACHEFS_OPTS_H */ diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c index 25bf72dc6488..9590c57798c6 100644 --- a/fs/bcachefs/rebalance.c +++ b/fs/bcachefs/rebalance.c @@ -44,7 +44,7 @@ static const struct bch_extent_rebalance *bch2_bkey_rebalance_opts(struct bkey_s } static inline unsigned bch2_bkey_ptrs_need_compress(struct bch_fs *c, - struct bch_io_opts *opts, + struct bch_inode_opts *opts, struct bkey_s_c k, struct bkey_ptrs_c ptrs) { @@ -71,7 +71,7 @@ static inline unsigned bch2_bkey_ptrs_need_compress(struct bch_fs *c, } static inline unsigned bch2_bkey_ptrs_need_move(struct bch_fs *c, - struct bch_io_opts *opts, + struct bch_inode_opts *opts, struct bkey_ptrs_c ptrs) { if (!opts->background_target || @@ -92,7 +92,7 @@ static inline unsigned bch2_bkey_ptrs_need_move(struct bch_fs *c, } static unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c, - struct bch_io_opts *opts, + struct bch_inode_opts *opts, struct bkey_s_c k) { struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); @@ -145,7 +145,7 @@ incompressible: return sectors; } -static bool bch2_bkey_rebalance_needs_update(struct bch_fs *c, struct bch_io_opts *opts, +static bool bch2_bkey_rebalance_needs_update(struct bch_fs *c, struct bch_inode_opts *opts, struct bkey_s_c k) { if (!bkey_extent_is_direct_data(k.k)) @@ -161,7 +161,7 @@ static bool bch2_bkey_rebalance_needs_update(struct bch_fs *c, struct bch_io_opt } } -int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bch_io_opts *opts, +int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bch_inode_opts *opts, struct bkey_i *_k) { if (!bkey_extent_is_direct_data(&_k->k)) @@ -187,7 +187,7 @@ int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bch_io_opts *opts, } int bch2_get_update_rebalance_opts(struct btree_trans *trans, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct btree_iter *iter, struct bkey_s_c k) { @@ -356,7 +356,7 @@ static int bch2_bkey_clear_needs_rebalance(struct btree_trans *trans, static struct bkey_s_c next_rebalance_extent(struct btree_trans *trans, struct bpos work_pos, struct btree_iter *extent_iter, - struct bch_io_opts *io_opts, + struct bch_inode_opts *io_opts, struct data_update_opts *data_opts) { struct bch_fs *c = trans->c; @@ -435,7 +435,7 @@ static int do_rebalance_extent(struct moving_context *ctxt, struct bch_fs *c = trans->c; struct bch_fs_rebalance *r = &trans->c->rebalance; struct data_update_opts data_opts; - struct bch_io_opts io_opts; + struct bch_inode_opts io_opts; struct bkey_s_c k; struct bkey_buf sk; int ret; @@ -508,7 +508,7 @@ static int do_rebalance_scan(struct moving_context *ctxt, BTREE_ITER_prefetch, k, ({ ctxt->stats->pos = BBPOS(iter.btree_id, iter.pos); - struct bch_io_opts *io_opts = bch2_move_get_io_opts(trans, + struct bch_inode_opts *io_opts = bch2_move_get_io_opts(trans, &snapshot_io_opts, iter.pos, &iter, k); PTR_ERR_OR_ZERO(io_opts); })) ?: diff --git a/fs/bcachefs/rebalance.h b/fs/bcachefs/rebalance.h index 7a565ea7dbfc..9f2839ddb60e 100644 --- a/fs/bcachefs/rebalance.h +++ b/fs/bcachefs/rebalance.h @@ -8,7 +8,7 @@ #include "rebalance_types.h" static inline struct bch_extent_rebalance io_opts_to_rebalance_opts(struct bch_fs *c, - struct bch_io_opts *opts) + struct bch_inode_opts *opts) { struct bch_extent_rebalance r = { .type = BIT(BCH_EXTENT_ENTRY_rebalance), @@ -27,9 +27,9 @@ static inline struct bch_extent_rebalance io_opts_to_rebalance_opts(struct bch_f }; u64 bch2_bkey_sectors_need_rebalance(struct bch_fs *, struct bkey_s_c); -int bch2_bkey_set_needs_rebalance(struct bch_fs *, struct bch_io_opts *, struct bkey_i *); +int bch2_bkey_set_needs_rebalance(struct bch_fs *, struct bch_inode_opts *, struct bkey_i *); int bch2_get_update_rebalance_opts(struct btree_trans *, - struct bch_io_opts *, + struct bch_inode_opts *, struct btree_iter *, struct bkey_s_c); diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c index 238a362de19e..55ad8ab7a148 100644 --- a/fs/bcachefs/reflink.c +++ b/fs/bcachefs/reflink.c @@ -589,7 +589,7 @@ s64 bch2_remap_range(struct bch_fs *c, struct bpos dst_start = POS(dst_inum.inum, dst_offset); struct bpos src_start = POS(src_inum.inum, src_offset); struct bpos dst_end = dst_start, src_end = src_start; - struct bch_io_opts opts; + struct bch_inode_opts opts; struct bpos src_want; u64 dst_done = 0; u32 dst_snapshot, src_snapshot; |