]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - cmd_fusemount.c
Add valgrind suppressions:
[bcachefs-tools-debian] / cmd_fusemount.c
index 5418a556912f772923d6e5d1ff1de864b2e8f8c3..216094f06ad33e3b34d8ed72e4c96d3b0e4a927e 100644 (file)
@@ -171,7 +171,7 @@ static void bcachefs_fuse_setattr(fuse_req_t req, fuse_ino_t inum,
        struct bch_fs *c = fuse_req_userdata(req);
        struct bch_inode_unpacked inode_u;
        struct btree_trans trans;
-       struct btree_iter *iter;
+       struct btree_iter iter;
        u64 now;
        int ret;
 
@@ -185,8 +185,7 @@ retry:
        bch2_trans_begin(&trans);
        now = bch2_current_time(c);
 
-       iter = bch2_inode_peek(&trans, &inode_u, inum, BTREE_ITER_INTENT);
-       ret = PTR_ERR_OR_ZERO(iter);
+       ret = bch2_inode_peek(&trans, &iter, &inode_u, inum, BTREE_ITER_INTENT);
        if (ret)
                goto err;
 
@@ -208,11 +207,11 @@ retry:
                inode_u.bi_mtime = now;
        /* TODO: CTIME? */
 
-       ret   = bch2_inode_write(&trans, iter, &inode_u) ?:
+       ret   = bch2_inode_write(&trans, &iter, &inode_u) ?:
                bch2_trans_commit(&trans, NULL, NULL,
-                                 BTREE_INSERT_ATOMIC|
                                  BTREE_INSERT_NOFAIL);
 err:
+        bch2_trans_iter_exit(&trans, &iter);
        if (ret == -EINTR)
                goto retry;
 
@@ -237,7 +236,7 @@ static int do_create(struct bch_fs *c, u64 dir,
 
        bch2_inode_init_early(c, new_inode);
 
-       return bch2_trans_do(c, NULL, BTREE_INSERT_ATOMIC,
+       return bch2_trans_do(c, NULL, NULL, 0,
                        bch2_create_trans(&trans,
                                dir, &dir_u,
                                new_inode, &qstr,
@@ -289,7 +288,7 @@ static void bcachefs_fuse_unlink(fuse_req_t req, fuse_ino_t dir,
 
        dir = map_root_ino(dir);
 
-       ret = bch2_trans_do(c, NULL, BTREE_INSERT_ATOMIC|BTREE_INSERT_NOFAIL,
+       ret = bch2_trans_do(c, NULL, NULL, BTREE_INSERT_NOFAIL,
                            bch2_unlink_trans(&trans, dir, &dir_u,
                                              &inode_u, &qstr));
 
@@ -326,7 +325,7 @@ static void bcachefs_fuse_rename(fuse_req_t req,
        dst_dir = map_root_ino(dst_dir);
 
        /* XXX handle overwrites */
-       ret = bch2_trans_do(c, NULL, BTREE_INSERT_ATOMIC,
+       ret = bch2_trans_do(c, NULL, NULL, 0,
                bch2_rename_trans(&trans,
                                  src_dir, &src_dir_u,
                                  dst_dir, &dst_dir_u,
@@ -350,7 +349,7 @@ static void bcachefs_fuse_link(fuse_req_t req, fuse_ino_t inum,
 
        newparent = map_root_ino(newparent);
 
-       ret = bch2_trans_do(c, NULL, BTREE_INSERT_ATOMIC,
+       ret = bch2_trans_do(c, NULL, NULL, 0,
                            bch2_link_trans(&trans, newparent,
                                            inum, &dir_u, &inode_u, &qstr));
 
@@ -523,7 +522,7 @@ static void bcachefs_fuse_read(fuse_req_t req, fuse_ino_t inum,
 static int inode_update_times(struct bch_fs *c, fuse_ino_t inum)
 {
        struct btree_trans trans;
-       struct btree_iter *iter;
+       struct btree_iter iter;
        struct bch_inode_unpacked inode_u;
        int ret = 0;
        u64 now;
@@ -533,22 +532,22 @@ retry:
        bch2_trans_begin(&trans);
        now = bch2_current_time(c);
 
-       iter = bch2_inode_peek(&trans, &inode_u, inum, BTREE_ITER_INTENT);
-       ret = PTR_ERR_OR_ZERO(iter);
+       ret = bch2_inode_peek(&trans, &iter, &inode_u, inum, BTREE_ITER_INTENT);
        if (ret)
                goto err;
 
        inode_u.bi_mtime = now;
        inode_u.bi_ctime = now;
 
-       ret = bch2_inode_write(&trans, iter, &inode_u);
+       ret = bch2_inode_write(&trans, &iter, &inode_u);
        if (ret)
                goto err;
 
        ret = bch2_trans_commit(&trans, NULL, NULL,
-                               BTREE_INSERT_ATOMIC|BTREE_INSERT_NOFAIL);
+                               BTREE_INSERT_NOFAIL);
 
 err:
+        bch2_trans_iter_exit(&trans, &iter);
        if (ret == -EINTR)
                goto retry;