mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
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>
This commit is contained in:
parent
d355c6f4f7
commit
9a796fdb06
@ -1346,10 +1346,8 @@ static int __btree_path_traverse_all(struct btree_trans *trans, int ret,
|
|||||||
} while (ret);
|
} while (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(ret == -EIO)) {
|
if (unlikely(ret == -EIO))
|
||||||
trans->error = true;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
BUG_ON(ret && ret != -EINTR);
|
BUG_ON(ret && ret != -EINTR);
|
||||||
|
|
||||||
@ -2781,7 +2779,7 @@ static void check_btree_paths_leaked(struct btree_trans *trans)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int bch2_trans_exit(struct btree_trans *trans)
|
void bch2_trans_exit(struct btree_trans *trans)
|
||||||
__releases(&c->btree_trans_barrier)
|
__releases(&c->btree_trans_barrier)
|
||||||
{
|
{
|
||||||
struct btree_insert_entry *i;
|
struct btree_insert_entry *i;
|
||||||
@ -2831,8 +2829,6 @@ int bch2_trans_exit(struct btree_trans *trans)
|
|||||||
|
|
||||||
trans->mem = (void *) 0x1;
|
trans->mem = (void *) 0x1;
|
||||||
trans->paths = (void *) 0x1;
|
trans->paths = (void *) 0x1;
|
||||||
|
|
||||||
return trans->error ? -EIO : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __maybe_unused
|
static void __maybe_unused
|
||||||
|
@ -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_kmalloc(struct btree_trans *, size_t);
|
||||||
void bch2_trans_begin(struct btree_trans *);
|
void bch2_trans_begin(struct btree_trans *);
|
||||||
void bch2_trans_init(struct btree_trans *, struct bch_fs *, unsigned, size_t);
|
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 *);
|
void bch2_btree_trans_to_text(struct printbuf *, struct bch_fs *);
|
||||||
|
|
||||||
|
@ -377,7 +377,6 @@ struct btree_trans {
|
|||||||
u8 nr_sorted;
|
u8 nr_sorted;
|
||||||
u8 nr_updates;
|
u8 nr_updates;
|
||||||
bool used_mempool:1;
|
bool used_mempool:1;
|
||||||
bool error:1;
|
|
||||||
bool in_traverse_all:1;
|
bool in_traverse_all:1;
|
||||||
bool restarted:1;
|
bool restarted:1;
|
||||||
bool paths_sorted:1;
|
bool paths_sorted:1;
|
||||||
|
@ -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) \
|
#define bch2_trans_do(_c, _disk_res, _journal_seq, _flags, _do) \
|
||||||
({ \
|
({ \
|
||||||
struct btree_trans trans; \
|
struct btree_trans trans; \
|
||||||
int _ret, _ret2; \
|
int _ret; \
|
||||||
\
|
\
|
||||||
bch2_trans_init(&trans, (_c), 0, 0); \
|
bch2_trans_init(&trans, (_c), 0, 0); \
|
||||||
_ret = __bch2_trans_do(&trans, _disk_res, _journal_seq, _flags, \
|
_ret = __bch2_trans_do(&trans, _disk_res, _journal_seq, _flags, \
|
||||||
_do); \
|
_do); \
|
||||||
_ret2 = bch2_trans_exit(&trans); \
|
bch2_trans_exit(&trans); \
|
||||||
\
|
\
|
||||||
_ret ?: _ret2; \
|
_ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define trans_for_each_update(_trans, _i) \
|
#define trans_for_each_update(_trans, _i) \
|
||||||
|
@ -491,7 +491,7 @@ int bch2_readdir(struct bch_fs *c, subvol_inum inum, struct dir_context *ctx)
|
|||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
bch2_trans_iter_init(&trans, &iter, BTREE_ID_stripes, POS(0, U64_MAX), 0);
|
||||||
|
|
||||||
k = bch2_btree_iter_prev(&iter);
|
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;
|
idx = k.k->p.offset + 1;
|
||||||
|
|
||||||
bch2_trans_iter_exit(&trans, &iter);
|
bch2_trans_iter_exit(&trans, &iter);
|
||||||
ret = bch2_trans_exit(&trans);
|
bch2_trans_exit(&trans);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -2223,7 +2223,8 @@ static inline int range_has_data(struct bch_fs *c, u32 subvol,
|
|||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
return bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __bch2_truncate_page(struct bch_inode_info *inode,
|
static int __bch2_truncate_page(struct bch_inode_info *inode,
|
||||||
@ -3125,7 +3126,7 @@ static loff_t bch2_seek_data(struct file *file, u64 offset)
|
|||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -3240,7 +3241,7 @@ static loff_t bch2_seek_hole(struct file *file, u64 offset)
|
|||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -1016,7 +1016,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
|
|||||||
ret = bch2_fill_extent(c, info, bkey_i_to_s_c(prev.k),
|
ret = bch2_fill_extent(c, info, bkey_i_to_s_c(prev.k),
|
||||||
FIEMAP_EXTENT_LAST);
|
FIEMAP_EXTENT_LAST);
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
bch2_bkey_buf_exit(&cur, c);
|
bch2_bkey_buf_exit(&cur, c);
|
||||||
bch2_bkey_buf_exit(&prev, c);
|
bch2_bkey_buf_exit(&prev, c);
|
||||||
return ret < 0 ? ret : 0;
|
return ret < 0 ? ret : 0;
|
||||||
|
@ -981,7 +981,8 @@ static int check_inodes(struct bch_fs *c, bool full)
|
|||||||
|
|
||||||
BUG_ON(ret == -EINTR);
|
BUG_ON(ret == -EINTR);
|
||||||
|
|
||||||
return bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline_for_stack
|
noinline_for_stack
|
||||||
@ -1659,7 +1660,8 @@ static int check_xattrs(struct bch_fs *c)
|
|||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
bch2_trans_iter_exit(&trans, &iter);
|
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: */
|
/* 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);
|
kfree(path.entries);
|
||||||
|
|
||||||
return bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nlink_table {
|
struct nlink_table {
|
||||||
|
@ -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);
|
bch2_trans_iter_exit(&trans, &iter);
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
bch2_bkey_buf_exit(&sk, c);
|
bch2_bkey_buf_exit(&sk, c);
|
||||||
|
|
||||||
BUG_ON(ret == -EINTR);
|
BUG_ON(ret == -EINTR);
|
||||||
@ -180,7 +180,7 @@ static int bch2_dev_metadata_drop(struct bch_fs *c, unsigned dev_idx, int flags)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err:
|
err:
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
bch2_bkey_buf_exit(&k, c);
|
bch2_bkey_buf_exit(&k, c);
|
||||||
|
|
||||||
BUG_ON(ret == -EINTR);
|
BUG_ON(ret == -EINTR);
|
||||||
|
@ -773,7 +773,7 @@ static int __bch2_move_data(struct bch_fs *c,
|
|||||||
out:
|
out:
|
||||||
|
|
||||||
bch2_trans_iter_exit(&trans, &iter);
|
bch2_trans_iter_exit(&trans, &iter);
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
bch2_bkey_buf_exit(&sk, c);
|
bch2_bkey_buf_exit(&sk, c);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -374,7 +374,8 @@ static int bch2_quota_init_type(struct bch_fs *c, enum quota_types type)
|
|||||||
}
|
}
|
||||||
bch2_trans_iter_exit(&trans, &iter);
|
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)
|
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);
|
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: */
|
/* Enable/disable/delete quotas for an entire filesystem: */
|
||||||
|
@ -349,7 +349,7 @@ s64 bch2_remap_range(struct bch_fs *c,
|
|||||||
bch2_trans_iter_exit(&trans, &inode_iter);
|
bch2_trans_iter_exit(&trans, &inode_iter);
|
||||||
} while (ret2 == -EINTR);
|
} 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_src, c);
|
||||||
bch2_bkey_buf_exit(&new_dst, c);
|
bch2_bkey_buf_exit(&new_dst, 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);
|
bch2_trans_iter_exit(&trans, &iter);
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ ssize_t bch2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
|||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
ret = bch2_trans_exit(&trans) ?: ret;
|
bch2_trans_exit(&trans);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user