linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] bcachefs: Add btree_trans* to inode_set_fn
@ 2023-08-12 14:47 Joshua Ashton
  2023-08-12 14:47 ` [PATCH 2/4] bcachefs: Optimize bch2_dirent_name_bytes Joshua Ashton
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Joshua Ashton @ 2023-08-12 14:47 UTC (permalink / raw)
  To: linux-bcachefs; +Cc: Joshua Ashton

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>
---
 fs/bcachefs/fs-io.c    | 12 ++++++++----
 fs/bcachefs/fs-ioctl.c | 11 +++++++----
 fs/bcachefs/fs.c       |  5 +++--
 fs/bcachefs/fs.h       |  3 ++-
 fs/bcachefs/xattr.c    |  3 ++-
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 963c7971d495..4804e5a47ac9 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -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)
 {
@@ -390,7 +391,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)
 {
@@ -398,7 +400,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;
@@ -519,7 +522,8 @@ int bch2_truncate(struct mnt_idmap *idmap,
 
 /* 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;
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index dfa1bf73c854..141bcced031e 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -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 @@ static int bch2_ioc_fssetxattr(struct bch_fs *c,
 	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)
 {
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 925f5e52029b..eb5da358871b 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -92,7 +92,7 @@ int __must_check bch2_write_inode(struct bch_fs *c,
 
 	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)
 {
diff --git a/fs/bcachefs/fs.h b/fs/bcachefs/fs.h
index 6170d214d648..10e11119ded2 100644
--- a/fs/bcachefs/fs.h
+++ b/fs/bcachefs/fs.h
@@ -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 *,
diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c
index 70f78006daf2..6f6b3caf0607 100644
--- a/fs/bcachefs/xattr.c
+++ b/fs/bcachefs/xattr.c
@@ -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)
 {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-12 22:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-12 14:47 [PATCH 1/4] bcachefs: Add btree_trans* to inode_set_fn Joshua Ashton
2023-08-12 14:47 ` [PATCH 2/4] bcachefs: Optimize bch2_dirent_name_bytes Joshua Ashton
2023-08-12 16:23   ` Kent Overstreet
2023-08-12 17:09     ` Joshua Ashton
2023-08-12 14:47 ` [PATCH 3/4] bcachefs: Introduce bch2_dirent_get_name Joshua Ashton
2023-08-12 14:47 ` [PATCH 4/4] bcachefs: Implement casefolding Joshua Ashton
2023-08-12 22:44   ` Kent Overstreet
2023-08-12 16:17 ` [PATCH 1/4] bcachefs: Add btree_trans* to inode_set_fn Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).