summaryrefslogtreecommitdiff
path: root/libbcachefs/inode.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-26 17:09:59 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2022-11-26 17:09:59 -0500
commit934a84dfaf719af82dadbbe0e2480baff03c905b (patch)
tree22deb77e752f90c842ac2f8dce91f5a602afd49d /libbcachefs/inode.c
parent48eefee7495c6e145f3fcfe6ab83f9e8bc27a1ec (diff)
Update bcachefs sources to 5963d1b1a4 bcacehfs: Fix bch2_get_alloc_in_memory_pos()
Diffstat (limited to 'libbcachefs/inode.c')
-rw-r--r--libbcachefs/inode.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libbcachefs/inode.c b/libbcachefs/inode.c
index b902da0f..a63ff3df 100644
--- a/libbcachefs/inode.c
+++ b/libbcachefs/inode.c
@@ -657,7 +657,7 @@ int bch2_inode_create(struct btree_trans *trans,
again:
while ((k = bch2_btree_iter_peek(iter)).k &&
!(ret = bkey_err(k)) &&
- bkey_cmp(k.k->p, POS(0, max)) < 0) {
+ bkey_lt(k.k->p, POS(0, max))) {
while (pos < iter->pos.offset) {
if (!bch2_btree_key_cache_find(c, BTREE_ID_inodes, POS(0, pos)))
goto found_slot;
@@ -897,3 +897,25 @@ void bch2_inode_nlink_dec(struct btree_trans *trans, struct bch_inode_unpacked *
else
bi->bi_flags |= BCH_INODE_UNLINKED;
}
+
+struct bch_opts bch2_inode_opts_to_opts(struct bch_inode_unpacked *inode)
+{
+ struct bch_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;
+}
+
+void bch2_inode_opts_get(struct bch_io_opts *opts, struct bch_fs *c,
+ struct bch_inode_unpacked *inode)
+{
+#define x(_name, _bits) opts->_name = inode_opt_get(c, inode, _name);
+ BCH_INODE_OPTS()
+#undef x
+
+ if (opts->nocow)
+ opts->compression = opts->background_compression = opts->data_checksum = opts->erasure_code = 0;
+}