summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2008-06-10 16:07:39 +0200
committerChris Mason <chris.mason@oracle.com>2008-09-25 17:04:03 +0200
commit6bf13c0cc833bf5ba013d6aa60379484bf48c4e6 (patch)
treeae2b54a1a26a89fece49f6b6d6dff8448efab542 /fs/btrfs/super.c
parentBtrfs: Dislable acl xattr handlers (diff)
downloadlinux-6bf13c0cc833bf5ba013d6aa60379484bf48c4e6.tar.xz
linux-6bf13c0cc833bf5ba013d6aa60379484bf48c4e6.zip
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/super.c')
-rw-r--r--fs/btrfs/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 77f44494e229..39bb86945ed0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -293,7 +293,7 @@ fail_close:
return err;
}
-static int btrfs_sync_fs(struct super_block *sb, int wait)
+int btrfs_sync_fs(struct super_block *sb, int wait)
{
struct btrfs_trans_handle *trans;
struct btrfs_root *root;