diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2010-08-15 17:34:34 +0200 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2010-08-15 17:34:34 +0200 |
commit | 0da4c9cf59e2a977553b5473faf9aa422a1aff47 (patch) | |
tree | 6021a0ba429f6cecf10e733f681e403570b0d626 | |
parent | 8b0fcd17235127af9f4ce33f518022f359d55e4a (diff) |
Bug 26258 — initial btrfs support
Add basic support for creating and checking btrfs. This does not yet support
spanning multiple devices, RAID, etc.
We disable online fsck for now. It works, but is said to be too unstable still.
Also bump the size of the loop devices in the test suite, since btrfs needs at
least 256 MB.
-rw-r--r-- | src/daemon.c | 16 | ||||
-rw-r--r-- | src/helpers/job-mkfs.c | 46 | ||||
-rwxr-xr-x | tests/run | 10 |
3 files changed, 69 insertions, 3 deletions
diff --git a/src/daemon.c b/src/daemon.c index a5f34ee..dbd55b6 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -309,6 +309,22 @@ static const Filesystem known_file_systems[] = TRUE, /* supports_online_resize_shrink */ }, { + "btrfs", /* id */ + "BTRFS", /* name */ + TRUE, /* supports_unix_owners */ + TRUE, /* can_mount */ + TRUE, /* can_create */ + 16, /* max_label_len */ + FALSE, /* supports_label_rename; TODO: this still needs a tool */ + FALSE, /* supports_online_label_rename*/ + TRUE, /* supports_fsck */ + FALSE, /* supports_online_fsck */ + TRUE, /* supports_resize_enlarge */ + FALSE, /* supports_online_resize_enlarge */ + TRUE, /* supports_resize_shrink */ + FALSE, /* supports_online_resize_shrink */ + }, + { "xfs", /* id */ "XFS", /* name */ TRUE, /* supports_unix_owners */ diff --git a/src/helpers/job-mkfs.c b/src/helpers/job-mkfs.c index 62cdfff..e363484 100644 --- a/src/helpers/job-mkfs.c +++ b/src/helpers/job-mkfs.c @@ -179,6 +179,52 @@ main (int argc, command_line = g_string_free (s, FALSE); } + else if (strcmp (fstype, "btrfs") == 0) + { + + s = g_string_new ("mkfs.btrfs"); + for (n = 0; options[n] != NULL; n++) + { + if (g_str_has_prefix (options[n], "label=")) + { + label = strdup (options[n] + sizeof("label=") - 1); + if (!validate_and_escape_label (&label, 12)) + { + g_string_free (s, TRUE); + goto out; + } + g_string_append_printf (s, " -L \"%s\"", label); + g_free (label); + label = NULL; + } + else if (g_str_has_prefix (options[n], "take_ownership_uid=")) + { + take_ownership_uid = strtol (options[n] + sizeof("take_ownership_uid=") - 1, &endp, 10); + if (endp == NULL || *endp != '\0') + { + g_printerr ("option %s is malformed\n", options[n]); + goto out; + } + } + else if (g_str_has_prefix (options[n], "take_ownership_gid=")) + { + take_ownership_gid = strtol (options[n] + sizeof("take_ownership_gid=") - 1, &endp, 10); + if (endp == NULL || *endp != '\0') + { + g_printerr ("option %s is malformed\n", options[n]); + goto out; + } + } + else + { + g_printerr ("option %s not supported\n", options[n]); + goto out; + } + } + g_string_append_printf (s, " %s", device); + command_line = g_string_free (s, FALSE); + + } else if (strcmp (fstype, "xfs") == 0) { @@ -46,7 +46,7 @@ import optparse import re NUM_VDEV = 3 # number of virtual test devices that we need -VDEV_SIZE = 160000000 # size of virtual test devices +VDEV_SIZE = 300000000 # size of virtual test devices test_md_dev = '/dev/md125' # Those file systems are known to have a broken handling of permissions, in @@ -441,6 +441,10 @@ class FS(UDisksTestCase): '''fs: ext4''' self._do_fs_check('ext4') + def test_btrfs(self): + '''fs: btrfs''' + self._do_fs_check('btrfs') + def test_minix(self): '''fs: minix''' self._do_fs_check('minix') @@ -571,8 +575,8 @@ class FS(UDisksTestCase): self.assertEqual(fs[3], type != 'swap') # can_mount self.assert_(fs[4]) # can_create supports_label_rename = fs[6] - # minix does not support labels; EXFAIL: swap and nilfs2 don't have a program for it - self.assertEqual(supports_label_rename, type not in ('nilfs2', 'minix', 'swap')) + # minix does not support labels; EXFAIL: swap, btrfs, nilfs2 don't have a program for it + self.assertEqual(supports_label_rename, type not in ('nilfs2', 'btrfs', 'minix', 'swap')) break else: self.fail('KnownFilesystems does not contain ' + type) |