[PATCH] udisks: add nilfs2 filesystem

Jiro SEKIBA jir at unicus.jp
Tue Aug 10 01:00:49 PDT 2010


Hi, Martin

At Sun, 8 Aug 2010 19:44:18 +0200,
Martin Pitt wrote:
>
> Hello Jiro,
> 
> Jiro SEKIBA [2010-07-25 11:41 +0900]:
> > This is a patch against udisks to support creating and mounting
> > nilfs2 filesystem.  To detect the filesystem, the latest util-linux-ng
> > and a following typo patch are required.
> > http://www.spinics.net/lists/util-linux-ng/msg03304.html
> 
> Jiro SEKIBA [2010-08-06 14:00 +0900]:
> > Hi, 
> > 
> > The patch I mentioned last mail has been incorporated.
> > http://www.spinics.net/lists/util-linux-ng/msg03338.html
> 
> Ah, thanks. Then it's time to incorporate support for it in udisks as
> well. However, this should go along with a working test case. Can you
> please apply attached patch as well, and check how far it gets? If the
> entire test suite gives some trouble (e. g. you don't have LVM tools
> installed, etc.), you can run just this single test with
> 
>   sudo tests/run FS.test_nilfs2
> 
> This will exercise the most common file operations, and ensures that
> your parameter settings are correct and work with the installed
> *.nilfs2 tools. I can't test nilfs2 easily here, so it would be good
> if you could run this and fix it up before committing.

I needed to modify some part of the script to run the test and 
pass the test correctly.  I attached the changes.

To run the test, I modified the size of virtual disk size,
for nilfs2 requires larger disk size.

To pass the test, I modified number of opened file check.  
When you mount nilfs2 partition, garbage collector daemon will start.
The garbage collector opens a file  named ".nilfs" at mount point.
Therefore the test gets false positive.

I also modified not to check rename label.  The patch I sent to this list
does not support label rename.  nilfs2 utility to rename label is in progress,
but not ready yet.  I'll write a patch for udisks when the utility is ready.

Here is the test out puts
------8<------8<------8<------8<------8<------8<------8<------
$ sudo tests/run -l log FS.test_nilfs2
Testing binaries from local build tree
daemon path: src/udisks-daemon
Set up temporary loop devices: /dev/loop0 /dev/loop1 /dev/loop2
mdadm: array /dev/md125 started.
fs: nilfs2 ... [cli]mount.nilfs2: WARNING! - The NILFS on-disk format may change at any time.
mount.nilfs2: WARNING! - Do not place critical data on a NILFS filesystem.
mount.nilfs2: WARNING! - The NILFS on-disk format may change at any time.
mount.nilfs2: WARNING! - Do not place critical data on a NILFS filesystem.
 [ud] ok

----------------------------------------------------------------------
Ran 1 test in 8.981s

OK
mdadm: stopped /dev/md125
------8<------8<------8<------8<------8<------8<------8<------


Thank you for the assistance!

regards

> 
> Thank you!
> 
> Martin
> 
> -- 
> Martin Pitt                        | http://www.piware.de
> Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
> [1.1.2 test-nilfs2.patch <text/x-diff; us-ascii (quoted-printable)>]
> diff --git a/tests/run b/tests/run
> index 420d39e..00ff912 100755
> --- a/tests/run
> +++ b/tests/run
> @@ -465,6 +465,10 @@ class FS(UDisksTestCase):
>          '''fs: swap'''
>          self._do_fs_check('swap')
>  
> +    def test_nilfs2(self):
> +        '''fs: nilfs2'''
> +        self._do_fs_check('nilfs2')
> +
>      def _do_fs_check(self, type):
>          '''Run checks for a particular file system.'''
>  
> [1.2 Digital signature <application/pgp-signature (7bit)>]
> 
> [2  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> devkit-devel mailing list
> devkit-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/devkit-devel

-- 
Jiro SEKIBA <jir at unicus.jp>

-------------- next part --------------
diff --git a/tests/run b/tests/run
index 420d39e..f73ef7e 100755
--- a/tests/run
+++ b/tests/run
@@ -46,7 +46,7 @@ import optparse
 import re
 
 NUM_VDEV = 3 # number of virtual test devices that we need
-VDEV_SIZE = 60000000 # size of virtual test devices
+VDEV_SIZE = 160000000 # size of virtual test devices
 test_md_dev = '/dev/md125'
 
 # Those file systems are known to have a broken handling of permissions, in
@@ -465,6 +465,10 @@ class FS(UDisksTestCase):
         '''fs: swap'''
         self._do_fs_check('swap')
 
+    def test_nilfs2(self):
+        '''fs: nilfs2'''
+        self._do_fs_check('nilfs2')
+
     def _do_fs_check(self, type):
         '''Run checks for a particular file system.'''
 
@@ -568,7 +572,7 @@ class FS(UDisksTestCase):
                 self.assert_(fs[4]) # can_create
                 supports_label_rename = fs[6]
                 # minix does not support labels; EXFAIL: swap doesn't have a program for it
-                self.assertEqual(supports_label_rename, type not in ('minix', 'swap'))
+                self.assertEqual(supports_label_rename, type not in ('nilfs2', 'minix', 'swap'))
                 break
         else:
             self.fail('KnownFilesystems does not contain ' + type)
@@ -621,19 +625,27 @@ class FS(UDisksTestCase):
             self.assertEqual((st.st_uid, st.st_gid), (0, 0))
 
             # open files when mounted
-            self.assertEqual(iface.FilesystemListOpenFiles(), [])
+            num_open_file = 0
+            if type == 'nilfs2':
+                num_open_file = 1
+
+            result = iface.FilesystemListOpenFiles()
+            self.assertEqual(len(result), num_open_file)
 
             f = open(os.path.join(mount_path, 'test.txt'), 'w')
+            num_open_file += 1
             result = iface.FilesystemListOpenFiles()
-            self.assertEqual(len(result), 1)
+            self.assertEqual(len(result), num_open_file)
             self.assertEqual(result[0][0], os.getpid())
             self.assertEqual(result[0][1], os.geteuid())
             self.assert_(sys.argv[0] in result[0][2])
             f.close()
-            self.assertEqual(iface.FilesystemListOpenFiles(), [])
+            num_open_file -= 1
 
-            self._do_file_perms_checks(type, mount_path)
+            result = iface.FilesystemListOpenFiles()
+            self.assertEqual(len(result), num_open_file)
 
+            self._do_file_perms_checks(type, mount_path)
             # unmount
             self.retry_busy(self.partition_iface().FilesystemUnmount, [])
             self.failIf(os.path.exists(mount_path), 'mount point was not removed')


More information about the devkit-devel mailing list