+#ifdef BCACHEFS_FUSE
+
#include <errno.h>
#include <float.h>
#include <getopt.h>
ret = bch2_inode_write(&trans, iter, &inode_u) ?:
bch2_trans_commit(&trans, NULL, NULL,
- BTREE_INSERT_ATOMIC|
BTREE_INSERT_NOFAIL);
err:
if (ret == -EINTR)
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,
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));
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,
fuse_ino_t newparent, const char *newname)
{
struct bch_fs *c = fuse_req_userdata(req);
- struct bch_inode_unpacked inode_u;
+ struct bch_inode_unpacked dir_u, inode_u;
struct qstr qstr = QSTR(newname);
int ret;
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, &inode_u, &qstr));
+ inum, &dir_u, &inode_u, &qstr));
if (!ret) {
struct fuse_entry_param e = inode_to_entry(c, &inode_u);
goto err;
ret = bch2_trans_commit(&trans, NULL, NULL,
- BTREE_INSERT_ATOMIC|BTREE_INSERT_NOFAIL);
+ BTREE_INSERT_NOFAIL);
err:
if (ret == -EINTR)
inum, size, offset);
struct fuse_align_io align = align_io(c, size, offset);
+ void *aligned_buf = aligned_alloc(PAGE_SIZE, align.size);
+ BUG_ON(!aligned_buf);
if (get_inode_io_opts(c, inum, &io_opts)) {
ret = -ENOENT;
}
/* Realign the data and read in start and end, if needed */
- void *aligned_buf = aligned_alloc(PAGE_SIZE, align.size);
/* Read partial start data. */
if (align.pad_start) {
if (!ret) {
BUG_ON(written == 0);
fuse_reply_write(req, written);
+ free(aligned_buf);
return;
}
err:
fuse_reply_err(req, -ret);
+ free(aligned_buf);
}
static void bcachefs_fuse_symlink(fuse_req_t req, const char *link,
struct fuse_align_io align = align_io(c, link_len + 1, 0);
void *aligned_buf = aligned_alloc(PAGE_SIZE, align.size);
+ BUG_ON(!aligned_buf);
+
memset(aligned_buf, 0, align.size);
memcpy(aligned_buf, link, link_len); /* already terminated */
if (fuse_session_mount(se, fuse_opts.mountpoint))
die("fuse_mount err: %m");
+ /* This print statement is a trigger for tests. */
+ printf("Fuse mount initialized.\n");
+
fuse_daemonize(fuse_opts.foreground);
ret = fuse_session_loop(se);
return ret ? 1 : 0;
}
+
+#endif /* BCACHEFS_FUSE */