mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 21:35:07 +00:00
bcachefs: Add btree_trans* to inode_set_fn
This will be used when we need to re-hash a directory tree when setting flags. It is not possible to have concurrent btree_trans on a thread. Signed-off-by: Joshua Ashton <joshua@froggi.es> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
e6375481c9
commit
791236b85c
@ -109,7 +109,8 @@ struct inode_new_size {
|
||||
unsigned fields;
|
||||
};
|
||||
|
||||
static int inode_set_size(struct bch_inode_info *inode,
|
||||
static int inode_set_size(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
@ -389,7 +390,8 @@ static int bch2_extend(struct mnt_idmap *idmap,
|
||||
return bch2_setattr_nonsize(idmap, inode, iattr);
|
||||
}
|
||||
|
||||
static int bch2_truncate_finish_fn(struct bch_inode_info *inode,
|
||||
static int bch2_truncate_finish_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
@ -397,7 +399,8 @@ static int bch2_truncate_finish_fn(struct bch_inode_info *inode,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bch2_truncate_start_fn(struct bch_inode_info *inode,
|
||||
static int bch2_truncate_start_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi, void *p)
|
||||
{
|
||||
u64 *new_i_size = p;
|
||||
@ -518,7 +521,8 @@ err:
|
||||
|
||||
/* fallocate: */
|
||||
|
||||
static int inode_update_times_fn(struct bch_inode_info *inode,
|
||||
static int inode_update_times_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi, void *p)
|
||||
{
|
||||
struct bch_fs *c = inode->v.i_sb->s_fs_info;
|
||||
|
@ -31,7 +31,8 @@ struct flags_set {
|
||||
bool projinherit;
|
||||
};
|
||||
|
||||
static int bch2_inode_flags_set(struct bch_inode_info *inode,
|
||||
static int bch2_inode_flags_set(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
@ -124,7 +125,8 @@ static int bch2_ioc_fsgetxattr(struct bch_inode_info *inode,
|
||||
return copy_to_user(arg, &fa, sizeof(fa));
|
||||
}
|
||||
|
||||
static int fssetxattr_inode_update_fn(struct bch_inode_info *inode,
|
||||
static int fssetxattr_inode_update_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
@ -135,7 +137,7 @@ static int fssetxattr_inode_update_fn(struct bch_inode_info *inode,
|
||||
bi->bi_project = s->projid;
|
||||
}
|
||||
|
||||
return bch2_inode_flags_set(inode, bi, p);
|
||||
return bch2_inode_flags_set(trans, inode, bi, p);
|
||||
}
|
||||
|
||||
static int bch2_ioc_fssetxattr(struct bch_fs *c,
|
||||
@ -192,7 +194,8 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bch2_reinherit_attrs_fn(struct bch_inode_info *inode,
|
||||
static int bch2_reinherit_attrs_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ retry:
|
||||
|
||||
ret = bch2_inode_peek(&trans, &iter, &inode_u, inode_inum(inode),
|
||||
BTREE_ITER_INTENT) ?:
|
||||
(set ? set(inode, &inode_u, p) : 0) ?:
|
||||
(set ? set(&trans, inode, &inode_u, p) : 0) ?:
|
||||
bch2_inode_write(&trans, &iter, &inode_u) ?:
|
||||
bch2_trans_commit(&trans, NULL, NULL, BTREE_INSERT_NOFAIL);
|
||||
|
||||
@ -1414,7 +1414,8 @@ static void bch2_destroy_inode(struct inode *vinode)
|
||||
call_rcu(&vinode->i_rcu, bch2_i_callback);
|
||||
}
|
||||
|
||||
static int inode_update_times_fn(struct bch_inode_info *inode,
|
||||
static int inode_update_times_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
|
@ -174,7 +174,8 @@ static inline int bch2_set_projid(struct bch_fs *c,
|
||||
struct inode *bch2_vfs_inode_get(struct bch_fs *, subvol_inum);
|
||||
|
||||
/* returns 0 if we want to do the update, or error is passed up */
|
||||
typedef int (*inode_set_fn)(struct bch_inode_info *,
|
||||
typedef int (*inode_set_fn)(struct btree_trans *,
|
||||
struct bch_inode_info *,
|
||||
struct bch_inode_unpacked *, void *);
|
||||
|
||||
void bch2_inode_update_after_write(struct btree_trans *,
|
||||
|
@ -494,7 +494,8 @@ struct inode_opt_set {
|
||||
bool defined;
|
||||
};
|
||||
|
||||
static int inode_opt_set_fn(struct bch_inode_info *inode,
|
||||
static int inode_opt_set_fn(struct btree_trans *trans,
|
||||
struct bch_inode_info *inode,
|
||||
struct bch_inode_unpacked *bi,
|
||||
void *p)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user