diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-10-19 22:08:00 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:14 +0300 |
commit | 9a796fdb06b56a1811f1afdd40b793e2848a990e (patch) | |
tree | 0aff8322804e52e2eb7f078bb0688a5d2fda4462 /fs | |
parent | d355c6f4f73060c8f3eba95b9ae72929669f7516 (diff) | |
download | linux-9a796fdb06b56a1811f1afdd40b793e2848a990e.tar.xz |
bcachefs: bch2_trans_exit() no longer returns errors
Now that peek_node()/next_node() are converted to return errors
directly, we don't need bch2_trans_exit() to return errors - it's
cleaner this way and wasn't used much anymore.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/btree_iter.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/btree_types.h | 1 | ||||
-rw-r--r-- | fs/bcachefs/btree_update.h | 6 | ||||
-rw-r--r-- | fs/bcachefs/dirent.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/ec.c | 5 | ||||
-rw-r--r-- | fs/bcachefs/fs-io.c | 7 | ||||
-rw-r--r-- | fs/bcachefs/fs.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/fsck.c | 9 | ||||
-rw-r--r-- | fs/bcachefs/migrate.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/move.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/quota.c | 6 | ||||
-rw-r--r-- | fs/bcachefs/reflink.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/sysfs.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/xattr.c | 2 |
15 files changed, 31 insertions, 29 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 339b3657683a..25ed4f2ce19c 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1346,10 +1346,8 @@ retry_all: } while (ret); } - if (unlikely(ret == -EIO)) { - trans->error = true; + if (unlikely(ret == -EIO)) goto out; - } BUG_ON(ret && ret != -EINTR); @@ -2781,7 +2779,7 @@ leaked: #endif } -int bch2_trans_exit(struct btree_trans *trans) +void bch2_trans_exit(struct btree_trans *trans) __releases(&c->btree_trans_barrier) { struct btree_insert_entry *i; @@ -2831,8 +2829,6 @@ int bch2_trans_exit(struct btree_trans *trans) trans->mem = (void *) 0x1; trans->paths = (void *) 0x1; - - return trans->error ? -EIO : 0; } static void __maybe_unused diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index 1cb4261bd66e..4cd05fd06e64 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -351,7 +351,7 @@ static inline void set_btree_iter_dontneed(struct btree_iter *iter) void *bch2_trans_kmalloc(struct btree_trans *, size_t); void bch2_trans_begin(struct btree_trans *); void bch2_trans_init(struct btree_trans *, struct bch_fs *, unsigned, size_t); -int bch2_trans_exit(struct btree_trans *); +void bch2_trans_exit(struct btree_trans *); void bch2_btree_trans_to_text(struct printbuf *, struct bch_fs *); diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 081b82d3848e..14acbdf34f7b 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -377,7 +377,6 @@ struct btree_trans { u8 nr_sorted; u8 nr_updates; bool used_mempool:1; - bool error:1; bool in_traverse_all:1; bool restarted:1; bool paths_sorted:1; diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h index 6f19b67c398f..2ffee9029f34 100644 --- a/fs/bcachefs/btree_update.h +++ b/fs/bcachefs/btree_update.h @@ -120,14 +120,14 @@ static inline int bch2_trans_commit(struct btree_trans *trans, #define bch2_trans_do(_c, _disk_res, _journal_seq, _flags, _do) \ ({ \ struct btree_trans trans; \ - int _ret, _ret2; \ + int _ret; \ \ bch2_trans_init(&trans, (_c), 0, 0); \ _ret = __bch2_trans_do(&trans, _disk_res, _journal_seq, _flags, \ _do); \ - _ret2 = bch2_trans_exit(&trans); \ + bch2_trans_exit(&trans); \ \ - _ret ?: _ret2; \ + _ret; \ }) #define trans_for_each_update(_trans, _i) \ diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index cd5468b15ba2..26df20ad090c 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -491,7 +491,7 @@ err: if (ret == -EINTR) goto retry; - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); return ret; } diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index 2c538f9b54f8..7dfa052e9765 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -1670,11 +1670,12 @@ int bch2_ec_mem_alloc(struct bch_fs *c, bool gc) bch2_trans_iter_init(&trans, &iter, BTREE_ID_stripes, POS(0, U64_MAX), 0); k = bch2_btree_iter_prev(&iter); - if (!IS_ERR_OR_NULL(k.k)) + ret = bkey_err(k); + if (!ret && k.k) idx = k.k->p.offset + 1; bch2_trans_iter_exit(&trans, &iter); - ret = bch2_trans_exit(&trans); + bch2_trans_exit(&trans); if (ret) return ret; diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 736dd71419a5..079c20cbf10e 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -2223,7 +2223,8 @@ err: if (ret == -EINTR) goto retry; - return bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); + return ret; } static int __bch2_truncate_page(struct bch_inode_info *inode, @@ -3125,7 +3126,7 @@ err: if (ret == -EINTR) goto retry; - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); if (ret) return ret; @@ -3240,7 +3241,7 @@ err: if (ret == -EINTR) goto retry; - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); if (ret) return ret; diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 7475830bb33f..334cd335ff11 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1016,7 +1016,7 @@ err: ret = bch2_fill_extent(c, info, bkey_i_to_s_c(prev.k), FIEMAP_EXTENT_LAST); - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); bch2_bkey_buf_exit(&cur, c); bch2_bkey_buf_exit(&prev, c); return ret < 0 ? ret : 0; diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index 826a3577ee93..a36bc840a62c 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -981,7 +981,8 @@ static int check_inodes(struct bch_fs *c, bool full) BUG_ON(ret == -EINTR); - return bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); + return ret; } noinline_for_stack @@ -1659,7 +1660,8 @@ fsck_err: goto retry; bch2_trans_iter_exit(&trans, &iter); - return bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); + return ret; } /* Get root directory, create if it doesn't exist: */ @@ -1876,7 +1878,8 @@ static int check_directory_structure(struct bch_fs *c) kfree(path.entries); - return bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); + return ret; } struct nlink_table { diff --git a/fs/bcachefs/migrate.c b/fs/bcachefs/migrate.c index 111a41159eb2..00ba6e1c92ee 100644 --- a/fs/bcachefs/migrate.c +++ b/fs/bcachefs/migrate.c @@ -100,7 +100,7 @@ static int __bch2_dev_usrdata_drop(struct bch_fs *c, unsigned dev_idx, int flags } bch2_trans_iter_exit(&trans, &iter); - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); bch2_bkey_buf_exit(&sk, c); BUG_ON(ret == -EINTR); @@ -180,7 +180,7 @@ next: ret = 0; err: - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); bch2_bkey_buf_exit(&k, c); BUG_ON(ret == -EINTR); diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 2f608631cc43..af02f2cf6ee0 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -773,7 +773,7 @@ next_nondata: out: bch2_trans_iter_exit(&trans, &iter); - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); bch2_bkey_buf_exit(&sk, c); return ret; diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c index 9b0f4d3f176d..17fd5bf107bb 100644 --- a/fs/bcachefs/quota.c +++ b/fs/bcachefs/quota.c @@ -374,7 +374,8 @@ static int bch2_quota_init_type(struct bch_fs *c, enum quota_types type) } bch2_trans_iter_exit(&trans, &iter); - return bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); + return ret; } void bch2_fs_quota_exit(struct bch_fs *c) @@ -452,7 +453,8 @@ int bch2_fs_quota_read(struct bch_fs *c) } bch2_trans_iter_exit(&trans, &iter); - return bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); + return ret; } /* Enable/disable/delete quotas for an entire filesystem: */ diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c index c63c95fc49b1..9bcf4216a286 100644 --- a/fs/bcachefs/reflink.c +++ b/fs/bcachefs/reflink.c @@ -349,7 +349,7 @@ s64 bch2_remap_range(struct bch_fs *c, bch2_trans_iter_exit(&trans, &inode_iter); } while (ret2 == -EINTR); - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); bch2_bkey_buf_exit(&new_src, c); bch2_bkey_buf_exit(&new_dst, c); diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 92e58f5c6bbf..51eb19b84a28 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -327,7 +327,7 @@ static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c } bch2_trans_iter_exit(&trans, &iter); - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); if (ret) return ret; diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c index ff81a25698ff..dcd2f6a91a72 100644 --- a/fs/bcachefs/xattr.c +++ b/fs/bcachefs/xattr.c @@ -316,7 +316,7 @@ err: if (ret == -EINTR) goto retry; - ret = bch2_trans_exit(&trans) ?: ret; + bch2_trans_exit(&trans); if (ret) return ret; |