diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-24 04:14:55 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:49 +0300 |
commit | 01ad673727b59664c9d12df4e5b6f5bad1ea2825 (patch) | |
tree | db93047878a22efa13d8c91c3229639a5c4ebf79 /fs/bcachefs/inode.h | |
parent | f52dd1ae20ac8094eb881f816e7274d3f7910a84 (diff) | |
download | linux-01ad673727b59664c9d12df4e5b6f5bad1ea2825.tar.xz |
bcachefs: bch2_inode_opts_get()
This improves io_opts() and makes it a non-inline function - it's big
enough that it probably shouldn't be.
Also, bch_io_opts no longer needs fields for whether options are
defined, so we can slim it down a bit.
We'd like to stop passing around the full bch_io_opts, but that'll be
tricky because of bch2_rebalance_add_key().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/inode.h')
-rw-r--r-- | fs/bcachefs/inode.h | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h index 27744f78ae96..da78ed023a30 100644 --- a/fs/bcachefs/inode.h +++ b/fs/bcachefs/inode.h @@ -98,17 +98,8 @@ int bch2_inode_find_by_inum_trans(struct btree_trans *, subvol_inum, int bch2_inode_find_by_inum(struct bch_fs *, subvol_inum, struct bch_inode_unpacked *); -static inline struct bch_io_opts bch2_inode_opts_get(struct bch_inode_unpacked *inode) -{ - struct bch_io_opts ret = { 0 }; - -#define x(_name, _bits) \ - if (inode->bi_##_name) \ - opt_set(ret, _name, inode->bi_##_name - 1); - BCH_INODE_OPTS() -#undef x - return ret; -} +#define inode_opt_get(_c, _inode, _name) \ + ((_inode)->bi_##_name ? (_inode)->bi_##_name - 1 : (_c)->opts._name) static inline void bch2_inode_opt_set(struct bch_inode_unpacked *inode, enum inode_opt_id id, u64 v) @@ -139,15 +130,6 @@ static inline u64 bch2_inode_opt_get(struct bch_inode_unpacked *inode, } } -static inline struct bch_io_opts -io_opts(struct bch_fs *c, struct bch_inode_unpacked *inode) -{ - struct bch_io_opts opts = bch2_opts_to_inode_opts(c->opts); - - bch2_io_opts_apply(&opts, bch2_inode_opts_get(inode)); - return opts; -} - static inline u8 mode_to_type(umode_t mode) { return (mode >> 12) & 15; @@ -188,5 +170,7 @@ 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 *); #endif /* _BCACHEFS_INODE_H */ |