aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2008-06-10 10:07:39 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:03 -0400
commit6bf13c0cc833bf5ba013d6aa60379484bf48c4e6 (patch)
treeae2b54a1a26a89fece49f6b6d6dff8448efab542 /fs/btrfs/ctree.h
parenteba12c7bfcb4855fc757357e5e5b0b9a474499ba (diff)
Btrfs: transaction ioctls
These ioctls let a user application hold a transaction open while it performs a series of operations. A final ioctl does a sync on the fs (closing the current transaction). This is the main requirement for Ceph's OSD to be able to keep the data it's storing in a btrfs volume consistent, and AFAICS it works just fine. The application would do something like fd = ::open("some/file", O_RDONLY); ::ioctl(fd, BTRFS_IOC_TRANS_START); /* do a bunch of stuff */ ::ioctl(fd, BTRFS_IOC_TRANS_END); or just ::close(fd); And to ensure it commits to disk, ::ioctl(fd, BTRFS_IOC_SYNC); When a transaction is held open, the trans_handle is attached to the struct file (via private_data) so that it will get cleaned up if the process dies unexpectedly. A held transaction is also ended on fsync() to avoid a deadlock. A misbehaving application could also deliberately hold a transaction open, effectively locking up the FS, so it may make sense to restrict something like this to root or something. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index ad4eacca7f59..1dcf4fb5b688 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1575,6 +1575,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb);
1575void btrfs_destroy_inode(struct inode *inode); 1575void btrfs_destroy_inode(struct inode *inode);
1576int btrfs_init_cachep(void); 1576int btrfs_init_cachep(void);
1577void btrfs_destroy_cachep(void); 1577void btrfs_destroy_cachep(void);
1578long btrfs_ioctl_trans_end(struct file *file);
1578long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 1579long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1579struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid, 1580struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid,
1580 struct btrfs_root *root); 1581 struct btrfs_root *root);
@@ -1595,6 +1596,8 @@ extern struct file_operations btrfs_file_operations;
1595int btrfs_drop_extents(struct btrfs_trans_handle *trans, 1596int btrfs_drop_extents(struct btrfs_trans_handle *trans,
1596 struct btrfs_root *root, struct inode *inode, 1597 struct btrfs_root *root, struct inode *inode,
1597 u64 start, u64 end, u64 inline_limit, u64 *hint_block); 1598 u64 start, u64 end, u64 inline_limit, u64 *hint_block);
1599int btrfs_release_file(struct inode *inode, struct file *file);
1600
1598/* tree-defrag.c */ 1601/* tree-defrag.c */
1599int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, 1602int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
1600 struct btrfs_root *root, int cache_only); 1603 struct btrfs_root *root, int cache_only);
@@ -1615,4 +1618,5 @@ int btrfs_delete_xattrs(struct btrfs_trans_handle *trans,
1615u64 btrfs_parse_size(char *str); 1618u64 btrfs_parse_size(char *str);
1616int btrfs_parse_options(char *options, struct btrfs_root *root, 1619int btrfs_parse_options(char *options, struct btrfs_root *root,
1617 char **subvol_name); 1620 char **subvol_name);
1621int btrfs_sync_fs(struct super_block *sb, int wait);
1618#endif 1622#endif